Classes for Board Files (.brd)

These classes are used only within Eagle board files (.brd).

BoardFile

class Swoop.BoardFile[source]

Bases: Swoop.Swoop.EagleFile

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

Attributes:

  • version

Collections:

  • grid: Singleton Grid object.
  • description: Singleton Description object.
  • designrules: Singleton Designrules object.
  • compatibility: Singleton Compatibility object.
  • setting: List of Setting objects.
  • plain_element: List of Polygon, Wire, Text, Dimension, Circle, Rectangle, Frame and Hole objects.
  • approved: List of Approved objects.
  • layer: Map of Layer objects indexed by their number.
  • 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.
  • pass: Map of Pass objects indexed by their name.
  • element: Map of Element objects indexed by their name.
  • signal: Map of Signal objects indexed by their name.
add_approved(s)[source]

Add a Approved to the approved_errors of this BoardFile.

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

Add a Attribute to the attributes of this BoardFile.

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

Add a Class to the classes of this BoardFile.

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

Add a Element to the elements of this BoardFile.

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

Add a Library to the libraries of this BoardFile.

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

Add a Pass to the autorouter_passes of this BoardFile.

Parameters:s – The Pass 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 BoardFile.

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

Add a Setting to the settings of this BoardFile.

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

Add a Signal to the signals of this BoardFile.

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

Add a Variantdef to the variantdefs of this BoardFile.

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

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

Return type:self
clear_attributes()[source]

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

Return type:self
clear_autorouter_passes()[source]

Remove all the Pass objects from the autorouter_passes of this BoardFile.

Return type:self
clear_classes()[source]

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

Return type:self
clear_elements()[source]

Remove all the Element objects from the elements of this BoardFile.

Return type:self
clear_libraries()[source]

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

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 BoardFile.

Return type:self
clear_settings()[source]

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

Return type:self
clear_signals()[source]

Remove all the Signal objects from the signals of this BoardFile.

Return type:self
clear_variantdefs()[source]

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

Return type:self
clone()[source]

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

Return type:BoardFile
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 BoardFile.

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 BoardFile.

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 BoardFile.

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_autorouter_passes(attrs=None, type=None)[source]

Return (and possibly filter) items in the the autorouter_passes map of Pass objects for this BoardFile.

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 Pass objects

Return type:

List of Pass 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 BoardFile.

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 BoardFile.

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 BoardFile.

Return type:Compatibility object
get_description()[source]

Get the description from this BoardFile.

Return type:Description object
get_designrules()[source]

Get the designrules from this BoardFile.

Return type:Designrules object
get_element(key)[source]

Lookup and return a Element from the elements of this BoardFile.

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

Return (and possibly filter) items in the the elements map of Element objects for this BoardFile.

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 Element objects

Return type:

List of Element objects

get_et()[source]

Generate a <eagle> element tree for a BoardFile.

Return type:ElementTree.
get_grid()[source]

Get the grid from this BoardFile.

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 BoardFile.

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 BoardFile.

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_nth_approved(n)[source]

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

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 BoardFile.

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 BoardFile.

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

get then nth Element object from the elements of this BoardFile.

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

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

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

get then nth Pass object from the autorouter_passes of this BoardFile.

Parameters:n – Index of the item to return.
Return type:Pass 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 BoardFile.

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

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

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

get then nth Signal object from the signals of this BoardFile.

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

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

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

Lookup and return a Pass from the autorouter_passes of this BoardFile.

Parameters:key – A str to use for the lookup. The lookup uses the name of the Pass objects.
Return type:A Pass object or None, if there is no such item.
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 BoardFile.

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

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

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

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_signal(key)[source]

Lookup and return a Signal from the signals of this BoardFile.

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

Return (and possibly filter) items in the the signals map of Signal objects for this BoardFile.

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 Signal objects

Return type:

List of Signal objects

get_variantdef(key)[source]

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

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 BoardFile.

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 BoardFile. 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 BoardFile.

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

Remove a Attribute from the attributes of this BoardFile.

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 BoardFile.

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

Remove a Element from the elements of this BoardFile.

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

