Classes for Schematic Files (.sch)

These classes are used only within Eagle schematic files (.sch).

SchematicFile

class Swoop.SchematicFile[source]

Bases: Swoop.Swoop.EagleFile

Class representing the contents of a <eagle> tag in Eagle files.

Attributes:

  • version

Collections:

  • grid: Singleton Grid object.
  • schematic: Singleton Schematic object.
  • description: Singleton Description object.
  • compatibility: Singleton Compatibility object.
  • setting: List of Setting objects.
  • sheet: List of Sheet objects.
  • approved: List of Approved objects.
  • layer: Map of Layer objects indexed by their name.
  • library: Map of Library objects indexed by their name.
  • attribute: Map of Attribute objects indexed by their name.
  • variantdef: Map of Variantdef objects indexed by their name.
  • class: Map of Class objects indexed by their name.
  • module: Map of Module objects indexed by their name.
  • part: Map of Part objects indexed by their name.
add_approved(s)[source]

Add a Approved to the approved_errors of this SchematicFile.

Parameters:s – The Approved to add.
Return type:self
add_attribute(s)[source]

Add a Attribute to the attributes of this SchematicFile.

Parameters:s – The Attribute to add.
Return type:self
add_class(s)[source]

Add a Class to the classes of this SchematicFile.

Parameters:s – The Class to add.
Return type:self
add_library(s)[source]

Add a Library to the libraries of this SchematicFile.

Parameters:s – The Library to add.
Return type:self
add_module(s)[source]

Add a Module to the modules of this SchematicFile.

Parameters:s – The Module to add.
Return type:self
add_part(s)[source]

Add a Part to the parts of this SchematicFile.

Parameters:s – The Part to add.
Return type:self
add_setting(s)[source]

Add a Setting to the settings of this SchematicFile.

Parameters:s – The Setting to add.
Return type:self
add_sheet(s)[source]

Add a Sheet to the sheets of this SchematicFile.

Parameters:s – The Sheet to add.
Return type:self
add_variantdef(s)[source]

Add a Variantdef to the variantdefs of this SchematicFile.

Parameters:s – The Variantdef to add.
Return type:self
clear_approved_errors()[source]

Remove all the Approved objects from the approved_errors of this SchematicFile.

Return type:self
clear_attributes()[source]

Remove all the Attribute objects from the attributes of this SchematicFile.

Return type:self
clear_classes()[source]

Remove all the Class objects from the classes of this SchematicFile.

Return type:self
clear_libraries()[source]

Remove all the Library objects from the libraries of this SchematicFile.

Return type:self
clear_modules()[source]

Remove all the Module objects from the modules of this SchematicFile.

Return type:self
clear_parts()[source]

Remove all the Part objects from the parts of this SchematicFile.

Return type:self
clear_settings()[source]

Remove all the Setting objects from the settings of this SchematicFile.

Return type:self
clear_sheets()[source]

Remove all the Sheet objects from the sheets of this SchematicFile.

Return type:self
clear_variantdefs()[source]

Remove all the Variantdef objects from the variantdefs of this SchematicFile.

Return type:self
clone()[source]

Recursively clone this SchematicFile. It will be identical to the original, but it’s parent will be None.

Return type:SchematicFile
dump(indent='', increment=' ')[source]

Recursive debug dump.

Parameters:
  • indent – Indentation string. The output will be indented by this much.
  • increment – This will be appendeded to indent on recursive invocations.
Return type:

None

get_approved_errors(attrs=None, type=None)[source]

Return (and possibly filter) items in the the approved_errors list of Approved objects for this SchematicFile.

This functions provides a mechanism for filtering the items as well. The keys in attrs are taken as attributes names and the values are requested values. Items in the list that have all the requested values for the corresponding attributes will be returned.

A if type is not None, the item will match if it is an instance of the type provided.

Parameters:
  • attrs – A set of key-value pairs that represent a filter to apply to the item’s attributes.
  • type – A type to filter on. Only items that are an instance of this type will be returned.
Returns:

A List of Approved objects

Return type:

List of Approved objects

get_attribute(key)[source]

Lookup and return a Attribute from the attributes of this SchematicFile.

Parameters:key – A str to use for the lookup. The lookup uses the name of the Attribute objects.
Return type:A Attribute object or None, if there is no such item.
get_attributes(attrs=None, type=None)[source]

Return (and possibly filter) items in the the attributes map of Attribute objects for this SchematicFile.

This functions provides a mechanism for filtering the items as well. The keys in attrs are taken as attributes names and the values are requested values. Items in the list that have all the requested values for the corresponding attributes will be returned.

A if type is not None, the item will match if it is an instance of the type provided.

Parameters:
  • attrs – A set of key-value pairs that represent a filter to apply to the item’s attributes.
  • type – A type to filter on. Only items that are an instance of this type will be returned.
Returns:

A List of Attribute objects

Return type:

List of Attribute objects

get_children()[source]

Get all the children of this EagleFilePart.

Return type:List of EagleFilePart objects
get_class(key)[source]

Lookup and return a Class from the classes of this SchematicFile.

Parameters:key – A str to use for the lookup. The lookup uses the name of the Class objects.
Return type:A Class object or None, if there is no such item.
get_classes(attrs=None, type=None)[source]

Return (and possibly filter) items in the the classes map of Class objects for this SchematicFile.

This functions provides a mechanism for filtering the items as well. The keys in attrs are taken as attributes names and the values are requested values. Items in the list that have all the requested values for the corresponding attributes will be returned.

A if type is not None, the item will match if it is an instance of the type provided.

Parameters:
  • attrs – A set of key-value pairs that represent a filter to apply to the item’s attributes.
  • type – A type to filter on. Only items that are an instance of this type will be returned.
Returns:

A List of Class objects

Return type:

List of Class objects

get_compatibility()[source]

Get the compatibility from this SchematicFile.

Return type:Compatibility object
get_description()[source]

Get the description from this SchematicFile.

Return type:Description object
get_et()[source]

Generate a <eagle> element tree for a SchematicFile.

Return type:ElementTree.
get_grid()[source]

Get the grid from this SchematicFile.

Return type:Grid object
get_libraries(attrs=None, type=None)[source]

Return (and possibly filter) items in the the libraries map of Library objects for this SchematicFile.

This functions provides a mechanism for filtering the items as well. The keys in attrs are taken as attributes names and the values are requested values. Items in the list that have all the requested values for the corresponding attributes will be returned.

A if type is not None, the item will match if it is an instance of the type provided.

Parameters:
  • attrs – A set of key-value pairs that represent a filter to apply to the item’s attributes.
  • type – A type to filter on. Only items that are an instance of this type will be returned.
Returns:

A List of Library objects

Return type:

List of Library objects

get_library(key)[source]

Lookup and return a Library from the libraries of this SchematicFile.

Parameters:key – A str to use for the lookup. The lookup uses the name of the Library objects.
Return type:A Library object or None, if there is no such item.
get_module(key)[source]

Lookup and return a Module from the modules of this SchematicFile.

Parameters:key – A str to use for the lookup. The lookup uses the name of the Module objects.
Return type:A Module object or None, if there is no such item.
get_modules(attrs=None, type=None)[source]

Return (and possibly filter) items in the the modules map of Module objects for this SchematicFile.

This functions provides a mechanism for filtering the items as well. The keys in attrs are taken as attributes names and the values are requested values. Items in the list that have all the requested values for the corresponding attributes will be returned.

A if type is not None, the item will match if it is an instance of the type provided.

Parameters:
  • attrs – A set of key-value pairs that represent a filter to apply to the item’s attributes.
  • type – A type to filter on. Only items that are an instance of this type will be returned.
Returns:

A List of Module objects

Return type:

List of Module objects

get_nth_approved(n)[source]

get then nth Approved object from the approved_errors of this SchematicFile.

Parameters:n – Index of the item to return.
Return type:Approved object
get_nth_attribute(n)[source]

get then nth Attribute object from the attributes of this SchematicFile.

Parameters:n – Index of the item to return.
Return type:Attribute object
get_nth_class(n)[source]

get then nth Class object from the classes of this SchematicFile.

Parameters:n – Index of the item to return.
Return type:Class object
get_nth_library(n)[source]

get then nth Library object from the libraries of this SchematicFile.

Parameters:n – Index of the item to return.
Return type:Library object
get_nth_module(n)[source]

get then nth Module object from the modules of this SchematicFile.

Parameters:n – Index of the item to return.
Return type:Module object
get_nth_part(n)[source]

get then nth Part object from the parts of this SchematicFile.

Parameters:n – Index of the item to return.
Return type:Part object
get_nth_setting(n)[source]

get then nth Setting object from the settings of this SchematicFile.

Parameters:n – Index of the item to return.
Return type:Setting object
get_nth_sheet(n)[source]

get then nth Sheet object from the sheets of this SchematicFile.

Parameters:n – Index of the item to return.
Return type:Sheet object
get_nth_variantdef(n)[source]

get then nth Variantdef object from the variantdefs of this SchematicFile.

Parameters:n – Index of the item to return.
Return type:Variantdef object
get_part(key)[source]

Lookup and return a Part from the parts of this SchematicFile.

Parameters:key – A str to use for the lookup. The lookup uses the name of the Part objects.
Return type:A Part object or None, if there is no such item.
get_parts(attrs=None, type=None)[source]

Return (and possibly filter) items in the the parts map of Part objects for this SchematicFile.

This functions provides a mechanism for filtering the items as well. The keys in attrs are taken as attributes names and the values are requested values. Items in the list that have all the requested values for the corresponding attributes will be returned.

A if type is not None, the item will match if it is an instance of the type provided.

Parameters:
  • attrs – A set of key-value pairs that represent a filter to apply to the item’s attributes.
  • type – A type to filter on. Only items that are an instance of this type will be returned.
Returns:

A List of Part objects

Return type:

List of Part objects

get_schematic()[source]

Get the schematic from this SchematicFile.

Return type:Schematic object
get_settings(attrs=None, type=None)[source]

Return (and possibly filter) items in the the settings list of Setting objects for this SchematicFile.

This functions provides a mechanism for filtering the items as well. The keys in attrs are taken as attributes names and the values are requested values. Items in the list that have all the requested values for the corresponding attributes will be returned.

A if type is not None, the item will match if it is an instance of the type provided.

Parameters:
  • attrs – A set of key-value pairs that represent a filter to apply to the item’s attributes.
  • type – A type to filter on. Only items that are an instance of this type will be returned.
Returns:

A List of Setting objects

Return type:

List of Setting objects

get_sheets(attrs=None, type=None)[source]

Return (and possibly filter) items in the the sheets list of Sheet objects for this SchematicFile.

This functions provides a mechanism for filtering the items as well. The keys in attrs are taken as attributes names and the values are requested values. Items in the list that have all the requested values for the corresponding attributes will be returned.

A if type is not None, the item will match if it is an instance of the type provided.

Parameters:
  • attrs – A set of key-value pairs that represent a filter to apply to the item’s attributes.
  • type – A type to filter on. Only items that are an instance of this type will be returned.
