Xorn
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Pages
Classes | Functions
xorn.geda.attrib Namespace Reference

Attribute parsing and lookup. More...

Classes

class  MalformedAttributeError
 Raised when trying to parse a text object that is not recognized as an attribute. More...
 

Functions

def parse_string
 Parse an attribute string of the form name=value into its name and value parts. More...
 
def is_attribute
 Tell whether an object is a text object whose text constitutes a valid attribute. More...
 
def inherited_objects
 Returns the toplevel objects of a component's symbol. More...
 
def find_floating_attribs
 Return all floating attributes in the given revision. More...
 
def find_attached_attribs
 Return the attributes directly attached to a net or component. More...
 
def find_inherited_attribs
 Return the attributes inherited by a component via its symbol. More...
 
def find_all_attribs
 Return all attributes, attached and inherited, of the specified component. More...
 
def search
 Search a list of objects for attributes with a certain name and return their values. More...
 
def search_floating
 Search the floating attributes in a revision for an attribute name and return matching values. More...
 
def search_attached
 Search attributes attached to a net or component for an attribute name and return matching values. More...
 
def search_inherited
 Search attributes inherited by a component for an attribute name and return matching values. More...
 
def search_all
 Search both attached and inherited attributes of a component for an attribute name and return matching values. More...
 
def find_pins_by_attribute
 Return all pins in a component with a particular attribute. More...
 

Detailed Description

Attribute parsing and lookup.

An attribute is a normal text object with a string that is delimited by an equals sign ("="). The part before the equals sign is called name and the part of the string behind the equals sign is called value. Attributes can either be floating (that is, not attached to any object) or attached to a net (including pins and buses) or component.

Note
If one of the parts is empty, the name ends with a space character, or the value starts with a space character, the text object is not recognized as an attribute.

In addition to its attached attributes, a component inherits the attributes which live as toplevel un-attached attributes inside the prim_objs of its symbol.

Function Documentation

def xorn.geda.attrib.find_all_attribs (   ob)

Return all attributes, attached and inherited, of the specified component.

This function aggregates the attached and inherited attributes belonging to a given object.

Exceptions
KeyErrorif the object doesn't exist
ValueErrorif the object isn't a component

Definition at line 123 of file attrib.py.

def xorn.geda.attrib.find_attached_attribs (   ob)

Return the attributes directly attached to a net or component.

Exceptions
KeyErrorif the object doesn't exist

Definition at line 103 of file attrib.py.

def xorn.geda.attrib.find_floating_attribs (   rev)

Return all floating attributes in the given revision.

Definition at line 96 of file attrib.py.

def xorn.geda.attrib.find_inherited_attribs (   ob)

Return the attributes inherited by a component via its symbol.

Exceptions
KeyErrorif the object doesn't exist
ValueErrorif the object isn't a component

Definition at line 111 of file attrib.py.

def xorn.geda.attrib.find_pins_by_attribute (   ob,
  name,
  value 
)

Return all pins in a component with a particular attribute.

Exceptions
KeyErrorif ob doesn't exist
ValueErrorif ob isn't a component
Returns
A list of pins with the given attribute.

Definition at line 197 of file attrib.py.

def xorn.geda.attrib.inherited_objects (   ob)

Returns the toplevel objects of a component's symbol.

Exceptions
KeyErrorif the object doesn't exist
ValueErrorif the object isn't a component

Definition at line 88 of file attrib.py.

def xorn.geda.attrib.is_attribute (   ob)

Tell whether an object is a text object whose text constitutes a valid attribute.

Exceptions
KeyErrorif the object doesn't exist

Definition at line 72 of file attrib.py.

def xorn.geda.attrib.parse_string (   string)

Parse an attribute string of the form name=value into its name and value parts.

Exceptions
MalformedAttributeErrorif the passed string is not a syntactically correct attribute string
Returns
A pair (name, value).

Definition at line 55 of file attrib.py.

def xorn.geda.attrib.search (   attribs,
  name 
)

Search a list of objects for attributes with a certain name and return their values.

Returns
List of strings with the values of the matching attributes.

Definition at line 133 of file attrib.py.

def xorn.geda.attrib.search_all (   ob,
  name 
)

Search both attached and inherited attributes of a component for an attribute name and return matching values.

For nets, use search_attached instead.

Exceptions
KeyErrorif the object doesn't exist
ValueErrorif the object isn't a component
Returns
List of strings with the values of the matching attributes.

Definition at line 186 of file attrib.py.

def xorn.geda.attrib.search_attached (   ob,
  name 
)

Search attributes attached to a net or component for an attribute name and return matching values.

Exceptions
KeyErrorif the object doesn't exist
Returns
List of strings with the values of the matching attributes.

Definition at line 162 of file attrib.py.

def xorn.geda.attrib.search_floating (   rev,
  name 
)

Search the floating attributes in a revision for an attribute name and return matching values.

Returns
List of strings with the values of the matching attributes.

Definition at line 152 of file attrib.py.

def xorn.geda.attrib.search_inherited (   ob,
  name 
)

Search attributes inherited by a component for an attribute name and return matching values.

Exceptions
KeyErrorif the object doesn't exist
ValueErrorif the object isn't a component
Returns
List of strings with the values of the matching attributes.

Definition at line 173 of file attrib.py.