Remove a Library from the libraries of this BoardFile.

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

Remove a Pass from the autorouter_passes of this BoardFile.

Parameters:efp – The Pass 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 BoardFile.

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

Remove a Setting from the settings of this BoardFile.

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

Remove a Signal from the signals of this BoardFile.

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

Remove a Variantdef from the variantdefs of this BoardFile.

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

Set the Compatibility for this BoardFile.

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

Set the Description for this BoardFile.

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

Set the Designrules for this BoardFile.

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

Set the Grid for this BoardFile.

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

Set the value of version for this BoardFile. 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

Element

class Swoop.Element[source]

Bases: Swoop.Swoop.EagleFilePart

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

Attributes:

  • name
  • library
  • package
  • value
  • x
  • y
  • locked
  • populate
  • smashed
  • rot

Collections:

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

Add a Attribute to the attributes of this Element.

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

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

Return type:self
clone()[source]

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

Return type:Element
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_library()[source]

Find the Library object refered to by the library attribute of this object. This is like get_library(), except it returns the Library object instead of its name.

Returns:The object
Return type:Library
find_package()[source]

Find the Package object refered to by the package attribute of this object. This is like get_package(), except it returns the Package object instead of its name.

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

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

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 Element.

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 <element> element tree for a Element.

Return type:ElementTree.
get_library()[source]

Return the value of library for this Element. This corresponds to the library attribute of a <element> in an Eagle file.

Return type:str
get_locked()[source]

Return the value of locked for this Element. This corresponds to the locked attribute of a <element> in an Eagle file.

Return type:bool
get_name()[source]

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

Return type:str
get_nth_attribute(n)[source]

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

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

Return the value of package for this Element. This corresponds to the package attribute of a <element> in an Eagle file.

Return type:str
get_populate()[source]

Return the value of populate for this Element. This corresponds to the populate attribute of a <element> in an Eagle file.

Return type:bool
get_rot()[source]

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

Return type:str
get_smashed()[source]

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

Return type:str
get_value()[source]

Return the value of value for this Element. This corresponds to the value attribute of a <element> in an Eagle file.

Return type:str
get_x()[source]

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

Return type:float
get_y()[source]

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

Return type:float
remove_attribute(efp)[source]

Remove a Attribute from the attributes of this Element.

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_library(v)[source]

Set the value of library for this Element. This corresponds to the library attribute of a <element> in an Eagle file.

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

Set the value of locked for this Element. This corresponds to the locked attribute of a <element> in an Eagle file.

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

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

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

Set the value of package for this Element. This corresponds to the package attribute of a <element> in an Eagle file.

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

Set the value of populate for this Element. This corresponds to the populate attribute of a <element> in an Eagle file.

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

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

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

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

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

Set the value of value for this Element. This corresponds to the value attribute of a <element> in an Eagle file.

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

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

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

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

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

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