Returns:

A List of Sheet objects

Return type:

List of Sheet objects

get_variantdef(key)[source]

Lookup and return a Variantdef from the variantdefs of this SchematicFile.

Parameters:key – A str to use for the lookup. The lookup uses the name of the Variantdef objects.
Return type:A Variantdef object or None, if there is no such item.
get_variantdefs(attrs=None, type=None)[source]

Return (and possibly filter) items in the the variantdefs map of Variantdef objects for this SchematicFile.

This functions provides a mechanism for filtering the items as well. The keys in attrs are taken as attributes names and the values are requested values. Items in the list that have all the requested values for the corresponding attributes will be returned.

A if type is not None, the item will match if it is an instance of the type provided.

Parameters:
  • attrs – A set of key-value pairs that represent a filter to apply to the item’s attributes.
  • type – A type to filter on. Only items that are an instance of this type will be returned.
Returns:

A List of Variantdef objects

Return type:

List of Variantdef objects

get_version()[source]

Return the value of version for this SchematicFile. This corresponds to the version attribute of a <eagle> in an Eagle file.

Return type:str
remove_approved(efp)[source]

Remove a Approved from the approved_errors of this SchematicFile.

Parameters:efp – The Approved object to remove.
Return type:self
remove_attribute(efp)[source]

Remove a Attribute from the attributes of this SchematicFile.

Parameters:efp – The Attribute object to remove.
Return type:self
remove_child(efp)[source]

Remove a child EagleFilePart object.

Parameters:efp – the class:EagleFilePart object to remove.
Returns:Nothing
remove_class(efp)[source]

Remove a Class from the classes of this SchematicFile.

Parameters:efp – The Class object to remove.
Return type:self
remove_library(efp)[source]

Remove a Library from the libraries of this SchematicFile.

Parameters:efp – The Library object to remove.
Return type:self
remove_module(efp)[source]

Remove a Module from the modules of this SchematicFile.

Parameters:efp – The Module object to remove.
Return type:self
remove_part(efp)[source]

Remove a Part from the parts of this SchematicFile.

Parameters:efp – The Part object to remove.
Return type:self
remove_setting(efp)[source]

Remove a Setting from the settings of this SchematicFile.

Parameters:efp – The Setting object to remove.
Return type:self
remove_sheet(efp)[source]

Remove a Sheet from the sheets of this SchematicFile.

Parameters:efp – The Sheet object to remove.
Return type:self
remove_variantdef(efp)[source]

Remove a Variantdef from the variantdefs of this SchematicFile.

Parameters:efp – The Variantdef object to remove.
Return type:self
set_compatibility(s)[source]

Set the Compatibility for this SchematicFile.

Parameters:sCompatibility to set.
Return type:self
set_description(s)[source]

Set the Description for this SchematicFile.

Parameters:sDescription to set.
Return type:self
set_grid(s)[source]

Set the Grid for this SchematicFile.

Parameters:sGrid to set.
Return type:self
set_schematic(s)[source]

Set the Schematic for this SchematicFile.

Parameters:sSchematic to set.
Return type:self
set_version(v)[source]

Set the value of version for this SchematicFile. This corresponds to the version attribute of a <eagle> in an Eagle file.

Parameters:vEagleFilePart to set.
Return type:self
with_version(v)[source]

Filter this EagleFilePart object based on the value of version. For use in combination with From objects.

Return self if one of the following is true:

  1. version equals v
  2. v is callable and v(self.get_version() is True

This is useful in combination with From object.

Parameters:t – The value to check for or a callable object.
Returns:self if the criteria above are met and None otherwise.
Return type:EagelFilePart or None

Sheet

class Swoop.Sheet[source]

Bases: Swoop.Swoop.EagleFilePart

Class representing the contents of a <sheet> tag in Eagle files.

Attributes:

Collections:

add_bus(s)[source]

Add a Bus to the busses of this Sheet.

Parameters:s – The Bus to add.
Return type:self
add_instance(s)[source]

Add a Instance to the instances of this Sheet.

Parameters:s – The Instance to add.
Return type:self
add_moduleinst(s)[source]

Add a Moduleinst to the moduleinsts of this Sheet.

Parameters:s – The Moduleinst to add.
Return type:self
add_net(s)[source]

Add a Net to the nets of this Sheet.

Parameters:s – The Net to add.
Return type:self
add_plain_element(s)[source]

Add a Polygon, Wire, Text, Dimension, Circle, Rectangle, Frame or Hole to the plain_elements of this Sheet.

Parameters:s – The Polygon, Wire, Text, Dimension, Circle, Rectangle, Frame or Hole to add.
Return type:self
clear_busses()[source]

Remove all the Bus objects from the busses of this Sheet.

Return type:self
clear_instances()[source]

Remove all the Instance objects from the instances of this Sheet.

Return type:self
clear_moduleinsts()[source]

Remove all the Moduleinst objects from the moduleinsts of this Sheet.

Return type:self
clear_nets()[source]

Remove all the Net objects from the nets of this Sheet.

Return type:self
clear_plain_elements()[source]

Remove all the Polygon, Wire, Text, Dimension, Circle, Rectangle, Frame and Hole objects from the plain_elements of this Sheet.

Return type:self
clone()[source]

Recursively clone this Sheet. It will be identical to the original, but it’s parent will be None.

Return type:Sheet
dump(indent='', increment=' ')[source]

Recursive debug dump.

Parameters:
  • indent – Indentation string. The output will be indented by this much.
  • increment – This will be appendeded to indent on recursive invocations.
Return type:

None

get_bus(key)[source]

Lookup and return a Bus from the busses of this Sheet.

Parameters:key – A str to use for the lookup. The lookup uses the name of the Bus objects.
Return type:A Bus object or None, if there is no such item.
get_busses(attrs=None, type=None)[source]

Return (and possibly filter) items in the the busses map of Bus objects for this Sheet.

This functions provides a mechanism for filtering the items as well. The keys in attrs are taken as attributes names and the values are requested values. Items in the list that have all the requested values for the corresponding attributes will be returned.

A if type is not None, the item will match if it is an instance of the type provided.

Parameters:
  • attrs – A set of key-value pairs that represent a filter to apply to the item’s attributes.
  • type – A type to filter on. Only items that are an instance of this type will be returned.
Returns:

A List of Bus objects

Return type:

List of Bus objects

get_children()[source]

Get all the children of this EagleFilePart.

Return type:List of EagleFilePart objects
get_description()[source]

Get the description from this Sheet.

Return type:Description object
get_et()[source]

Generate a <sheet> element tree for a Sheet.

Return type:ElementTree.
get_instances(attrs=None, type=None)[source]

Return (and possibly filter) items in the the instances list of Instance objects for this Sheet.

This functions provides a mechanism for filtering the items as well. The keys in attrs are taken as attributes names and the values are requested values. Items in the list that have all the requested values for the corresponding attributes will be returned.

A if type is not None, the item will match if it is an instance of the type provided.

Parameters:
  • attrs – A set of key-value pairs that represent a filter to apply to the item’s attributes.
  • type – A type to filter on. Only items that are an instance of this type will be returned.
Returns:

A List of Instance objects

Return type:

List of Instance objects

get_moduleinst(key)[source]

Lookup and return a Moduleinst from the moduleinsts of this Sheet.

Parameters:key – A str to use for the lookup. The lookup uses the name of the Moduleinst objects.
Return type:A Moduleinst object or None, if there is no such item.
get_moduleinsts(attrs=None, type=None)[source]

Return (and possibly filter) items in the the moduleinsts map of Moduleinst objects for this Sheet.

This functions provides a mechanism for filtering the items as well. The keys in attrs are taken as attributes names and the values are requested values. Items in the list that have all the requested values for the corresponding attributes will be returned.

A if type is not None, the item will match if it is an instance of the type provided.

Parameters:
  • attrs – A set of key-value pairs that represent a filter to apply to the item’s attributes.
  • type – A type to filter on. Only items that are an instance of this type will be returned.
Returns:

A List of Moduleinst objects

Return type:

List of Moduleinst objects

get_net(key)[source]

Lookup and return a Net from the nets of this Sheet.

Parameters:key – A str to use for the lookup. The lookup uses the name of the Net objects.
Return type:A Net object or None, if there is no such item.
get_nets(attrs=None, type=None)[source]

Return (and possibly filter) items in the the nets map of Net objects for this Sheet.

This functions provides a mechanism for filtering the items as well. The keys in attrs are taken as attributes names and the values are requested values. Items in the list that have all the requested values for the corresponding attributes will be returned.

A if type is not None, the item will match if it is an instance of the type provided.

Parameters:
  • attrs – A set of key-value pairs that represent a filter to apply to the item’s attributes.
  • type – A type to filter on. Only items that are an instance of this type will be returned.
Returns:

A List of Net objects

Return type:

List of Net objects

get_nth_bus(n)[source]

get then nth Bus object from the busses of this Sheet.

Parameters:n – Index of the item to return.
Return type:Bus object
get_nth_instance(n)[source]

get then nth Instance object from the instances of this Sheet.

Parameters:n – Index of the item to return.
Return type:Instance object
get_nth_moduleinst(n)[source]

get then nth Moduleinst object from the moduleinsts of this Sheet.

Parameters:n – Index of the item to return.
Return type:Moduleinst object
get_nth_net(n)[source]

get then nth Net object from the nets of this Sheet.

Parameters:n – Index of the item to return.
Return type:Net object
get_nth_plain_element(n)[source]

get then nth Polygon, Wire, Text, Dimension, Circle, Rectangle, Frame or Hole object from the plain_elements of this Sheet.

Parameters:n – Index of the item to return.
Return type:Polygon, Wire, Text, Dimension, Circle, Rectangle, Frame or Hole object
get_plain_elements(attrs=None, type=None)[source]

Return (and possibly filter) items in the the plain_elements list of Polygon, Wire, Text, Dimension, Circle, Rectangle, Frame or Hole objects for this Sheet.

This functions provides a mechanism for filtering the items as well. The keys in attrs are taken as attributes names and the values are requested values. Items in the list that have all the requested values for the corresponding attributes will be returned.

A if type is not None, the item will match if it is an instance of the type provided.

Parameters:
  • attrs – A set of key-value pairs that represent a filter to apply to the item’s attributes.
  • type – A type to filter on. Only items that are an instance of this type will be returned.
Returns:

A List of Polygon, Wire, Text, Dimension, Circle, Rectangle, Frame and Hole objects

Return type:

List of Polygon, Wire, Text, Dimension, Circle, Rectangle, Frame and Hole objects

remove_bus(efp)[source]

Remove a Bus from the busses of this Sheet.

Parameters:efp – The Bus object to remove.
Return type:self
remove_child(efp)[source]

Remove a child EagleFilePart object.

Parameters:efp – the class:EagleFilePart object to remove.
Returns:Nothing
remove_instance(efp)[source]

Remove a Instance from the instances of this Sheet.

Parameters:efp – The Instance object to remove.
Return type:self
remove_moduleinst(efp)[source]

Remove a Moduleinst from the moduleinsts of this Sheet.

Parameters:efp – The Moduleinst object to remove.
Return type:self
remove_net(efp)[source]

Remove a Net from the nets of this Sheet.

Parameters:efp – The Net object to remove.
Return type:self
remove_plain_element(efp)[source]

Remove a Polygon, Wire, Text, Dimension, Circle, Rectangle, Frame or Hole from the plain_elements of this Sheet.

Parameters:efp – The Polygon, Wire, Text, Dimension, Circle, Rectangle, Frame or Hole object to remove.
Return type:self
set_description(s)[source]

Set the Description for this Sheet.

Parameters:sDescription to set.
Return type:self

Instance

class Swoop.Instance[source]

Bases: Swoop.Swoop.EagleFilePart

Class representing the contents of a <instance> tag in Eagle files.

Attributes:

  • part
  • gate
  • x
  • y
  • smashed
  • rot

Collections:

  • attribute: Map of Attribute objects indexed by their name.
add_attribute(s)[source]

Add a Attribute to the attributes of this Instance.

Parameters:s – The Attribute to add.
Return type:self
clear_attributes()[source]

Remove all the Attribute objects from the attributes of this Instance.

Return type:self
clone()[source]

Recursively clone this Instance. It will be identical to the original, but it’s parent will be None.

Return type:Instance
dump(indent='', increment=' ')[source]

Recursive debug dump.

Parameters:
  • indent – Indentation string. The output will be indented by this much.
  • increment – This will be appendeded to indent on recursive invocations.
Return type:

None

find_gate()[source]

Find the Gate object refered to by the gate attribute of this object. This is like get_gate(), except it returns the Gate object instead of its name.

Returns:The object
Return type:Gate
find_part()[source]

Find the Part object refered to by the part attribute of this object. This is like get_part(), except it returns the Part object instead of its name.

Returns:The object
Return type:Part
get_attribute(key)[source]

Lookup and return a Attribute from the attributes of this Instance.

Parameters:key – A str to use for the lookup. The lookup uses the name of the Attribute objects.
Return type:A Attribute object or None, if there is no such item.
get_attributes(attrs=None, type=None)[source]

Return (and possibly filter) items in the the attributes map of Attribute objects for this Instance.

This functions provides a mechanism for filtering the items as well. The keys in attrs are taken as attributes names and the values are requested values. Items in the list that have all the requested values for the corresponding attributes will be returned.

A if type is not None, the item will match if it is an instance of the type provided.

Parameters:
  • attrs – A set of key-value pairs that represent a filter to apply to the item’s attributes.
  • type – A type to filter on. Only items that are an instance of this type will be returned.
Returns:

A List of Attribute objects

Return type:

List of Attribute objects

get_children()[source]

Get all the children of this EagleFilePart.

Return type:List of EagleFilePart objects
get_et()[source]

Generate a <instance> element tree for a Instance.

Return type:ElementTree.
get_gate()[source]

Return the value of gate for this Instance. This corresponds to the gate attribute of a <instance> in an Eagle file.

Return type:str
get_nth_attribute(n)[source]

get then nth Attribute object from the attributes of this Instance.

Parameters:n – Index of the item to return.
Return type:Attribute object
get_part()[source]

Return the value of part for this Instance. This corresponds to the part attribute of a <instance> in an Eagle file.

Return type:str
get_rot()[source]

Return the value of rot for this Instance. This corresponds to the rot attribute of a <instance> in an Eagle file.

Return type:str
get_smashed()[source]

Return the value of smashed for this Instance. This corresponds to the smashed attribute of a <instance> in an Eagle file.

Return type:str
get_x()[source]

Return the value of x for this Instance. This corresponds to the x attribute of a <instance> in an Eagle file.

Return type:float
get_y()[source]

Return the value of y for this Instance. This corresponds to the y attribute of a <instance> in an Eagle file.

Return type:float
remove_attribute(efp)[source]

Remove a Attribute from the attributes of this Instance.

Parameters:efp – The Attribute object to remove.
Return type:self
remove_child(efp)[source]

Remove a child EagleFilePart object.

Parameters:efp – the class:EagleFilePart object to remove.
Returns:Nothing
set_gate(v)[source]

Set the value of gate for this Instance. This corresponds to the gate attribute of a <instance> in an Eagle file.

Parameters:vEagleFilePart to set.
Return type:self
set_part(v)[source]

Set the value of part for this Instance. This corresponds to the part attribute of a <instance> in an Eagle file.

Parameters:vEagleFilePart to set.
Return type:self
set_rot(v)[source]

Set the value of rot for this Instance. This corresponds to the rot attribute of a <instance> in an Eagle file.

Parameters:vEagleFilePart to set.
Return type:self
set_smashed(v)[source]

Set the value of smashed for this Instance. This corresponds to the smashed attribute of a <instance> in an Eagle file.

Parameters:vEagleFilePart to set.
Return type:self
set_x(v)[source]

Set the value of x for this Instance. This corresponds to the x attribute of a <instance> in an Eagle file.

Parameters:vEagleFilePart to set.
Return type:self
set_y(v)[source]

Set the value of y for this Instance. This corresponds to the y attribute of a <instance> in an Eagle file.

Parameters:vEagleFilePart to set.
Return type:self
with_gate(v)[source]

Filter this EagleFilePart object based on the value of gate. For use in combination with From objects.

Return self if one of the following is true:

  1. gate equals v
  2. v is callable and v(self.get_gate() is True

This is useful in combination with From object.

Parameters:t – The value to check for or a callable object.
Returns:self if the criteria above are met and None otherwise.
Return type:EagelFilePart or None
with_part(v)[source]

Filter this EagleFilePart object based on the value of part. For use in combination with From objects.

Return self if one of the following is true:

  1. part equals v
  2. v is callable and v(self.get_part() is True

This is useful in combination with From object.

Parameters:t – The value to check for or a callable object.
Returns:self if the criteria above are met and None otherwise.
Return type:EagelFilePart or None
with_rot(v)[source]

Filter this EagleFilePart object based on the value of rot. For use in combination with From objects.

Return self if one of the following is true:

  1. rot equals v
  2. v is callable and v(self.get_rot() is True

This is useful in combination with From object.

Parameters:t – The value to check for or a callable object.
Returns:self if the criteria above are met and None otherwise.
Return type:EagelFilePart or None
with_smashed(v)[source]

Filter this EagleFilePart object based on the value of smashed. For use in combination with From objects.

Return self if one of the following is true:

  1. smashed equals v
  2. v is callable and v(self.get_smashed() is True

This is useful in combination with From object.

Parameters:t – The value to check for or a callable object.
Returns:self if the criteria above are met and None otherwise.
Return type:EagelFilePart or None
with_x(v)[source]

Filter this EagleFilePart object based on the value of x. For use in combination with From objects.

Return self if one of the following is true:

  1. x equals v
  2. v is callable and v(self.get_x() is True

This is useful in combination with From object.

Parameters:t – The value to check for or a callable object.
Returns:self if the criteria above are met and None otherwise.
Return type:EagelFilePart or None
with_y(v)[source]

Filter this EagleFilePart object based on the value of y. For use in combination with From objects.

Return self if one of the following is true:

  1. y equals v
  2. v is callable and v(self.get_y() is True

This is useful in combination with From object.

Parameters:t – The value to check for or a callable object.
Returns:self if the criteria above are met and None otherwise.
Return type:EagelFilePart or None

Bus

class Swoop.Bus[source]

Bases: Swoop.Swoop.EagleFilePart

Class representing the contents of a <bus> tag in Eagle files.

Attributes:

  • name

Collections:

  • segment: List of Segment objects.
add_segment(s)[source]

Add a Segment to the segments of this Bus.

Parameters:s – The Segment to add.
Return type:self
clear_segments()[source]

Remove all the Segment objects from the segments of this Bus.

Return type:self
clone()[source]

Recursively clone this Bus. It will be identical to the original, but it’s parent will be None.

Return type:Bus
dump(indent='', increment=' ')[source]

Recursive debug dump.

Parameters:
  • indent – Indentation string. The output will be indented by this much.
  • increment – This will be appendeded to indent on recursive invocations.
Return type:

None

get_children()[source]

Get all the children of this EagleFilePart.

Return type:List of EagleFilePart objects
get_et()[source]

Generate a <bus> element tree for a Bus.

Return type:ElementTree.
get_name()[source]

Return the value of name for this Bus. This corresponds to the name attribute of a <bus> in an Eagle file.

Return type:str
get_nth_segment(n)[source]

get then nth Segment object from the segments of this Bus.

Parameters:n – Index of the item to return.
Return type:Segment object
get_segments(attrs=None, type=None)[source]

Return (and possibly filter) items in the the segments list of Segment objects for this Bus.

This functions provides a mechanism for filtering the items as well. The keys in attrs are taken as attributes names and the values are requested values. Items in the list that have all the requested values for the corresponding attributes will be returned.

A if type is not None, the item will match if it is an instance of the type provided.

Parameters:
  • attrs – A set of key-value pairs that represent a filter to apply to the item’s attributes.
  • type – A type to filter on. Only items that are an instance of this type will be returned.
Returns:

A List of Segment objects

Return type:

List of Segment objects

remove_child(efp)[source]

Remove a child EagleFilePart object.

Parameters:efp – the class:EagleFilePart object to remove.
Returns:Nothing
remove_segment(efp)[source]

Remove a Segment from the segments of this Bus.

Parameters:efp – The Segment object to remove.
Return type:self
set_name(v)[source]

Set the value of name for this Bus. This corresponds to the name attribute of a <bus> in an Eagle file.

Parameters:vEagleFilePart to set.
Return type:self
with_name(v)[source]

Filter this EagleFilePart object based on the value of name. For use in combination with From objects.

Return self if one of the following is true:

  1. name equals v
  2. v is callable and v(self.get_name() is True

This is useful in combination with From object.

Parameters:t – The value to check for or a callable object.
Returns:self if the criteria above are met and None otherwise.
Return type:EagelFilePart or None

Frame

class Swoop.Frame[source]

Bases: Swoop.Swoop.EagleFilePart

Class representing the contents of a <frame> tag in Eagle files.

Attributes:

  • x1
  • y1
  • x2
  • y2
  • columns
  • rows
  • layer
  • border_left
  • border_right
  • border_top
  • border_bottom
clone()[source]

Recursively clone this Frame. It will be identical to the original, but it’s parent will be None.

Return type:Frame
dump(indent='', increment=' ')[source]

Recursive debug dump.

Parameters:
  • indent – Indentation string. The output will be indented by this much.
  • increment – This will be appendeded to indent on recursive invocations.
Return type:

None

get_border_bottom()[source]

Return the value of border_bottom for this Frame. This corresponds to the border_bottom attribute of a <frame> in an Eagle file.

Return type:bool
get_border_left()[source]

Return the value of border_left for this Frame. This corresponds to the border_left attribute of a <frame> in an Eagle file.

Return type:bool
get_border_right()[source]

Return the value of border_right for this Frame. This corresponds to the border_right attribute of a <frame> in an Eagle file.

Return type:bool
get_border_top()[source]

Return the value of border_top for this Frame. This corresponds to the border_top attribute of a <frame> in an Eagle file.

Return type:bool
get_children()[source]

Get all the children of this EagleFilePart.

Return type:List of EagleFilePart objects
get_columns()[source]

Return the value of columns for this Frame. This corresponds to the columns attribute of a <frame> in an Eagle file.

Return type:int
get_et()[source]

Generate a <frame> element tree for a Frame.

Return type:ElementTree.
get_layer()[source]

Return the value of layer for this Frame. This corresponds to the layer attribute of a <frame> in an Eagle file.

Return type:layer_string
get_rows()[source]

Return the value of rows for this Frame. This corresponds to the rows attribute of a <frame> in an Eagle file.

Return type:int
get_x1()[source]

Return the value of x1 for this Frame. This corresponds to the x1 attribute of a <frame> in an Eagle file.

Return type:float
get_x2()[source]

Return the value of x2 for this Frame. This corresponds to the x2 attribute of a <frame> in an Eagle file.

Return type:float
get_y1()[source]

Return the value of y1 for this Frame. This corresponds to the y1 attribute of a <frame> in an Eagle file.

Return type:float
get_y2()[source]

Return the value of y2 for this Frame. This corresponds to the y2 attribute of a <frame> in an Eagle file.

Return type:float
remove_child(efp)[source]

Remove a child EagleFilePart object.

Parameters:efp – the class:EagleFilePart object to remove.
Returns:Nothing
set_border_bottom(v)[source]

Set the value of border_bottom for this Frame. This corresponds to the border_bottom attribute of a <frame> in an Eagle file.

Parameters:vEagleFilePart to set.
Return type:self
set_border_left(v)[source]

Set the value of border_left for this Frame. This corresponds to the border_left attribute of a <frame> in an Eagle file.

Parameters:vEagleFilePart to set.
Return type:self
set_border_right(v)[source]

Set the value of border_right for this Frame. This corresponds to the border_right attribute of a <frame> in an Eagle file.

Parameters:vEagleFilePart to set.
Return type:self
set_border_top(v)[source]

Set the value of border_top for this Frame. This corresponds to the border_top attribute of a <frame> in an Eagle file.

Parameters:vEagleFilePart to set.
Return type:self
set_columns(v)[source]

Set the value of columns for this Frame. This corresponds to the columns attribute of a <frame> in an Eagle file.

Parameters:vEagleFilePart to set.
Return type:self
set_layer(v)[source]

Set the value of layer for this Frame. This corresponds to the layer attribute of a <frame> in an Eagle file.

Parameters:vEagleFilePart to set.
Return type:self
set_rows(v)[source]

Set the value of rows for this Frame. This corresponds to the rows attribute of a <frame> in an Eagle file.

Parameters:vEagleFilePart to set.
Return type:self
set_x1(v)[source]

Set the value of x1 for this Frame. This corresponds to the x1 attribute of a <frame> in an Eagle file.

Parameters:vEagleFilePart to set.
Return type:self
set_x2(v)[source]

Set the value of x2 for this Frame. This corresponds to the x2 attribute of a <frame> in an Eagle file.

Parameters:vEagleFilePart to set.
Return type:self
set_y1(v)[source]

Set the value of y1 for this Frame. This corresponds to the y1 attribute of a <frame> in an Eagle file.

Parameters:vEagleFilePart to set.
Return type:self
set_y2(v)[source]

Set the value of y2 for this Frame. This corresponds to the y2 attribute of a <frame> in an Eagle file.

Parameters:vEagleFilePart to set.
Return type:self
with_border_bottom(v)[source]

Filter this EagleFilePart object based on the value of border_bottom. For use in combination with From objects.

Return self if one of the following is true:

  1. border_bottom equals v
  2. v is callable and v(self.get_border_bottom() is True

This is useful in combination with From object.

Parameters:t – The value to check for or a callable object.
Returns:self if the criteria above are met and None otherwise.
Return type:EagelFilePart or None
with_border_left(v)[source]

Filter this EagleFilePart object based on the value of border_left. For use in combination with From objects.

Return self if one of the following is true:

  1. border_left equals v
  2. v is callable and v(self.get_border_left() is True

This is useful in combination with From object.

Parameters:t – The value to check for or a callable object.
Returns:self if the criteria above are met and None otherwise.
Return type:EagelFilePart or None
with_border_right(v)[source]

Filter this EagleFilePart object based on the value of border_right. For use in combination with From objects.

Return self if one of the following is true:

  1. border_right equals v
  2. v is callable and v(self.get_border_right() is True

This is useful in combination with From object.

Parameters:t – The value to check for or a callable object.
Returns:self if the criteria above are met and None otherwise.
Return type:EagelFilePart or None
with_border_top(v)[source]

Filter this EagleFilePart object based on the value of border_top. For use in combination with From objects.

Return self if one of the following is true:

  1. border_top equals v
  2. v is callable and v(self.get_border_top() is True

This is useful in combination with From object.

Parameters:t – The value to check for or a callable object.
Returns:self if the criteria above are met and None otherwise.
Return type:EagelFilePart or None
with_columns(v)[source]

Filter this EagleFilePart object based on the value of columns. For use in combination with From objects.

Return self if one of the following is true:

  1. columns equals v
  2. v is callable and v(self.get_columns() is True

This is useful in combination with From object.

Parameters:t – The value to check for or a callable object.
Returns:self if the criteria above are met and None otherwise.
Return type:EagelFilePart or None
with_layer(v)[source]

Filter this EagleFilePart object based on the value of layer. For use in combination with From objects.

Return self if one of the following is true:

  1. layer equals v
  2. v is callable and v(self.get_layer() is True

This is useful in combination with From object.

Parameters:t – The value to check for or a callable object.
Returns:self if the criteria above are met and None otherwise.
Return type:EagelFilePart or None
with_rows(v)[source]

Filter this EagleFilePart object based on the value of rows. For use in combination with From objects.

Return self if one of the following is true:

  1. rows equals v
  2. v is callable and v(self.get_rows() is True

This is useful in combination with From object.

Parameters:t – The value to check for or a callable object.
Returns:self if the criteria above are met and None otherwise.
Return type:EagelFilePart or None
with_x1(v)[source]

Filter this EagleFilePart object based on the value of x1. For use in combination with From objects.

Return self if one of the following is true:

  1. x1 equals v
  2. v is callable and v(self.get_x1() is True

This is useful in combination with From object.

Parameters:t – The value to check for or a callable object.
Returns:self if the criteria above are met and None otherwise.
Return type:EagelFilePart or None
with_x2(v)[source]

Filter this EagleFilePart object based on the value of x2. For use in combination with From objects.

Return self if one of the following is true:

  1. x2 equals v
  2. v is callable and v(self.get_x2() is True

This is useful in combination with From object.

Parameters:t – The value to check for or a callable object.
Returns:self if the criteria above are met and None otherwise.
Return type:EagelFilePart or None
with_y1(v)[source]

Filter this EagleFilePart object based on the value of y1. For use in combination with From objects.

Return self if one of the following is true:

  1. y1 equals v
  2. v is callable and v(self.get_y1() is True

This is useful in combination with From object.

Parameters:t – The value to check for or a callable object.
Returns:self if the criteria above are met and None otherwise.
Return type:EagelFilePart or None
with_y2(v)[source]

Filter this EagleFilePart object based on the value of y2. For use in combination with From objects.

Return self if one of the following is true:

  1. y2 equals v
  2. v is callable and v(self.get_y2() is True

This is useful in combination with From object.

Parameters:t – The value to check for or a callable object.
Returns:self if the criteria above are met and None otherwise.
Return type:EagelFilePart or None

Junction

class Swoop.Junction[source]

Bases: Swoop.Swoop.EagleFilePart

Class representing the contents of a <junction> tag in Eagle files.

Attributes:

  • x
  • y
clone()[source]

Recursively clone this Junction. It will be identical to the original, but it’s parent will be None.

Return type:Junction
dump(indent='', increment=' ')[source]

Recursive debug dump.

Parameters:
  • indent – Indentation string. The output will be indented by this much.
  • increment – This will be appendeded to indent on recursive invocations.
Return type:

None

get_children()[source]

Get all the children of this EagleFilePart.

Return type:List of EagleFilePart objects
get_et()[source]

Generate a <junction> element tree for a Junction.

Return type:ElementTree.
get_x()[source]

Return the value of x for this Junction. This corresponds to the x attribute of a <junction> in an Eagle file.

Return type:float
get_y()[source]

Return the value of y for this Junction. This corresponds to the y attribute of a <junction> in an Eagle file.

Return type:float
remove_child(efp)[source]

Remove a child EagleFilePart object.

Parameters:efp – the class:EagleFilePart object to remove.
Returns:Nothing
set_x(v)[source]

Set the value of x for this Junction. This corresponds to the x attribute of a <junction> in an Eagle file.

Parameters:vEagleFilePart to set.
Return type:self
set_y(v)[source]

Set the value of y for this Junction. This corresponds to the y attribute of a <junction> in an Eagle file.

Parameters:vEagleFilePart to set.
Return type:self
with_x(v)[source]

Filter this EagleFilePart object based on the value of x. For use in combination with From objects.

Return self if one of the following is true:

  1. x equals v
  2. v is callable and v(self.get_x() is True

This is useful in combination with From object.

Parameters:t – The value to check for or a callable object.
Returns:self if the criteria above are met and None otherwise.
Return type:EagelFilePart or None
with_y(v)[source]

Filter this EagleFilePart object based on the value of y. For use in combination with From objects.

Return self if one of the following is true:

  1. y equals v
  2. v is callable and v(self.get_y() is True

This is useful in combination with From object.

Parameters:t – The value to check for or a callable object.
Returns:self if the criteria above are met and None otherwise.
Return type:EagelFilePart or None

Module

class Swoop.Module[source]

Bases: Swoop.Swoop.EagleFilePart

Class representing the contents of a <module> tag in Eagle files.

Attributes:

  • name
  • prefix
  • dx
  • dy

Collections:

  • description: Singleton Description object.
  • sheet: List of Sheet objects.
  • port: Map of Port objects indexed by their name.
  • variantdef: Map of Variantdef objects indexed by their name.
  • part: Map of Part objects indexed by their name.
add_part(s)[source]

Add a Part to the parts of this Module.

Parameters:s – The Part to add.
Return type:self
add_port(s)[source]

Add a Port to the ports of this Module.

Parameters:s – The Port to add.
Return type:self
add_sheet(s)[source]

Add a Sheet to the sheets of this Module.

Parameters:s – The Sheet to add.
Return type:self
add_variantdef(s)[source]

Add a Variantdef to the variantdefs of this Module.

Parameters:s – The Variantdef to add.
Return type:self
clear_parts()[source]

Remove all the Part objects from the parts of this Module.

Return type:self
clear_ports()[source]

Remove all the Port objects from the ports of this Module.

Return type:self
clear_sheets()[source]

Remove all the Sheet objects from the sheets of this Module.

Return type:self
clear_variantdefs()[source]

Remove all the Variantdef objects from the variantdefs of this Module.

Return type:self
clone()[source]

Recursively clone this Module. It will be identical to the original, but it’s parent will be None.

Return type:Module
dump(indent='', increment=' ')[source]

Recursive debug dump.

Parameters:
  • indent – Indentation string. The output will be indented by this much.
  • increment – This will be appendeded to indent on recursive invocations.
Return type:

None

get_children()[source]

Get all the children of this EagleFilePart.

Return type:List of EagleFilePart objects
get_description()[source]

Get the description from this Module.

Return type:Description object
get_dx()[source]

Return the value of dx for this Module. This corresponds to the dx attribute of a <module> in an Eagle file.

Return type:float
get_dy()[source]

Return the value of dy for this Module. This corresponds to the dy attribute of a <module> in an Eagle file.

Return type:float
get_et()[source]

Generate a <module> element tree for a Module.

Return type:ElementTree.
get_name()[source]

Return the value of name for this Module. This corresponds to the name attribute of a <module> in an Eagle file.

Return type:str
get_nth_part(n)[source]

get then nth Part object from the parts of this Module.

Parameters:n – Index of the item to return.
Return type:Part object
get_nth_port(n)[source]

get then nth Port object from the ports of this Module.

Parameters:n – Index of the item to return.
Return type:Port object
get_nth_sheet(n)[source]

get then nth Sheet object from the sheets of this Module.

Parameters:n – Index of the item to return.
Return type:Sheet object
get_nth_variantdef(n)[source]

get then nth Variantdef object from the variantdefs of this Module.

Parameters:n – Index of the item to return.
Return type:Variantdef object
get_part(key)[source]

Lookup and return a Part from the parts of this Module.

Parameters:key – A str to use for the lookup. The lookup uses the name of the Part objects.
Return type:A Part object or None, if there is no such item.
get_parts(attrs=None, type=None)[source]

Return (and possibly filter) items in the the parts map of Part objects for this Module.

This functions provides a mechanism for filtering the items as well. The keys in attrs are taken as attributes names and the values are requested values. Items in the list that have all the requested values for the corresponding attributes will be returned.

A if type is not None, the item will match if it is an instance of the type provided.

Parameters:
  • attrs – A set of key-value pairs that represent a filter to apply to the item’s attributes.
  • type – A type to filter on. Only items that are an instance of this type will be returned.
Returns:

A List of Part objects

Return type:

List of Part objects

get_port(key)[source]

Lookup and return a Port from the ports of this Module.

Parameters:key – A str to use for the lookup. The lookup uses the name of the Port objects.
Return type:A Port object or None, if there is no such item.
get_ports(attrs=None, type=None)[source]

Return (and possibly filter) items in the the ports map of Port objects for this Module.

This functions provides a mechanism for filtering the items as well. The keys in attrs are taken as attributes names and the values are requested values. Items in the list that have all the requested values for the corresponding attributes will be returned.

A if type is not None, the item will match if it is an instance of the type provided.

Parameters:
  • attrs – A set of key-value pairs that represent a filter to apply to the item’s attributes.
  • type – A type to filter on. Only items that are an instance of this type will be returned.
Returns:

A List of Port objects

Return type:

List of Port objects

get_prefix()[source]

Return the value of prefix for this Module. This corresponds to the prefix attribute of a <module> in an Eagle file.

Return type:str
get_sheets(attrs=None, type=None)[source]

Return (and possibly filter) items in the the sheets list of Sheet objects for this Module.

This functions provides a mechanism for filtering the items as well. The keys in attrs are taken as attributes names and the values are requested values. Items in the list that have all the requested values for the corresponding attributes will be returned.

A if type is not None, the item will match if it is an instance of the type provided.

Parameters:
  • attrs – A set of key-value pairs that represent a filter to apply to the item’s attributes.
  • type – A type to filter on. Only items that are an instance of this type will be returned.
Returns:

A List of Sheet objects

Return type:

List of Sheet objects

get_variantdef(key)[source]

Lookup and return a Variantdef from the variantdefs of this Module.

Parameters:key – A str to use for the lookup. The lookup uses the name of the Variantdef objects.
Return type:A Variantdef object or None, if there is no such item.
get_variantdefs(attrs=None, type=None)[source]

Return (and possibly filter) items in the the variantdefs map of Variantdef objects for this Module.

This functions provides a mechanism for filtering the items as well. The keys in attrs are taken as attributes names and the values are requested values. Items in the list that have all the requested values for the corresponding attributes will be returned.

A if type is not None, the item will match if it is an instance of the type provided.

Parameters:
  • attrs – A set of key-value pairs that represent a filter to apply to the item’s attributes.
  • type – A type to filter on. Only items that are an instance of this type will be returned.
Returns:

A List of Variantdef objects

Return type:

List of Variantdef objects

remove_child(efp)[source]

Remove a child EagleFilePart object.

Parameters:efp – the class:EagleFilePart object to remove.
Returns:Nothing
remove_part(efp)[source]

Remove a Part from the parts of this Module.

Parameters:efp – The Part object to remove.
Return type:self
remove_port(efp)[source]

Remove a Port from the ports of this Module.

Parameters:efp – The Port object to remove.
Return type:self
remove_sheet(efp)[source]

Remove a Sheet from the sheets of this Module.

Parameters:efp – The Sheet object to remove.
Return type:self
remove_variantdef(efp)[source]

Remove a Variantdef from the variantdefs of this Module.

Parameters:efp – The Variantdef object to remove.
Return type:self
set_description(s)[source]

Set the Description for this Module.

Parameters:sDescription to set.
Return type:self
set_dx(v)[source]

Set the value of dx for this Module. This corresponds to the dx attribute of a <module> in an Eagle file.

Parameters:vEagleFilePart to set.
Return type:self
set_dy(v)[source]

Set the value of dy for this Module. This corresponds to the dy attribute of a <module> in an Eagle file.

Parameters:vEagleFilePart to set.
Return type:self
set_name(v)[source]

Set the value of name for this Module. This corresponds to the name attribute of a <module> in an Eagle file.

Parameters:vEagleFilePart to set.
Return type:self
set_prefix(v)[source]

Set the value of prefix for this Module. This corresponds to the prefix attribute of a <module> in an Eagle file.

Parameters:vEagleFilePart to set.
Return type:self
with_dx(v)[source]

Filter this EagleFilePart object based on the value of dx. For use in combination with From objects.

Return self if one of the following is true:

  1. dx equals v
  2. v is callable and v(self.get_dx() is True

This is useful in combination with From object.

Parameters:t – The value to check for or a callable object.
Returns:self if the criteria above are met and None otherwise.
Return type:EagelFilePart or None
with_dy(v)[source]

Filter this EagleFilePart object based on the value of dy. For use in combination with From objects.

Return self if one of the following is true:

  1. dy equals v
  2. v is callable and v(self.get_dy() is True

This is useful in combination with From object.

Parameters:t – The value to check for or a callable object.
Returns:self if the criteria above are met and None otherwise.
Return type:EagelFilePart or None
with_name(v)[source]

Filter this EagleFilePart object based on the value of name. For use in combination with From objects.

Return self if one of the following is true:

  1. name equals v
  2. v is callable and v(self.get_name() is True

This is useful in combination with From object.

Parameters:t – The value to check for or a callable object.
Returns:self if the criteria above are met and None otherwise.
Return type:EagelFilePart or None
with_prefix(v)[source]

Filter this EagleFilePart object based on the value of prefix. For use in combination with From objects.

Return self if one of the following is true:

  1. prefix equals v
  2. v is callable and v(self.get_prefix() is True

This is useful in combination with From object.

Parameters:t – The value to check for or a callable object.
Returns:self if the criteria above are met and None otherwise.
Return type:EagelFilePart or None

Moduleinst

class Swoop.Moduleinst[source]

Bases: Swoop.Swoop.EagleFilePart

Class representing the contents of a <moduleinst> tag in Eagle files.

Attributes:

  • name
  • module
  • modulevariant
  • x
  • y
  • offset
  • smashed
  • rot
clone()[source]

Recursively clone this Moduleinst. It will be identical to the original, but it’s parent will be None.

Return type:Moduleinst
dump(indent='', increment=' ')[source]

Recursive debug dump.

Parameters:
  • indent – Indentation string. The output will be indented by this much.
  • increment – This will be appendeded to indent on recursive invocations.
Return type:

None

find_module()[source]

Find the Module object refered to by the module attribute of this object. This is like get_module(), except it returns the Module object instead of its name.

Returns:The object
Return type:Module
get_children()[source]

Get all the children of this EagleFilePart.

Return type:List of EagleFilePart objects
get_et()[source]

Generate a <moduleinst> element tree for a Moduleinst.

Return type:ElementTree.
get_module()[source]

Return the value of module for this Moduleinst. This corresponds to the module attribute of a <moduleinst> in an Eagle file.

Return type:str
get_modulevariant()[source]

Return the value of modulevariant for this Moduleinst. This corresponds to the modulevariant attribute of a <moduleinst> in an Eagle file.

Return type:str
get_name()[source]

Return the value of name for this Moduleinst. This corresponds to the name attribute of a <moduleinst> in an Eagle file.

Return type:str
get_offset()[source]

Return the value of offset for this Moduleinst. This corresponds to the offset attribute of a <moduleinst> in an Eagle file.

Return type:int
get_rot()[source]

Return the value of rot for this Moduleinst. This corresponds to the rot attribute of a <moduleinst> in an Eagle file.

Return type:str
get_smashed()[source]

Return the value of smashed for this Moduleinst. This corresponds to the smashed attribute of a <moduleinst> in an Eagle file.

Return type:str
get_x()[source]

Return the value of x for this Moduleinst. This corresponds to the x attribute of a <moduleinst> in an Eagle file.

Return type:float
get_y()[source]

Return the value of y for this Moduleinst. This corresponds to the y attribute of a <moduleinst> in an Eagle file.

Return type:float
remove_child(efp)[source]

Remove a child EagleFilePart object.

Parameters:efp – the class:EagleFilePart object to remove.
Returns:Nothing
set_module(v)[source]

Set the value of module for this Moduleinst. This corresponds to the module attribute of a <moduleinst> in an Eagle file.

Parameters:vEagleFilePart to set.
Return type:self
set_modulevariant(v)[source]

Set the value of modulevariant for this Moduleinst. This corresponds to the modulevariant attribute of a <moduleinst> in an Eagle file.

Parameters:vEagleFilePart to set.
Return type:self
set_name(v)[source]

Set the value of name for this Moduleinst. This corresponds to the name attribute of a <moduleinst> in an Eagle file.

Parameters:vEagleFilePart to set.
Return type:self
set_offset(v)[source]

Set the value of offset for this Moduleinst. This corresponds to the offset attribute of a <moduleinst> in an Eagle file.

Parameters:vEagleFilePart to set.
Return type:self
set_rot(v)[source]

Set the value of rot for this Moduleinst. This corresponds to the rot attribute of a <moduleinst> in an Eagle file.

Parameters:vEagleFilePart to set.
Return type:self
set_smashed(v)[source]

Set the value of smashed for this Moduleinst. This corresponds to the smashed attribute of a <moduleinst> in an Eagle file.

Parameters:vEagleFilePart to set.
Return type:self
set_x(v)[source]

Set the value of x for this Moduleinst. This corresponds to the x attribute of a <moduleinst> in an Eagle file.

Parameters:vEagleFilePart to set.
Return type:self
set_y(v)[source]

Set the value of y for this Moduleinst. This corresponds to the y attribute of a <moduleinst> in an Eagle file.

Parameters:vEagleFilePart to set.
Return type:self
with_module(v)[source]

Filter this EagleFilePart object based on the value of module. For use in combination with From objects.

Return self if one of the following is true:

  1. module equals v
  2. v is callable and v(self.get_module() is True

This is useful in combination with From object.

Parameters:t – The value to check for or a callable object.
Returns:self if the criteria above are met and None otherwise.
Return type:EagelFilePart or None
with_modulevariant(v)[source]

Filter this EagleFilePart object based on the value of modulevariant. For use in combination with From objects.

Return self if one of the following is true:

  1. modulevariant equals v
  2. v is callable and v(self.get_modulevariant() is True

This is useful in combination with From object.

Parameters:t – The value to check for or a callable object.
Returns:self if the criteria above are met and None otherwise.
Return type:EagelFilePart or None
with_name(v)[source]

Filter this EagleFilePart object based on the value of name. For use in combination with From objects.

Return self if one of the following is true:

  1. name equals v
  2. v is callable and v(self.get_name() is True

This is useful in combination with From object.

Parameters:t – The value to check for or a callable object.
Returns:self if the criteria above are met and None otherwise.
Return type:EagelFilePart or None
with_offset(v)[source]

Filter this EagleFilePart object based on the value of offset. For use in combination with From objects.

Return self if one of the following is true:

  1. offset equals v
  2. v is callable and v(self.get_offset() is True

This is useful in combination with From object.

Parameters:t – The value to check for or a callable object.
Returns:self if the criteria above are met and None otherwise.
Return type:EagelFilePart or None
with_rot(v)[source]

Filter this EagleFilePart object based on the value of rot. For use in combination with From objects.

Return self if one of the following is true:

  1. rot equals v
  2. v is callable and v(self.get_rot() is True

This is useful in combination with From object.

Parameters:t – The value to check for or a callable object.
Returns:self if the criteria above are met and None otherwise.
Return type:EagelFilePart or None
with_smashed(v)[source]

Filter this EagleFilePart object based on the value of smashed. For use in combination with From objects.

Return self if one of the following is true:

  1. smashed equals v
  2. v is callable and v(self.get_smashed() is True

This is useful in combination with From object.

Parameters:t – The value to check for or a callable object.
Returns:self if the criteria above are met and None otherwise.
Return type:EagelFilePart or None
with_x(v)[source]

Filter this EagleFilePart object based on the value of x. For use in combination with From objects.

Return self if one of the following is true:

  1. x equals v
  2. v is callable and v(self.get_x() is True

This is useful in combination with From object.

Parameters:t – The value to check for or a callable object.
Returns:self if the criteria above are met and None otherwise.
Return type:EagelFilePart or None
with_y(v)[source]

Filter this EagleFilePart object based on the value of y. For use in combination with From objects.

Return self if one of the following is true:

  1. y equals v
  2. v is callable and v(self.get_y() is True

This is useful in combination with From object.

Parameters:t – The value to check for or a callable object.
Returns:self if the criteria above are met and None otherwise.
Return type:EagelFilePart or None

Net

class Swoop.Net[source]

Bases: Swoop.Swoop.EagleFilePart

Class representing the contents of a <net> tag in Eagle files.

Attributes:

  • name
  • class

Collections:

  • segment: List of Segment objects.
add_segment(s)[source]

Add a Segment to the segments of this Net.

Parameters:s – The Segment to add.
Return type:self
clear_segments()[source]

Remove all the Segment objects from the segments of this Net.

Return type:self
clone()[source]

Recursively clone this Net. It will be identical to the original, but it’s parent will be None.

Return type:Net
dump(indent='', increment=' ')[source]

Recursive debug dump.

Parameters:
  • indent – Indentation string. The output will be indented by this much.
  • increment – This will be appendeded to indent on recursive invocations.
Return type:

None

get_children()[source]

Get all the children of this EagleFilePart.

Return type:List of EagleFilePart objects
get_class()[source]

Return the value of netclass for this Net. This corresponds to the netclass attribute of a <net> in an Eagle file.

Return type:str
get_et()[source]

Generate a <net> element tree for a Net.

Return type:ElementTree.
get_name()[source]

Return the value of name for this Net. This corresponds to the name attribute of a <net> in an Eagle file.

Return type:str
get_nth_segment(n)[source]

get then nth Segment object from the segments of this Net.

Parameters:n – Index of the item to return.
Return type:Segment object
get_segments(attrs=None, type=None)[source]

Return (and possibly filter) items in the the segments list of Segment objects for this Net.

This functions provides a mechanism for filtering the items as well. The keys in attrs are taken as attributes names and the values are requested values. Items in the list that have all the requested values for the corresponding attributes will be returned.

A if type is not None, the item will match if it is an instance of the type provided.

Parameters:
  • attrs – A set of key-value pairs that represent a filter to apply to the item’s attributes.
  • type – A type to filter on. Only items that are an instance of this type will be returned.
Returns:

A List of Segment objects

Return type:

List of Segment objects

remove_child(efp)[source]

Remove a child EagleFilePart object.

Parameters:efp – the class:EagleFilePart object to remove.
Returns:Nothing
remove_segment(efp)[source]

Remove a Segment from the segments of this Net.

Parameters:efp – The Segment object to remove.
Return type:self
set_class(v)[source]

Set the value of netclass for this Net. This corresponds to the netclass attribute of a <net> in an Eagle file.

Parameters:vEagleFilePart to set.
Return type:self
set_name(v)[source]

Set the value of name for this Net. This corresponds to the name attribute of a <net> in an Eagle file.

Parameters:vEagleFilePart to set.
Return type:self
with_class(v)[source]

Filter this EagleFilePart object based on the value of netclass. For use in combination with From objects.

Return self if one of the following is true:

  1. netclass equals v
  2. v is callable and v(self.get_class() is True

This is useful in combination with From object.

Parameters:t – The value to check for or a callable object.
Returns:self if the criteria above are met and None otherwise.
Return type:EagelFilePart or None
with_name(v)[source]

Filter this EagleFilePart object based on the value of name. For use in combination with From objects.

Return self if one of the following is true:

  1. name equals v
  2. v is callable and v(self.get_name() is True

This is useful in combination with From object.

Parameters:t – The value to check for or a callable object.
Returns:self if the criteria above are met and None otherwise.
Return type:EagelFilePart or None

Part

class Swoop.Part[source]

Bases: Swoop.Swoop.Base_Part

Extra functions for Parts. Sanity checks, and facilities for find the symbols, devices, etc. for a part.

find_device()[source]

Get the library entry for this part

find_deviceset()[source]

Get the deviceset for this part.

find_library()[source]

Get the library that contains this part

find_package()[source]

Get the library entry for this part

find_technology()[source]

Get the library entry for this part

Pin

class Swoop.Pin[source]

Bases: Swoop.Swoop.EagleFilePart

Class representing the contents of a <pin> tag in Eagle files.

Attributes:

  • name
  • x
  • y
  • visible
  • length
  • direction
  • function
  • swaplevel
  • rot
clone()[source]

Recursively clone this Pin. It will be identical to the original, but it’s parent will be None.

Return type:Pin
dump(indent='', increment=' ')[source]

Recursive debug dump.

Parameters:
  • indent – Indentation string. The output will be indented by this much.
  • increment – This will be appendeded to indent on recursive invocations.
Return type:

None

get_children()[source]

Get all the children of this EagleFilePart.

Return type:List of EagleFilePart objects
get_direction()[source]

Return the value of direction for this Pin. This corresponds to the direction attribute of a <pin> in an Eagle file.

Return type:str
get_et()[source]

Generate a <pin> element tree for a Pin.

Return type:ElementTree.
get_function()[source]

Return the value of function for this Pin. This corresponds to the function attribute of a <pin> in an Eagle file.

Return type:str
get_length()[source]

Return the value of length for this Pin. This corresponds to the length attribute of a <pin> in an Eagle file.

Return type:str
get_name()[source]

Return the value of name for this Pin. This corresponds to the name attribute of a <pin> in an Eagle file.

Return type:str
get_rot()[source]

Return the value of rot for this Pin. This corresponds to the rot attribute of a <pin> in an Eagle file.

Return type:str
get_swaplevel()[source]

Return the value of swaplevel for this Pin. This corresponds to the swaplevel attribute of a <pin> in an Eagle file.

Return type:int
get_visible()[source]

Return the value of visible for this Pin. This corresponds to the visible attribute of a <pin> in an Eagle file.

Return type:str
get_x()[source]

Return the value of x for this Pin. This corresponds to the x attribute of a <pin> in an Eagle file.

Return type:float
get_y()[source]

Return the value of y for this Pin. This corresponds to the y attribute of a <pin> in an Eagle file.

Return type:float
remove_child(efp)[source]

Remove a child EagleFilePart object.

Parameters:efp – the class:EagleFilePart object to remove.
Returns:Nothing
set_direction(v)[source]

Set the value of direction for this Pin. This corresponds to the direction attribute of a <pin> in an Eagle file.

Parameters:vEagleFilePart to set.
Return type:self
set_function(v)[source]

Set the value of function for this Pin. This corresponds to the function attribute of a <pin> in an Eagle file.

Parameters:vEagleFilePart to set.
Return type:self
set_length(v)[source]

Set the value of length for this Pin. This corresponds to the length attribute of a <pin> in an Eagle file.

Parameters:vEagleFilePart to set.
Return type:self
set_name(v)[source]

Set the value of name for this Pin. This corresponds to the name attribute of a <pin> in an Eagle file.

Parameters:vEagleFilePart to set.
Return type:self
set_rot(v)[source]

Set the value of rot for this Pin. This corresponds to the rot attribute of a <pin> in an Eagle file.

Parameters:vEagleFilePart to set.
Return type:self
set_swaplevel(v)[source]

Set the value of swaplevel for this Pin. This corresponds to the swaplevel attribute of a <pin> in an Eagle file.

Parameters:vEagleFilePart to set.
Return type:self
set_visible(v)[source]

Set the value of visible for this Pin. This corresponds to the visible attribute of a <pin> in an Eagle file.

Parameters:vEagleFilePart to set.
Return type:self
set_x(v)[source]

Set the value of x for this Pin. This corresponds to the x attribute of a <pin> in an Eagle file.

Parameters:vEagleFilePart to set.
Return type:self
set_y(v)[source]

Set the value of y for this Pin. This corresponds to the y attribute of a <pin> in an Eagle file.

Parameters:vEagleFilePart to set.
Return type:self
with_direction(v)[source]

Filter this EagleFilePart object based on the value of direction. For use in combination with From objects.

Return self if one of the following is true:

  1. direction equals v
  2. v is callable and v(self.get_direction() is True

This is useful in combination with From object.

Parameters:t – The value to check for or a callable object.
Returns:self if the criteria above are met and None otherwise.
Return type:EagelFilePart or None
with_function(v)[source]

Filter this EagleFilePart object based on the value of function. For use in combination with From objects.

Return self if one of the following is true:

  1. function equals v
  2. v is callable and v(self.get_function() is True

This is useful in combination with From object.

Parameters:t – The value to check for or a callable object.
Returns:self if the criteria above are met and None otherwise.
Return type:EagelFilePart or None
with_length(v)[source]

Filter this EagleFilePart object based on the value of length. For use in combination with From objects.

Return self if one of the following is true:

  1. length equals v
  2. v is callable and v(self.get_length() is True

This is useful in combination with From object.

Parameters:t – The value to check for or a callable object.
Returns:self if the criteria above are met and None otherwise.
Return type:EagelFilePart or None
with_name(v)[source]

Filter this EagleFilePart object based on the value of name. For use in combination with From objects.

Return self if one of the following is true:

  1. name equals v
  2. v is callable and v(self.get_name() is True

This is useful in combination with From object.

Parameters:t – The value to check for or a callable object.
Returns:self if the criteria above are met and None otherwise.
Return type:EagelFilePart or None
with_rot(v)[source]

Filter this EagleFilePart object based on the value of rot. For use in combination with From objects.

Return self if one of the following is true:

  1. rot equals v
  2. v is callable and v(self.get_rot() is True

This is useful in combination with From object.

Parameters:t – The value to check for or a callable object.
Returns:self if the criteria above are met and None otherwise.
Return type:EagelFilePart or None
with_swaplevel(v)[source]

Filter this EagleFilePart object based on the value of swaplevel. For use in combination with From objects.

Return self if one of the following is true:

  1. swaplevel equals v
  2. v is callable and v(self.get_swaplevel() is True

This is useful in combination with From object.

Parameters:t – The value to check for or a callable object.
Returns:self if the criteria above are met and None otherwise.
Return type:EagelFilePart or None
with_visible(v)[source]

Filter this EagleFilePart object based on the value of visible. For use in combination with From objects.

Return self if one of the following is true:

  1. visible equals v
  2. v is callable and v(self.get_visible() is True

This is useful in combination with From object.

Parameters:t – The value to check for or a callable object.
Returns:self if the criteria above are met and None otherwise.
Return type:EagelFilePart or None
with_x(v)[source]

Filter this EagleFilePart object based on the value of x. For use in combination with From objects.

Return self if one of the following is true:

  1. x equals v
  2. v is callable and v(self.get_x() is True

This is useful in combination with From object.

Parameters:t – The value to check for or a callable object.
Returns:self if the criteria above are met and None otherwise.
Return type:EagelFilePart or None
with_y(v)[source]

Filter this EagleFilePart object based on the value of y. For use in combination with From objects.

Return self if one of the following is true:

  1. y equals v
  2. v is callable and v(self.get_y() is True

This is useful in combination with From object.

Parameters:t – The value to check for or a callable object.
Returns:self if the criteria above are met and None otherwise.
Return type:EagelFilePart or None

Pinref

class Swoop.Pinref[source]

Bases: Swoop.Swoop.EagleFilePart

Class representing the contents of a <pinref> tag in Eagle files.

Attributes:

  • part
  • gate
  • pin
clone()[source]

Recursively clone this Pinref. It will be identical to the original, but it’s parent will be None.

Return type:Pinref
dump(indent='', increment=' ')[source]

Recursive debug dump.

Parameters:
  • indent – Indentation string. The output will be indented by this much.
  • increment – This will be appendeded to indent on recursive invocations.
Return type:

None

find_gate()[source]

Find the Gate object refered to by the gate attribute of this object. This is like get_gate(), except it returns the Gate object instead of its name.

Returns:The object
Return type:Gate
find_part()[source]

Find the Part object refered to by the part attribute of this object. This is like get_part(), except it returns the Part object instead of its name.

Returns:The object
Return type:Part
find_pin()[source]

Find the Pin object refered to by the pin attribute of this object. This is like get_pin(), except it returns the Pin object instead of its name.

Returns:The object
Return type:Pin
get_children()[source]

Get all the children of this EagleFilePart.

Return type:List of EagleFilePart objects
get_et()[source]

Generate a <pinref> element tree for a Pinref.

Return type:ElementTree.
get_gate()[source]

Return the value of gate for this Pinref. This corresponds to the gate attribute of a <pinref> in an Eagle file.

Return type:str
get_part()[source]

Return the value of part for this Pinref. This corresponds to the part attribute of a <pinref> in an Eagle file.

Return type:str
get_pin()[source]

Return the value of pin for this Pinref. This corresponds to the pin attribute of a <pinref> in an Eagle file.

Return type:str
remove_child(efp)[source]

Remove a child EagleFilePart object.

Parameters:efp – the class:EagleFilePart object to remove.
Returns:Nothing
set_gate(v)[source]

Set the value of gate for this Pinref. This corresponds to the gate attribute of a <pinref> in an Eagle file.

Parameters:vEagleFilePart to set.
Return type:self
set_part(v)[source]

Set the value of part for this Pinref. This corresponds to the part attribute of a <pinref> in an Eagle file.

Parameters:vEagleFilePart to set.
Return type:self
set_pin(v)[source]

Set the value of pin for this Pinref. This corresponds to the pin attribute of a <pinref> in an Eagle file.

Parameters:vEagleFilePart to set.
Return type:self
with_gate(v)[source]

Filter this EagleFilePart object based on the value of gate. For use in combination with From objects.

Return self if one of the following is true:

  1. gate equals v
  2. v is callable and v(self.get_gate() is True

This is useful in combination with From object.

Parameters:t – The value to check for or a callable object.
Returns:self if the criteria above are met and None otherwise.
Return type:EagelFilePart or None
with_part(v)[source]

Filter this EagleFilePart object based on the value of part. For use in combination with From objects.

Return self if one of the following is true:

  1. part equals v
  2. v is callable and v(self.get_part() is True

This is useful in combination with From object.

Parameters:t – The value to check for or a callable object.
Returns:self if the criteria above are met and None otherwise.
Return type:EagelFilePart or None
with_pin(v)[source]

Filter this EagleFilePart object based on the value of pin. For use in combination with From objects.

Return self if one of the following is true:

  1. pin equals v
  2. v is callable and v(self.get_pin() is True

This is useful in combination with From object.

Parameters:t – The value to check for or a callable object.
Returns:self if the criteria above are met and None otherwise.
Return type:EagelFilePart or None

Port

class Swoop.Port[source]

Bases: Swoop.Swoop.EagleFilePart

Class representing the contents of a <port> tag in Eagle files.

Attributes:

  • name
  • side
  • dimension
  • direction
clone()[source]

Recursively clone this Port. It will be identical to the original, but it’s parent will be None.

Return type:Port
dump(indent='', increment=' ')[source]

Recursive debug dump.

Parameters:
  • indent – Indentation string. The output will be indented by this much.
  • increment – This will be appendeded to indent on recursive invocations.
Return type:

None

get_children()[source]

Get all the children of this EagleFilePart.

Return type:List of EagleFilePart objects
get_dimension()[source]

Return the value of dimension for this Port. This corresponds to the dimension attribute of a <port> in an Eagle file.

Return type:str
get_direction()[source]

Return the value of direction for this Port. This corresponds to the direction attribute of a <port> in an Eagle file.

Return type:str
get_et()[source]

Generate a <port> element tree for a Port.

Return type:ElementTree.
get_name()[source]

Return the value of name for this Port. This corresponds to the name attribute of a <port> in an Eagle file.

Return type:str
get_side()[source]

Return the value of side for this Port. This corresponds to the side attribute of a <port> in an Eagle file.

Return type:int
remove_child(efp)[source]

Remove a child EagleFilePart object.

Parameters:efp – the class:EagleFilePart object to remove.
Returns:Nothing
set_dimension(v)[source]

Set the value of dimension for this Port. This corresponds to the dimension attribute of a <port> in an Eagle file.

Parameters:vEagleFilePart to set.
Return type:self
set_direction(v)[source]

Set the value of direction for this Port. This corresponds to the direction attribute of a <port> in an Eagle file.

Parameters:vEagleFilePart to set.
Return type:self
set_name(v)[source]

Set the value of name for this Port. This corresponds to the name attribute of a <port> in an Eagle file.

Parameters:vEagleFilePart to set.
Return type:self
set_side(v)[source]

Set the value of side for this Port. This corresponds to the side attribute of a <port> in an Eagle file.

Parameters:vEagleFilePart to set.
Return type:self
with_dimension(v)[source]

Filter this EagleFilePart object based on the value of dimension. For use in combination with From objects.

Return self if one of the following is true:

  1. dimension equals v
  2. v is callable and v(self.get_dimension() is True

This is useful in combination with From object.

Parameters:t – The value to check for or a callable object.
Returns:self if the criteria above are met and None otherwise.
Return type:EagelFilePart or None
with_direction(v)[source]

Filter this EagleFilePart object based on the value of direction. For use in combination with From objects.

Return self if one of the following is true:

  1. direction equals v
  2. v is callable and v(self.get_direction() is True

This is useful in combination with From object.

Parameters:t – The value to check for or a callable object.
Returns:self if the criteria above are met and None otherwise.
Return type:EagelFilePart or None
with_name(v)[source]

Filter this EagleFilePart object based on the value of name. For use in combination with From objects.

Return self if one of the following is true:

  1. name equals v
  2. v is callable and v(self.get_name() is True

This is useful in combination with From object.

Parameters:t – The value to check for or a callable object.
Returns:self if the criteria above are met and None otherwise.
Return type:EagelFilePart or None
with_side(v)[source]

Filter this EagleFilePart object based on the value of side. For use in combination with From objects.

Return self if one of the following is true:

  1. side equals v
  2. v is callable and v(self.get_side() is True

This is useful in combination with From object.

Parameters:t – The value to check for or a callable object.
Returns:self if the criteria above are met and None otherwise.
Return type:EagelFilePart or None

Portref

class Swoop.Portref[source]

Bases: Swoop.Swoop.EagleFilePart

Class representing the contents of a <portref> tag in Eagle files.

Attributes:

  • moduleinst
  • port
clone()[source]

Recursively clone this Portref. It will be identical to the original, but it’s parent will be None.

Return type:Portref
dump(indent='', increment=' ')[source]

Recursive debug dump.

Parameters:
  • indent – Indentation string. The output will be indented by this much.
  • increment – This will be appendeded to indent on recursive invocations.
Return type:

None

find_moduleinst()[source]

Find the Moduleinst object refered to by the moduleinst attribute of this object. This is like get_moduleinst(), except it returns the Moduleinst object instead of its name.

Returns:The object
Return type:Moduleinst
find_port()[source]

Find the Port object refered to by the port attribute of this object. This is like get_port(), except it returns the Port object instead of its name.

Returns:The object
Return type:Port
get_children()[source]

Get all the children of this EagleFilePart.

Return type:List of EagleFilePart objects
get_et()[source]

Generate a <portref> element tree for a Portref.

Return type:ElementTree.
get_moduleinst()[source]

Return the value of moduleinst for this Portref. This corresponds to the moduleinst attribute of a <portref> in an Eagle file.

Return type:str
get_port()[source]

Return the value of port for this Portref. This corresponds to the port attribute of a <portref> in an Eagle file.

Return type:str
remove_child(efp)[source]

Remove a child EagleFilePart object.

Parameters:efp – the class:EagleFilePart object to remove.
Returns:Nothing
set_moduleinst(v)[source]

Set the value of moduleinst for this Portref. This corresponds to the moduleinst attribute of a <portref> in an Eagle file.

Parameters:vEagleFilePart to set.
Return type:self
set_port(v)[source]

Set the value of port for this Portref. This corresponds to the port attribute of a <portref> in an Eagle file.

Parameters:vEagleFilePart to set.
Return type:self
with_moduleinst(v)[source]

Filter this EagleFilePart object based on the value of moduleinst. For use in combination with From objects.

Return self if one of the following is true:

  1. moduleinst equals v
  2. v is callable and v(self.get_moduleinst() is True

This is useful in combination with From object.

Parameters:t – The value to check for or a callable object.
Returns:self if the criteria above are met and None otherwise.
Return type:EagelFilePart or None
with_port(v)[source]

Filter this EagleFilePart object based on the value of port. For use in combination with From objects.

Return self if one of the following is true:

  1. port equals v
  2. v is callable and v(self.get_port() is True

This is useful in combination with From object.

Parameters:t – The value to check for or a callable object.
Returns:self if the criteria above are met and None otherwise.
Return type:EagelFilePart or None

Schematic

class Swoop.Schematic[source]

Bases: Swoop.Swoop.EagleFilePart

Class representing the contents of a <schematic> tag in Eagle files.

Attributes:

  • xreflabel
  • xrefpart
clone()[source]

Recursively clone this Schematic. It will be identical to the original, but it’s parent will be None.

Return type:Schematic
dump(indent='', increment=' ')[source]

Recursive debug dump.

Parameters:
  • indent – Indentation string. The output will be indented by this much.
  • increment – This will be appendeded to indent on recursive invocations.
Return type:

None

get_children()[source]

Get all the children of this EagleFilePart.

Return type:List of EagleFilePart objects
get_et()[source]

Generate a <schematic> element tree for a Schematic.

Return type:ElementTree.
get_xreflabel()[source]

Return the value of xreflabel for this Schematic. This corresponds to the xreflabel attribute of a <schematic> in an Eagle file.

Return type:str
get_xrefpart()[source]

Return the value of xrefpart for this Schematic. This corresponds to the xrefpart attribute of a <schematic> in an Eagle file.

Return type:str
remove_child(efp)[source]

Remove a child EagleFilePart object.

Parameters:efp – the class:EagleFilePart object to remove.
Returns:Nothing
set_xreflabel(v)[source]

Set the value of xreflabel for this Schematic. This corresponds to the xreflabel attribute of a <schematic> in an Eagle file.

Parameters:vEagleFilePart to set.
Return type:self
set_xrefpart(v)[source]

Set the value of xrefpart for this Schematic. This corresponds to the xrefpart attribute of a <schematic> in an Eagle file.

Parameters:vEagleFilePart to set.
Return type:self
with_xreflabel(v)[source]

Filter this EagleFilePart object based on the value of xreflabel. For use in combination with From objects.

Return self if one of the following is true:

  1. xreflabel equals v
  2. v is callable and v(self.get_xreflabel() is True

This is useful in combination with From object.

Parameters:t – The value to check for or a callable object.
Returns:self if the criteria above are met and None otherwise.
Return type:EagelFilePart or None
with_xrefpart(v)[source]

Filter this EagleFilePart object based on the value of xrefpart. For use in combination with From objects.

Return self if one of the following is true:

  1. xrefpart equals v
  2. v is callable and v(self.get_xrefpart() is True

This is useful in combination with From object.

Parameters:t – The value to check for or a callable object.
Returns:self if the criteria above are met and None otherwise.
Return type:EagelFilePart or None

Segment

class Swoop.Segment[source]

Bases: Swoop.Swoop.EagleFilePart

Class representing the contents of a <segment> tag in Eagle files.

Attributes:

Collections:

  • pinref: List of Pinref objects.
  • portref: List of Portref objects.
  • wire: List of Wire objects.
  • junction: List of Junction objects.
  • label: List of Label objects.
add_junction(s)[source]

Add a Junction to the junctions of this Segment.

Parameters:s – The Junction to add.
Return type:self
add_label(s)[source]

Add a Label to the labels of this Segment.

Parameters:s – The Label to add.
Return type:self
add_pinref(s)[source]

Add a Pinref to the pinrefs of this Segment.

Parameters:s – The Pinref to add.
Return type:self
add_portref(s)[source]

Add a Portref to the portrefs of this Segment.

Parameters:s – The Portref to add.
Return type:self
add_wire(s)[source]

Add a Wire to the wires of this Segment.

Parameters:s – The Wire to add.
Return type:self
clear_junctions()[source]

Remove all the Junction objects from the junctions of this Segment.

Return type:self
clear_labels()[source]

Remove all the Label objects from the labels of this Segment.

Return type:self
clear_pinrefs()[source]

Remove all the Pinref objects from the pinrefs of this Segment.

Return type:self
clear_portrefs()[source]

Remove all the Portref objects from the portrefs of this Segment.

Return type:self
clear_wires()[source]

Remove all the Wire objects from the wires of this Segment.

Return type:self
clone()[source]

Recursively clone this Segment. It will be identical to the original, but it’s parent will be None.

Return type:Segment
dump(indent='', increment=' ')[source]

Recursive debug dump.

Parameters:
  • indent – Indentation string. The output will be indented by this much.
  • increment – This will be appendeded to indent on recursive invocations.
Return type:

None

get_children()[source]

Get all the children of this EagleFilePart.

Return type:List of EagleFilePart objects
get_et()[source]

Generate a <segment> element tree for a Segment.

Return type:ElementTree.
get_junctions(attrs=None, type=None)[source]

Return (and possibly filter) items in the the junctions list of Junction objects for this Segment.

This functions provides a mechanism for filtering the items as well. The keys in attrs are taken as attributes names and the values are requested values. Items in the list that have all the requested values for the corresponding attributes will be returned.

A if type is not None, the item will match if it is an instance of the type provided.

Parameters:
  • attrs – A set of key-value pairs that represent a filter to apply to the item’s attributes.
  • type – A type to filter on. Only items that are an instance of this type will be returned.
Returns:

A List of Junction objects

Return type:

List of Junction objects

get_labels(attrs=None, type=None)[source]

Return (and possibly filter) items in the the labels list of Label objects for this Segment.

This functions provides a mechanism for filtering the items as well. The keys in attrs are taken as attributes names and the values are requested values. Items in the list that have all the requested values for the corresponding attributes will be returned.

A if type is not None, the item will match if it is an instance of the type provided.

Parameters:
  • attrs – A set of key-value pairs that represent a filter to apply to the item’s attributes.
  • type – A type to filter on. Only items that are an instance of this type will be returned.
Returns:

A List of Label objects

Return type:

List of Label objects

get_nth_junction(n)[source]

get then nth Junction object from the junctions of this Segment.

Parameters:n – Index of the item to return.
Return type:Junction object
get_nth_label(n)[source]

get then nth Label object from the labels of this Segment.

Parameters:n – Index of the item to return.
Return type:Label object
get_nth_pinref(n)[source]

get then nth Pinref object from the pinrefs of this Segment.

Parameters:n – Index of the item to return.
Return type:Pinref object
get_nth_portref(n)[source]

get then nth Portref object from the portrefs of this Segment.

Parameters:n – Index of the item to return.
Return type:Portref object
get_nth_wire(n)[source]

get then nth Wire object from the wires of this Segment.

Parameters:n – Index of the item to return.
Return type:Wire object
get_pinrefs(attrs=None, type=None)[source]

Return (and possibly filter) items in the the pinrefs list of Pinref objects for this Segment.

This functions provides a mechanism for filtering the items as well. The keys in attrs are taken as attributes names and the values are requested values. Items in the list that have all the requested values for the corresponding attributes will be returned.

A if type is not None, the item will match if it is an instance of the type provided.

Parameters:
  • attrs – A set of key-value pairs that represent a filter to apply to the item’s attributes.
  • type – A type to filter on. Only items that are an instance of this type will be returned.
Returns:

A List of Pinref objects

Return type:

List of Pinref objects

get_portrefs(attrs=None, type=None)[source]

Return (and possibly filter) items in the the portrefs list of Portref objects for this Segment.

This functions provides a mechanism for filtering the items as well. The keys in attrs are taken as attributes names and the values are requested values. Items in the list that have all the requested values for the corresponding attributes will be returned.

A if type is not None, the item will match if it is an instance of the type provided.

Parameters:
  • attrs – A set of key-value pairs that represent a filter to apply to the item’s attributes.
  • type – A type to filter on. Only items that are an instance of this type will be returned.
Returns:

A List of Portref objects

Return type:

List of Portref objects

get_wires(attrs=None, type=None)[source]

Return (and possibly filter) items in the the wires list of Wire objects for this Segment.

This functions provides a mechanism for filtering the items as well. The keys in attrs are taken as attributes names and the values are requested values. Items in the list that have all the requested values for the corresponding attributes will be returned.

A if type is not None, the item will match if it is an instance of the type provided.

Parameters:
  • attrs – A set of key-value pairs that represent a filter to apply to the item’s attributes.
  • type – A type to filter on. Only items that are an instance of this type will be returned.
Returns:

A List of Wire objects

Return type:

List of Wire objects

remove_child(efp)[source]

Remove a child EagleFilePart object.

Parameters:efp – the class:EagleFilePart object to remove.
Returns:Nothing
remove_junction(efp)[source]

Remove a Junction from the junctions of this Segment.

Parameters:efp – The Junction object to remove.
Return type:self
remove_label(efp)[source]

Remove a Label from the labels of this Segment.

Parameters:efp – The Label object to remove.
Return type:self
remove_pinref(efp)[source]

Remove a Pinref from the pinrefs of this Segment.

Parameters:efp – The Pinref object to remove.
Return type:self
remove_portref(efp)[source]

Remove a Portref from the portrefs of this Segment.

Parameters:efp – The Portref object to remove.
Return type:self
remove_wire(efp)[source]

Remove a Wire from the wires of this Segment.

Parameters:efp – The Wire object to remove.
Return type:self