Return self if one of the following is true:

  1. library equals v
  2. v is callable and v(self.get_library() 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_locked(v)[source]

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

Return self if one of the following is true:

  1. locked equals v
  2. v is callable and v(self.get_locked() 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_package(v)[source]

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

Return self if one of the following is true:

  1. package equals v
  2. v is callable and v(self.get_package() 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_populate(v)[source]

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

Return self if one of the following is true:

  1. populate equals v
  2. v is callable and v(self.get_populate() 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_value(v)[source]

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

Return self if one of the following is true:

  1. value equals v
  2. v is callable and v(self.get_value() 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

Contactref

class Swoop.Contactref[source]

Bases: Swoop.Swoop.EagleFilePart

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

Attributes:

  • element
  • pad
  • route
  • routetag
clone()[source]

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

Return type:Contactref
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_element()[source]

Find the Element object refered to by the element attribute of this object. This is like get_element(), except it returns the Element object instead of its name.

Returns:The object
Return type:Element
find_pad()[source]

Find the Pad object refered to by the pad attribute of this object. This is like get_pad(), except it returns the Pad object instead of its name.

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

Get all the children of this EagleFilePart.

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

Return the value of element for this Contactref. This corresponds to the element attribute of a <contactref> in an Eagle file.

Return type:str
get_et()[source]

Generate a <contactref> element tree for a Contactref.

Return type:ElementTree.
get_pad()[source]

Return the value of pad for this Contactref. This corresponds to the pad attribute of a <contactref> in an Eagle file.

Return type:str
get_route()[source]

Return the value of route for this Contactref. This corresponds to the route attribute of a <contactref> in an Eagle file.

Return type:str
get_routetag()[source]

Return the value of routetag for this Contactref. This corresponds to the routetag attribute of a <contactref> 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_element(v)[source]

Set the value of element for this Contactref. This corresponds to the element attribute of a <contactref> in an Eagle file.

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

Set the value of pad for this Contactref. This corresponds to the pad attribute of a <contactref> in an Eagle file.

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

Set the value of route for this Contactref. This corresponds to the route attribute of a <contactref> in an Eagle file.

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

Set the value of routetag for this Contactref. This corresponds to the routetag attribute of a <contactref> in an Eagle file.

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

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

Return self if one of the following is true:

  1. element equals v
  2. v is callable and v(self.get_element() 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_pad(v)[source]

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

Return self if one of the following is true:

  1. pad equals v
  2. v is callable and v(self.get_pad() 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_route(v)[source]

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

Return self if one of the following is true:

  1. route equals v
  2. v is callable and v(self.get_route() 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_routetag(v)[source]

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

Return self if one of the following is true:

  1. routetag equals v
  2. v is callable and v(self.get_routetag() 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

Pass

class Swoop.Pass[source]

Bases: Swoop.Swoop.EagleFilePart

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

Attributes:

  • name
  • refer
  • active

Collections:

  • param: Map of Param objects indexed by their name.
add_param(s)[source]

Add a Param to the params of this Pass.

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

Remove all the Param objects from the params of this Pass.

Return type:self
clone()[source]

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

Return type:Pass
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_active()[source]

Return the value of active for this Pass. This corresponds to the active attribute of a <pass> in an Eagle file.

Return type:str
get_children()[source]

Get all the children of this EagleFilePart.

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

Generate a <pass> element tree for a Pass.

Return type:ElementTree.
get_name()[source]

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

Return type:str
get_nth_param(n)[source]

get then nth Param object from the params of this Pass.

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

Lookup and return a Param from the params of this Pass.

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

Return (and possibly filter) items in the the params map of Param objects for this Pass.

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 Param objects

Return type:

List of Param objects

get_refer()[source]

Return the value of refer for this Pass. This corresponds to the refer attribute of a <pass> 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
remove_param(efp)[source]

Remove a Param from the params of this Pass.

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

Set the value of active for this Pass. This corresponds to the active attribute of a <pass> in an Eagle file.

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

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

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

Set the value of refer for this Pass. This corresponds to the refer attribute of a <pass> in an Eagle file.

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

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

Return self if one of the following is true:

  1. active equals v
  2. v is callable and v(self.get_active() 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_refer(v)[source]

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

Return self if one of the following is true:

  1. refer equals v
  2. v is callable and v(self.get_refer() 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

Signal

class Swoop.Signal[source]

Bases: Swoop.Swoop.EagleFilePart

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

Attributes:

  • name
  • class
  • airwireshidden

Collections:

  • contactref: List of Contactref objects.
  • polygon: List of Polygon objects.
  • wire: List of Wire objects.
  • via: List of Via objects.
add_contactref(s)[source]

Add a Contactref to the contactrefs of this Signal.

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

Add a Polygon to the polygons of this Signal.

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

Add a Via to the vias of this Signal.

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

Add a Wire to the wires of this Signal.

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

Remove all the Contactref objects from the contactrefs of this Signal.

Return type:self
clear_polygons()[source]

Remove all the Polygon objects from the polygons of this Signal.

Return type:self
clear_vias()[source]

Remove all the Via objects from the vias of this Signal.

Return type:self
clear_wires()[source]

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

Return type:self
clone()[source]

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

Return type:Signal
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_class()[source]

Find the Class object refered to by the netclass attribute of this object. This is like get_netclass(), except it returns the Class object instead of its name.

Returns:The object
Return type:Class
get_airwireshidden()[source]

Return the value of airwireshidden for this Signal. This corresponds to the airwireshidden attribute of a <signal> in an Eagle file.

Return type:bool
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 Signal. This corresponds to the netclass attribute of a <signal> in an Eagle file.

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

Return (and possibly filter) items in the the contactrefs list of Contactref objects for this Signal.

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 Contactref objects

Return type:

List of Contactref objects

get_et()[source]

Generate a <signal> element tree for a Signal.

Return type:ElementTree.
get_name()[source]

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

Return type:str
get_nth_contactref(n)[source]

get then nth Contactref object from the contactrefs of this Signal.

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

get then nth Polygon object from the polygons of this Signal.

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

get then nth Via object from the vias of this Signal.

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

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

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

Return (and possibly filter) items in the the polygons list of Polygon objects for this Signal.

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 objects

Return type:

List of Polygon objects

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

Return (and possibly filter) items in the the vias list of Via objects for this Signal.

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 Via objects

Return type:

List of Via objects

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

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

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_contactref(efp)[source]

Remove a Contactref from the contactrefs of this Signal.

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

Remove a Polygon from the polygons of this Signal.

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

Remove a Via from the vias of this Signal.

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

Remove a Wire from the wires of this Signal.

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

Set the value of airwireshidden for this Signal. This corresponds to the airwireshidden attribute of a <signal> in an Eagle file.

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

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

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

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

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

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

Return self if one of the following is true:

  1. airwireshidden equals v
  2. v is callable and v(self.get_airwireshidden() 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_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

Via

class Swoop.Via[source]

Bases: Swoop.Swoop.EagleFilePart

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

Attributes:

  • x
  • y
  • extent
  • drill
  • diameter
  • shape
  • alwaysstop
clone()[source]

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

Return type:Via
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_alwaysstop()[source]

Return the value of alwaysstop for this Via. This corresponds to the alwaysstop attribute of a <via> in an Eagle file.

Return type:bool
get_children()[source]

Get all the children of this EagleFilePart.

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

Return the value of diameter for this Via. This corresponds to the diameter attribute of a <via> in an Eagle file.

Return type:float
get_drill()[source]

Return the value of drill for this Via. This corresponds to the drill attribute of a <via> in an Eagle file.

Return type:float
get_et()[source]

Generate a <via> element tree for a Via.

Return type:ElementTree.
get_extent()[source]

Return the value of extent for this Via. This corresponds to the extent attribute of a <via> in an Eagle file.

Return type:str
get_shape()[source]

Return the value of shape for this Via. This corresponds to the shape attribute of a <via> in an Eagle file.

Return type:str
get_x()[source]

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

Return type:float
get_y()[source]

Return the value of y for this Via. This corresponds to the y attribute of a <via> 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_alwaysstop(v)[source]

Set the value of alwaysstop for this Via. This corresponds to the alwaysstop attribute of a <via> in an Eagle file.

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

Set the value of diameter for this Via. This corresponds to the diameter attribute of a <via> in an Eagle file.

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

Set the value of drill for this Via. This corresponds to the drill attribute of a <via> in an Eagle file.

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

Set the value of extent for this Via. This corresponds to the extent attribute of a <via> in an Eagle file.

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

Set the value of shape for this Via. This corresponds to the shape attribute of a <via> in an Eagle file.

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

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

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

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

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

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

Return self if one of the following is true:

  1. alwaysstop equals v
  2. v is callable and v(self.get_alwaysstop() 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_diameter(v)[source]

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

Return self if one of the following is true:

  1. diameter equals v
  2. v is callable and v(self.get_diameter() 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_drill(v)[source]

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

Return self if one of the following is true:

  1. drill equals v
  2. v is callable and v(self.get_drill() 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_extent(v)[source]

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

Return self if one of the following is true:

  1. extent equals v
  2. v is callable and v(self.get_extent() 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_shape(v)[source]

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

Return self if one of the following is true:

  1. shape equals v
  2. v is callable and v(self.get_shape() 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