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
: SingletonGrid
object.schematic
: SingletonSchematic
object.description
: SingletonDescription
object.compatibility
: SingletonCompatibility
object.setting
: List ofSetting
objects.sheet
: List ofSheet
objects.approved
: List ofApproved
objects.layer
: Map ofLayer
objects indexed by theirname
.library
: Map ofLibrary
objects indexed by theirname
.attribute
: Map ofAttribute
objects indexed by theirname
.variantdef
: Map ofVariantdef
objects indexed by theirname
.class
: Map ofClass
objects indexed by theirname
.module
: Map ofModule
objects indexed by theirname
.part
: Map ofPart
objects indexed by theirname
.
-
add_approved
(s)[source]¶ Add a
Approved
to theapproved_errors
of thisSchematicFile
.Parameters: s – The Approved
to add.Return type: self
-
add_attribute
(s)[source]¶ Add a
Attribute
to theattributes
of thisSchematicFile
.Parameters: s – The Attribute
to add.Return type: self
-
add_class
(s)[source]¶ Add a
Class
to theclasses
of thisSchematicFile
.Parameters: s – The Class
to add.Return type: self
-
add_library
(s)[source]¶ Add a
Library
to thelibraries
of thisSchematicFile
.Parameters: s – The Library
to add.Return type: self
-
add_module
(s)[source]¶ Add a
Module
to themodules
of thisSchematicFile
.Parameters: s – The Module
to add.Return type: self
-
add_part
(s)[source]¶ Add a
Part
to theparts
of thisSchematicFile
.Parameters: s – The Part
to add.Return type: self
-
add_setting
(s)[source]¶ Add a
Setting
to thesettings
of thisSchematicFile
.Parameters: s – The Setting
to add.Return type: self
-
add_sheet
(s)[source]¶ Add a
Sheet
to thesheets
of thisSchematicFile
.Parameters: s – The Sheet
to add.Return type: self
-
add_variantdef
(s)[source]¶ Add a
Variantdef
to thevariantdefs
of thisSchematicFile
.Parameters: s – The Variantdef
to add.Return type: self
-
clear_approved_errors
()[source]¶ Remove all the
Approved
objects from theapproved_errors
of thisSchematicFile
.Return type: self
-
clear_attributes
()[source]¶ Remove all the
Attribute
objects from theattributes
of thisSchematicFile
.Return type: self
-
clear_classes
()[source]¶ Remove all the
Class
objects from theclasses
of thisSchematicFile
.Return type: self
-
clear_libraries
()[source]¶ Remove all the
Library
objects from thelibraries
of thisSchematicFile
.Return type: self
-
clear_modules
()[source]¶ Remove all the
Module
objects from themodules
of thisSchematicFile
.Return type: self
-
clear_parts
()[source]¶ Remove all the
Part
objects from theparts
of thisSchematicFile
.Return type: self
-
clear_settings
()[source]¶ Remove all the
Setting
objects from thesettings
of thisSchematicFile
.Return type: self
-
clear_sheets
()[source]¶ Remove all the
Sheet
objects from thesheets
of thisSchematicFile
.Return type: self
-
clear_variantdefs
()[source]¶ Remove all the
Variantdef
objects from thevariantdefs
of thisSchematicFile
.Return type: self
-
clone
()[source]¶ Recursively clone this
SchematicFile
. It will be identical to the original, but it’s parent will beNone
.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 ofApproved
objects for thisSchematicFile
.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 notNone
, 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
objectsReturn type: List of
Approved
objects
-
get_attribute
(key)[source]¶ Lookup and return a
Attribute
from theattributes
of thisSchematicFile
.Parameters: key – A str
to use for the lookup. The lookup uses thename
of theAttribute
objects.Return type: A Attribute
object orNone
, if there is no such item.
-
get_attributes
(attrs=None, type=None)[source]¶ Return (and possibly filter) items in the the
attributes
map ofAttribute
objects for thisSchematicFile
.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 notNone
, 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
objectsReturn 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 theclasses
of thisSchematicFile
.Parameters: key – A str
to use for the lookup. The lookup uses thename
of theClass
objects.Return type: A Class
object orNone
, if there is no such item.
-
get_classes
(attrs=None, type=None)[source]¶ Return (and possibly filter) items in the the
classes
map ofClass
objects for thisSchematicFile
.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 notNone
, 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
objectsReturn 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 ofLibrary
objects for thisSchematicFile
.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 notNone
, 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
objectsReturn type: List of
Library
objects
-
get_library
(key)[source]¶ Lookup and return a
Library
from thelibraries
of thisSchematicFile
.Parameters: key – A str
to use for the lookup. The lookup uses thename
of theLibrary
objects.Return type: A Library
object orNone
, if there is no such item.
-
get_module
(key)[source]¶ Lookup and return a
Module
from themodules
of thisSchematicFile
.Parameters: key – A str
to use for the lookup. The lookup uses thename
of theModule
objects.Return type: A Module
object orNone
, if there is no such item.
-
get_modules
(attrs=None, type=None)[source]¶ Return (and possibly filter) items in the the
modules
map ofModule
objects for thisSchematicFile
.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 notNone
, 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
objectsReturn type: List of
Module
objects
-
get_nth_approved
(n)[source]¶ get then nth
Approved
object from theapproved_errors
of thisSchematicFile
.Parameters: n – Index of the item to return. Return type: Approved
object
-
get_nth_attribute
(n)[source]¶ get then nth
Attribute
object from theattributes
of thisSchematicFile
.Parameters: n – Index of the item to return. Return type: Attribute
object
-
get_nth_class
(n)[source]¶ get then nth
Class
object from theclasses
of thisSchematicFile
.Parameters: n – Index of the item to return. Return type: Class
object
-
get_nth_library
(n)[source]¶ get then nth
Library
object from thelibraries
of thisSchematicFile
.Parameters: n – Index of the item to return. Return type: Library
object
-
get_nth_module
(n)[source]¶ get then nth
Module
object from themodules
of thisSchematicFile
.Parameters: n – Index of the item to return. Return type: Module
object
-
get_nth_part
(n)[source]¶ get then nth
Part
object from theparts
of thisSchematicFile
.Parameters: n – Index of the item to return. Return type: Part
object
-
get_nth_setting
(n)[source]¶ get then nth
Setting
object from thesettings
of thisSchematicFile
.Parameters: n – Index of the item to return. Return type: Setting
object
-
get_nth_sheet
(n)[source]¶ get then nth
Sheet
object from thesheets
of thisSchematicFile
.Parameters: n – Index of the item to return. Return type: Sheet
object
-
get_nth_variantdef
(n)[source]¶ get then nth
Variantdef
object from thevariantdefs
of thisSchematicFile
.Parameters: n – Index of the item to return. Return type: Variantdef
object
-
get_part
(key)[source]¶ Lookup and return a
Part
from theparts
of thisSchematicFile
.Parameters: key – A str
to use for the lookup. The lookup uses thename
of thePart
objects.Return type: A Part
object orNone
, if there is no such item.
-
get_parts
(attrs=None, type=None)[source]¶ Return (and possibly filter) items in the the
parts
map ofPart
objects for thisSchematicFile
.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 notNone
, 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
objectsReturn 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 ofSetting
objects for thisSchematicFile
.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 notNone
, 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
objectsReturn type: List of
Setting
objects
-
get_sheets
(attrs=None, type=None)[source]¶ Return (and possibly filter) items in the the
sheets
list ofSheet
objects for thisSchematicFile
.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 notNone
, 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
objectsReturn type: List of
Sheet
objects
-
get_variantdef
(key)[source]¶ Lookup and return a
Variantdef
from thevariantdefs
of thisSchematicFile
.Parameters: key – A str
to use for the lookup. The lookup uses thename
of theVariantdef
objects.Return type: A Variantdef
object orNone
, if there is no such item.
-
get_variantdefs
(attrs=None, type=None)[source]¶ Return (and possibly filter) items in the the
variantdefs
map ofVariantdef
objects for thisSchematicFile
.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 notNone
, 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
objectsReturn type: List of
Variantdef
objects
-
get_version
()[source]¶ Return the value of
version
for thisSchematicFile
. This corresponds to theversion
attribute of a<eagle>
in an Eagle file.Return type: str
-
remove_approved
(efp)[source]¶ Remove a
Approved
from theapproved_errors
of thisSchematicFile
.Parameters: efp – The Approved
object to remove.Return type: self
-
remove_attribute
(efp)[source]¶ Remove a
Attribute
from theattributes
of thisSchematicFile
.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 theclasses
of thisSchematicFile
.Parameters: efp – The Class
object to remove.Return type: self
-
remove_library
(efp)[source]¶ Remove a
Library
from thelibraries
of thisSchematicFile
.Parameters: efp – The Library
object to remove.Return type: self
-
remove_module
(efp)[source]¶ Remove a
Module
from themodules
of thisSchematicFile
.Parameters: efp – The Module
object to remove.Return type: self
-
remove_part
(efp)[source]¶ Remove a
Part
from theparts
of thisSchematicFile
.Parameters: efp – The Part
object to remove.Return type: self
-
remove_setting
(efp)[source]¶ Remove a
Setting
from thesettings
of thisSchematicFile
.Parameters: efp – The Setting
object to remove.Return type: self
-
remove_sheet
(efp)[source]¶ Remove a
Sheet
from thesheets
of thisSchematicFile
.Parameters: efp – The Sheet
object to remove.Return type: self
-
remove_variantdef
(efp)[source]¶ Remove a
Variantdef
from thevariantdefs
of thisSchematicFile
.Parameters: efp – The Variantdef
object to remove.Return type: self
-
set_compatibility
(s)[source]¶ Set the
Compatibility
for thisSchematicFile
.Parameters: s – Compatibility
to set.Return type: self
-
set_description
(s)[source]¶ Set the
Description
for thisSchematicFile
.Parameters: s – Description
to set.Return type: self
-
set_grid
(s)[source]¶ Set the
Grid
for thisSchematicFile
.Parameters: s – Grid
to set.Return type: self
-
set_schematic
(s)[source]¶ Set the
Schematic
for thisSchematicFile
.Parameters: s – Schematic
to set.Return type: self
-
set_version
(v)[source]¶ Set the value of
version
for thisSchematicFile
. This corresponds to theversion
attribute of a<eagle>
in an Eagle file.Parameters: v – EagleFilePart
to set.Return type: self
-
with_version
(v)[source]¶ Filter this
EagleFilePart
object based on the value ofversion
. For use in combination withFrom
objects.Return
self
if one of the following is true:version
equalsv
v
is callable andv(self.get_version()
isTrue
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 andNone
otherwise.Return type: EagelFilePart
orNone
Sheet¶
-
class
Swoop.
Sheet
[source]¶ Bases:
Swoop.Swoop.EagleFilePart
Class representing the contents of a <sheet> tag in Eagle files.
Attributes:
Collections:
description
: SingletonDescription
object.plain_element
: List ofPolygon
,Wire
,Text
,Dimension
,Circle
,Rectangle
,Frame
andHole
objects.instance
: List ofInstance
objects.moduleinst
: Map ofModuleinst
objects indexed by theirname
.bus
: Map ofBus
objects indexed by theirname
.net
: Map ofNet
objects indexed by theirname
.
-
add_bus
(s)[source]¶ Add a
Bus
to thebusses
of thisSheet
.Parameters: s – The Bus
to add.Return type: self
-
add_instance
(s)[source]¶ Add a
Instance
to theinstances
of thisSheet
.Parameters: s – The Instance
to add.Return type: self
-
add_moduleinst
(s)[source]¶ Add a
Moduleinst
to themoduleinsts
of thisSheet
.Parameters: s – The Moduleinst
to add.Return type: self
-
add_net
(s)[source]¶ Add a
Net
to thenets
of thisSheet
.Parameters: s – The Net
to add.Return type: self
-
add_plain_element
(s)[source]¶ Add a
Polygon
,Wire
,Text
,Dimension
,Circle
,Rectangle
,Frame
orHole
to theplain_elements
of thisSheet
.Parameters: s – The Polygon
,Wire
,Text
,Dimension
,Circle
,Rectangle
,Frame
orHole
to add.Return type: self
-
clear_instances
()[source]¶ Remove all the
Instance
objects from theinstances
of thisSheet
.Return type: self
-
clear_moduleinsts
()[source]¶ Remove all the
Moduleinst
objects from themoduleinsts
of thisSheet
.Return type: self
-
clear_plain_elements
()[source]¶ Remove all the
Polygon
,Wire
,Text
,Dimension
,Circle
,Rectangle
,Frame
andHole
objects from theplain_elements
of thisSheet
.Return type: self
-
clone
()[source]¶ Recursively clone this
Sheet
. It will be identical to the original, but it’s parent will beNone
.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 thebusses
of thisSheet
.Parameters: key – A str
to use for the lookup. The lookup uses thename
of theBus
objects.Return type: A Bus
object orNone
, if there is no such item.
-
get_busses
(attrs=None, type=None)[source]¶ Return (and possibly filter) items in the the
busses
map ofBus
objects for thisSheet
.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 notNone
, 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
objectsReturn 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_instances
(attrs=None, type=None)[source]¶ Return (and possibly filter) items in the the
instances
list ofInstance
objects for thisSheet
.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 notNone
, 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
objectsReturn type: List of
Instance
objects
-
get_moduleinst
(key)[source]¶ Lookup and return a
Moduleinst
from themoduleinsts
of thisSheet
.Parameters: key – A str
to use for the lookup. The lookup uses thename
of theModuleinst
objects.Return type: A Moduleinst
object orNone
, if there is no such item.
-
get_moduleinsts
(attrs=None, type=None)[source]¶ Return (and possibly filter) items in the the
moduleinsts
map ofModuleinst
objects for thisSheet
.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 notNone
, 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
objectsReturn type: List of
Moduleinst
objects
-
get_net
(key)[source]¶ Lookup and return a
Net
from thenets
of thisSheet
.Parameters: key – A str
to use for the lookup. The lookup uses thename
of theNet
objects.Return type: A Net
object orNone
, if there is no such item.
-
get_nets
(attrs=None, type=None)[source]¶ Return (and possibly filter) items in the the
nets
map ofNet
objects for thisSheet
.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 notNone
, 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
objectsReturn type: List of
Net
objects
-
get_nth_bus
(n)[source]¶ get then nth
Bus
object from thebusses
of thisSheet
.Parameters: n – Index of the item to return. Return type: Bus
object
-
get_nth_instance
(n)[source]¶ get then nth
Instance
object from theinstances
of thisSheet
.Parameters: n – Index of the item to return. Return type: Instance
object
-
get_nth_moduleinst
(n)[source]¶ get then nth
Moduleinst
object from themoduleinsts
of thisSheet
.Parameters: n – Index of the item to return. Return type: Moduleinst
object
-
get_nth_net
(n)[source]¶ get then nth
Net
object from thenets
of thisSheet
.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
orHole
object from theplain_elements
of thisSheet
.Parameters: n – Index of the item to return. Return type: Polygon
,Wire
,Text
,Dimension
,Circle
,Rectangle
,Frame
orHole
object
-
get_plain_elements
(attrs=None, type=None)[source]¶ Return (and possibly filter) items in the the
plain_elements
list ofPolygon
,Wire
,Text
,Dimension
,Circle
,Rectangle
,Frame
orHole
objects for thisSheet
.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 notNone
, 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
andHole
objectsReturn type: List of
Polygon
,Wire
,Text
,Dimension
,Circle
,Rectangle
,Frame
andHole
objects
-
remove_bus
(efp)[source]¶ Remove a
Bus
from thebusses
of thisSheet
.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 theinstances
of thisSheet
.Parameters: efp – The Instance
object to remove.Return type: self
-
remove_moduleinst
(efp)[source]¶ Remove a
Moduleinst
from themoduleinsts
of thisSheet
.Parameters: efp – The Moduleinst
object to remove.Return type: self
-
remove_net
(efp)[source]¶ Remove a
Net
from thenets
of thisSheet
.Parameters: efp – The Net
object to remove.Return type: self
-
remove_plain_element
(efp)[source]¶ Remove a
Polygon
,Wire
,Text
,Dimension
,Circle
,Rectangle
,Frame
orHole
from theplain_elements
of thisSheet
.Parameters: efp – The Polygon
,Wire
,Text
,Dimension
,Circle
,Rectangle
,Frame
orHole
object to remove.Return type: self
-
set_description
(s)[source]¶ Set the
Description
for thisSheet
.Parameters: s – Description
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 ofAttribute
objects indexed by theirname
.
-
add_attribute
(s)[source]¶ Add a
Attribute
to theattributes
of thisInstance
.Parameters: s – The Attribute
to add.Return type: self
-
clear_attributes
()[source]¶ Remove all the
Attribute
objects from theattributes
of thisInstance
.Return type: self
-
clone
()[source]¶ Recursively clone this
Instance
. It will be identical to the original, but it’s parent will beNone
.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 thegate
attribute of this object. This is likeget_gate()
, except it returns theGate
object instead of its name.Returns: The object Return type: Gate
-
find_part
()[source]¶ Find the
Part
object refered to by thepart
attribute of this object. This is likeget_part()
, except it returns thePart
object instead of its name.Returns: The object Return type: Part
-
get_attribute
(key)[source]¶ Lookup and return a
Attribute
from theattributes
of thisInstance
.Parameters: key – A str
to use for the lookup. The lookup uses thename
of theAttribute
objects.Return type: A Attribute
object orNone
, if there is no such item.
-
get_attributes
(attrs=None, type=None)[source]¶ Return (and possibly filter) items in the the
attributes
map ofAttribute
objects for thisInstance
.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 notNone
, 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
objectsReturn type: List of
Attribute
objects
-
get_children
()[source]¶ Get all the children of this
EagleFilePart
.Return type: List of EagleFilePart
objects
-
get_gate
()[source]¶ Return the value of
gate
for thisInstance
. This corresponds to thegate
attribute of a<instance>
in an Eagle file.Return type: str
-
get_nth_attribute
(n)[source]¶ get then nth
Attribute
object from theattributes
of thisInstance
.Parameters: n – Index of the item to return. Return type: Attribute
object
-
get_part
()[source]¶ Return the value of
part
for thisInstance
. This corresponds to thepart
attribute of a<instance>
in an Eagle file.Return type: str
-
get_rot
()[source]¶ Return the value of
rot
for thisInstance
. This corresponds to therot
attribute of a<instance>
in an Eagle file.Return type: str
-
get_smashed
()[source]¶ Return the value of
smashed
for thisInstance
. This corresponds to thesmashed
attribute of a<instance>
in an Eagle file.Return type: str
-
get_x
()[source]¶ Return the value of
x
for thisInstance
. This corresponds to thex
attribute of a<instance>
in an Eagle file.Return type: float
-
get_y
()[source]¶ Return the value of
y
for thisInstance
. This corresponds to they
attribute of a<instance>
in an Eagle file.Return type: float
-
remove_attribute
(efp)[source]¶ Remove a
Attribute
from theattributes
of thisInstance
.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 thisInstance
. This corresponds to thegate
attribute of a<instance>
in an Eagle file.Parameters: v – EagleFilePart
to set.Return type: self
-
set_part
(v)[source]¶ Set the value of
part
for thisInstance
. This corresponds to thepart
attribute of a<instance>
in an Eagle file.Parameters: v – EagleFilePart
to set.Return type: self
-
set_rot
(v)[source]¶ Set the value of
rot
for thisInstance
. This corresponds to therot
attribute of a<instance>
in an Eagle file.Parameters: v – EagleFilePart
to set.Return type: self
-
set_smashed
(v)[source]¶ Set the value of
smashed
for thisInstance
. This corresponds to thesmashed
attribute of a<instance>
in an Eagle file.Parameters: v – EagleFilePart
to set.Return type: self
-
set_x
(v)[source]¶ Set the value of
x
for thisInstance
. This corresponds to thex
attribute of a<instance>
in an Eagle file.Parameters: v – EagleFilePart
to set.Return type: self
-
set_y
(v)[source]¶ Set the value of
y
for thisInstance
. This corresponds to they
attribute of a<instance>
in an Eagle file.Parameters: v – EagleFilePart
to set.Return type: self
-
with_gate
(v)[source]¶ Filter this
EagleFilePart
object based on the value ofgate
. For use in combination withFrom
objects.Return
self
if one of the following is true:gate
equalsv
v
is callable andv(self.get_gate()
isTrue
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 andNone
otherwise.Return type: EagelFilePart
orNone
-
with_part
(v)[source]¶ Filter this
EagleFilePart
object based on the value ofpart
. For use in combination withFrom
objects.Return
self
if one of the following is true:part
equalsv
v
is callable andv(self.get_part()
isTrue
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 andNone
otherwise.Return type: EagelFilePart
orNone
-
with_rot
(v)[source]¶ Filter this
EagleFilePart
object based on the value ofrot
. For use in combination withFrom
objects.Return
self
if one of the following is true:rot
equalsv
v
is callable andv(self.get_rot()
isTrue
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 andNone
otherwise.Return type: EagelFilePart
orNone
-
with_smashed
(v)[source]¶ Filter this
EagleFilePart
object based on the value ofsmashed
. For use in combination withFrom
objects.Return
self
if one of the following is true:smashed
equalsv
v
is callable andv(self.get_smashed()
isTrue
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 andNone
otherwise.Return type: EagelFilePart
orNone
-
with_x
(v)[source]¶ Filter this
EagleFilePart
object based on the value ofx
. For use in combination withFrom
objects.Return
self
if one of the following is true:x
equalsv
v
is callable andv(self.get_x()
isTrue
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 andNone
otherwise.Return type: EagelFilePart
orNone
-
with_y
(v)[source]¶ Filter this
EagleFilePart
object based on the value ofy
. For use in combination withFrom
objects.Return
self
if one of the following is true:y
equalsv
v
is callable andv(self.get_y()
isTrue
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 andNone
otherwise.Return type: EagelFilePart
orNone
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 ofSegment
objects.
-
add_segment
(s)[source]¶ Add a
Segment
to thesegments
of thisBus
.Parameters: s – The Segment
to add.Return type: self
-
clear_segments
()[source]¶ Remove all the
Segment
objects from thesegments
of thisBus
.Return type: self
-
clone
()[source]¶ Recursively clone this
Bus
. It will be identical to the original, but it’s parent will beNone
.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_name
()[source]¶ Return the value of
name
for thisBus
. This corresponds to thename
attribute of a<bus>
in an Eagle file.Return type: str
-
get_nth_segment
(n)[source]¶ get then nth
Segment
object from thesegments
of thisBus
.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 ofSegment
objects for thisBus
.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 notNone
, 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
objectsReturn 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 thesegments
of thisBus
.Parameters: efp – The Segment
object to remove.Return type: self
-
set_name
(v)[source]¶ Set the value of
name
for thisBus
. This corresponds to thename
attribute of a<bus>
in an Eagle file.Parameters: v – EagleFilePart
to set.Return type: self
-
with_name
(v)[source]¶ Filter this
EagleFilePart
object based on the value ofname
. For use in combination withFrom
objects.Return
self
if one of the following is true:name
equalsv
v
is callable andv(self.get_name()
isTrue
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 andNone
otherwise.Return type: EagelFilePart
orNone
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 beNone
.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 thisFrame
. This corresponds to theborder_bottom
attribute of a<frame>
in an Eagle file.Return type: bool
-
get_border_left
()[source]¶ Return the value of
border_left
for thisFrame
. This corresponds to theborder_left
attribute of a<frame>
in an Eagle file.Return type: bool
-
get_border_right
()[source]¶ Return the value of
border_right
for thisFrame
. This corresponds to theborder_right
attribute of a<frame>
in an Eagle file.Return type: bool
-
get_border_top
()[source]¶ Return the value of
border_top
for thisFrame
. This corresponds to theborder_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 thisFrame
. This corresponds to thecolumns
attribute of a<frame>
in an Eagle file.Return type: int
-
get_layer
()[source]¶ Return the value of
layer
for thisFrame
. This corresponds to thelayer
attribute of a<frame>
in an Eagle file.Return type: layer_string
-
get_rows
()[source]¶ Return the value of
rows
for thisFrame
. This corresponds to therows
attribute of a<frame>
in an Eagle file.Return type: int
-
get_x1
()[source]¶ Return the value of
x1
for thisFrame
. This corresponds to thex1
attribute of a<frame>
in an Eagle file.Return type: float
-
get_x2
()[source]¶ Return the value of
x2
for thisFrame
. This corresponds to thex2
attribute of a<frame>
in an Eagle file.Return type: float
-
get_y1
()[source]¶ Return the value of
y1
for thisFrame
. This corresponds to they1
attribute of a<frame>
in an Eagle file.Return type: float
-
get_y2
()[source]¶ Return the value of
y2
for thisFrame
. This corresponds to they2
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 thisFrame
. This corresponds to theborder_bottom
attribute of a<frame>
in an Eagle file.Parameters: v – EagleFilePart
to set.Return type: self
-
set_border_left
(v)[source]¶ Set the value of
border_left
for thisFrame
. This corresponds to theborder_left
attribute of a<frame>
in an Eagle file.Parameters: v – EagleFilePart
to set.Return type: self
-
set_border_right
(v)[source]¶ Set the value of
border_right
for thisFrame
. This corresponds to theborder_right
attribute of a<frame>
in an Eagle file.Parameters: v – EagleFilePart
to set.Return type: self
-
set_border_top
(v)[source]¶ Set the value of
border_top
for thisFrame
. This corresponds to theborder_top
attribute of a<frame>
in an Eagle file.Parameters: v – EagleFilePart
to set.Return type: self
-
set_columns
(v)[source]¶ Set the value of
columns
for thisFrame
. This corresponds to thecolumns
attribute of a<frame>
in an Eagle file.Parameters: v – EagleFilePart
to set.Return type: self
-
set_layer
(v)[source]¶ Set the value of
layer
for thisFrame
. This corresponds to thelayer
attribute of a<frame>
in an Eagle file.Parameters: v – EagleFilePart
to set.Return type: self
-
set_rows
(v)[source]¶ Set the value of
rows
for thisFrame
. This corresponds to therows
attribute of a<frame>
in an Eagle file.Parameters: v – EagleFilePart
to set.Return type: self
-
set_x1
(v)[source]¶ Set the value of
x1
for thisFrame
. This corresponds to thex1
attribute of a<frame>
in an Eagle file.Parameters: v – EagleFilePart
to set.Return type: self
-
set_x2
(v)[source]¶ Set the value of
x2
for thisFrame
. This corresponds to thex2
attribute of a<frame>
in an Eagle file.Parameters: v – EagleFilePart
to set.Return type: self
-
set_y1
(v)[source]¶ Set the value of
y1
for thisFrame
. This corresponds to they1
attribute of a<frame>
in an Eagle file.Parameters: v – EagleFilePart
to set.Return type: self
-
set_y2
(v)[source]¶ Set the value of
y2
for thisFrame
. This corresponds to they2
attribute of a<frame>
in an Eagle file.Parameters: v – EagleFilePart
to set.Return type: self
-
with_border_bottom
(v)[source]¶ Filter this
EagleFilePart
object based on the value ofborder_bottom
. For use in combination withFrom
objects.Return
self
if one of the following is true:border_bottom
equalsv
v
is callable andv(self.get_border_bottom()
isTrue
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 andNone
otherwise.Return type: EagelFilePart
orNone
-
with_border_left
(v)[source]¶ Filter this
EagleFilePart
object based on the value ofborder_left
. For use in combination withFrom
objects.Return
self
if one of the following is true:border_left
equalsv
v
is callable andv(self.get_border_left()
isTrue
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 andNone
otherwise.Return type: EagelFilePart
orNone
-
with_border_right
(v)[source]¶ Filter this
EagleFilePart
object based on the value ofborder_right
. For use in combination withFrom
objects.Return
self
if one of the following is true:border_right
equalsv
v
is callable andv(self.get_border_right()
isTrue
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 andNone
otherwise.Return type: EagelFilePart
orNone
-
with_border_top
(v)[source]¶ Filter this
EagleFilePart
object based on the value ofborder_top
. For use in combination withFrom
objects.Return
self
if one of the following is true:border_top
equalsv
v
is callable andv(self.get_border_top()
isTrue
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 andNone
otherwise.Return type: EagelFilePart
orNone
-
with_columns
(v)[source]¶ Filter this
EagleFilePart
object based on the value ofcolumns
. For use in combination withFrom
objects.Return
self
if one of the following is true:columns
equalsv
v
is callable andv(self.get_columns()
isTrue
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 andNone
otherwise.Return type: EagelFilePart
orNone
-
with_layer
(v)[source]¶ Filter this
EagleFilePart
object based on the value oflayer
. For use in combination withFrom
objects.Return
self
if one of the following is true:layer
equalsv
v
is callable andv(self.get_layer()
isTrue
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 andNone
otherwise.Return type: EagelFilePart
orNone
-
with_rows
(v)[source]¶ Filter this
EagleFilePart
object based on the value ofrows
. For use in combination withFrom
objects.Return
self
if one of the following is true:rows
equalsv
v
is callable andv(self.get_rows()
isTrue
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 andNone
otherwise.Return type: EagelFilePart
orNone
-
with_x1
(v)[source]¶ Filter this
EagleFilePart
object based on the value ofx1
. For use in combination withFrom
objects.Return
self
if one of the following is true:x1
equalsv
v
is callable andv(self.get_x1()
isTrue
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 andNone
otherwise.Return type: EagelFilePart
orNone
-
with_x2
(v)[source]¶ Filter this
EagleFilePart
object based on the value ofx2
. For use in combination withFrom
objects.Return
self
if one of the following is true:x2
equalsv
v
is callable andv(self.get_x2()
isTrue
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 andNone
otherwise.Return type: EagelFilePart
orNone
-
with_y1
(v)[source]¶ Filter this
EagleFilePart
object based on the value ofy1
. For use in combination withFrom
objects.Return
self
if one of the following is true:y1
equalsv
v
is callable andv(self.get_y1()
isTrue
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 andNone
otherwise.Return type: EagelFilePart
orNone
-
with_y2
(v)[source]¶ Filter this
EagleFilePart
object based on the value ofy2
. For use in combination withFrom
objects.Return
self
if one of the following is true:y2
equalsv
v
is callable andv(self.get_y2()
isTrue
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 andNone
otherwise.Return type: EagelFilePart
orNone
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 beNone
.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_x
()[source]¶ Return the value of
x
for thisJunction
. This corresponds to thex
attribute of a<junction>
in an Eagle file.Return type: float
-
get_y
()[source]¶ Return the value of
y
for thisJunction
. This corresponds to they
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 thisJunction
. This corresponds to thex
attribute of a<junction>
in an Eagle file.Parameters: v – EagleFilePart
to set.Return type: self
-
set_y
(v)[source]¶ Set the value of
y
for thisJunction
. This corresponds to they
attribute of a<junction>
in an Eagle file.Parameters: v – EagleFilePart
to set.Return type: self
-
with_x
(v)[source]¶ Filter this
EagleFilePart
object based on the value ofx
. For use in combination withFrom
objects.Return
self
if one of the following is true:x
equalsv
v
is callable andv(self.get_x()
isTrue
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 andNone
otherwise.Return type: EagelFilePart
orNone
-
with_y
(v)[source]¶ Filter this
EagleFilePart
object based on the value ofy
. For use in combination withFrom
objects.Return
self
if one of the following is true:y
equalsv
v
is callable andv(self.get_y()
isTrue
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 andNone
otherwise.Return type: EagelFilePart
orNone
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
: SingletonDescription
object.sheet
: List ofSheet
objects.port
: Map ofPort
objects indexed by theirname
.variantdef
: Map ofVariantdef
objects indexed by theirname
.part
: Map ofPart
objects indexed by theirname
.
-
add_part
(s)[source]¶ Add a
Part
to theparts
of thisModule
.Parameters: s – The Part
to add.Return type: self
-
add_port
(s)[source]¶ Add a
Port
to theports
of thisModule
.Parameters: s – The Port
to add.Return type: self
-
add_sheet
(s)[source]¶ Add a
Sheet
to thesheets
of thisModule
.Parameters: s – The Sheet
to add.Return type: self
-
add_variantdef
(s)[source]¶ Add a
Variantdef
to thevariantdefs
of thisModule
.Parameters: s – The Variantdef
to add.Return type: self
-
clear_sheets
()[source]¶ Remove all the
Sheet
objects from thesheets
of thisModule
.Return type: self
-
clear_variantdefs
()[source]¶ Remove all the
Variantdef
objects from thevariantdefs
of thisModule
.Return type: self
-
clone
()[source]¶ Recursively clone this
Module
. It will be identical to the original, but it’s parent will beNone
.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 thisModule
. This corresponds to thedx
attribute of a<module>
in an Eagle file.Return type: float
-
get_dy
()[source]¶ Return the value of
dy
for thisModule
. This corresponds to thedy
attribute of a<module>
in an Eagle file.Return type: float
-
get_name
()[source]¶ Return the value of
name
for thisModule
. This corresponds to thename
attribute of a<module>
in an Eagle file.Return type: str
-
get_nth_part
(n)[source]¶ get then nth
Part
object from theparts
of thisModule
.Parameters: n – Index of the item to return. Return type: Part
object
-
get_nth_port
(n)[source]¶ get then nth
Port
object from theports
of thisModule
.Parameters: n – Index of the item to return. Return type: Port
object
-
get_nth_sheet
(n)[source]¶ get then nth
Sheet
object from thesheets
of thisModule
.Parameters: n – Index of the item to return. Return type: Sheet
object
-
get_nth_variantdef
(n)[source]¶ get then nth
Variantdef
object from thevariantdefs
of thisModule
.Parameters: n – Index of the item to return. Return type: Variantdef
object
-
get_part
(key)[source]¶ Lookup and return a
Part
from theparts
of thisModule
.Parameters: key – A str
to use for the lookup. The lookup uses thename
of thePart
objects.Return type: A Part
object orNone
, if there is no such item.
-
get_parts
(attrs=None, type=None)[source]¶ Return (and possibly filter) items in the the
parts
map ofPart
objects for thisModule
.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 notNone
, 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
objectsReturn type: List of
Part
objects
-
get_port
(key)[source]¶ Lookup and return a
Port
from theports
of thisModule
.Parameters: key – A str
to use for the lookup. The lookup uses thename
of thePort
objects.Return type: A Port
object orNone
, if there is no such item.
-
get_ports
(attrs=None, type=None)[source]¶ Return (and possibly filter) items in the the
ports
map ofPort
objects for thisModule
.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 notNone
, 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
objectsReturn type: List of
Port
objects
-
get_prefix
()[source]¶ Return the value of
prefix
for thisModule
. This corresponds to theprefix
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 ofSheet
objects for thisModule
.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 notNone
, 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
objectsReturn type: List of
Sheet
objects
-
get_variantdef
(key)[source]¶ Lookup and return a
Variantdef
from thevariantdefs
of thisModule
.Parameters: key – A str
to use for the lookup. The lookup uses thename
of theVariantdef
objects.Return type: A Variantdef
object orNone
, if there is no such item.
-
get_variantdefs
(attrs=None, type=None)[source]¶ Return (and possibly filter) items in the the
variantdefs
map ofVariantdef
objects for thisModule
.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 notNone
, 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
objectsReturn 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 theparts
of thisModule
.Parameters: efp – The Part
object to remove.Return type: self
-
remove_port
(efp)[source]¶ Remove a
Port
from theports
of thisModule
.Parameters: efp – The Port
object to remove.Return type: self
-
remove_sheet
(efp)[source]¶ Remove a
Sheet
from thesheets
of thisModule
.Parameters: efp – The Sheet
object to remove.Return type: self
-
remove_variantdef
(efp)[source]¶ Remove a
Variantdef
from thevariantdefs
of thisModule
.Parameters: efp – The Variantdef
object to remove.Return type: self
-
set_description
(s)[source]¶ Set the
Description
for thisModule
.Parameters: s – Description
to set.Return type: self
-
set_dx
(v)[source]¶ Set the value of
dx
for thisModule
. This corresponds to thedx
attribute of a<module>
in an Eagle file.Parameters: v – EagleFilePart
to set.Return type: self
-
set_dy
(v)[source]¶ Set the value of
dy
for thisModule
. This corresponds to thedy
attribute of a<module>
in an Eagle file.Parameters: v – EagleFilePart
to set.Return type: self
-
set_name
(v)[source]¶ Set the value of
name
for thisModule
. This corresponds to thename
attribute of a<module>
in an Eagle file.Parameters: v – EagleFilePart
to set.Return type: self
-
set_prefix
(v)[source]¶ Set the value of
prefix
for thisModule
. This corresponds to theprefix
attribute of a<module>
in an Eagle file.Parameters: v – EagleFilePart
to set.Return type: self
-
with_dx
(v)[source]¶ Filter this
EagleFilePart
object based on the value ofdx
. For use in combination withFrom
objects.Return
self
if one of the following is true:dx
equalsv
v
is callable andv(self.get_dx()
isTrue
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 andNone
otherwise.Return type: EagelFilePart
orNone
-
with_dy
(v)[source]¶ Filter this
EagleFilePart
object based on the value ofdy
. For use in combination withFrom
objects.Return
self
if one of the following is true:dy
equalsv
v
is callable andv(self.get_dy()
isTrue
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 andNone
otherwise.Return type: EagelFilePart
orNone
-
with_name
(v)[source]¶ Filter this
EagleFilePart
object based on the value ofname
. For use in combination withFrom
objects.Return
self
if one of the following is true:name
equalsv
v
is callable andv(self.get_name()
isTrue
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 andNone
otherwise.Return type: EagelFilePart
orNone
-
with_prefix
(v)[source]¶ Filter this
EagleFilePart
object based on the value ofprefix
. For use in combination withFrom
objects.Return
self
if one of the following is true:prefix
equalsv
v
is callable andv(self.get_prefix()
isTrue
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 andNone
otherwise.Return type: EagelFilePart
orNone
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 beNone
.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 themodule
attribute of this object. This is likeget_module()
, except it returns theModule
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 thisModuleinst
. This corresponds to themodule
attribute of a<moduleinst>
in an Eagle file.Return type: str
-
get_modulevariant
()[source]¶ Return the value of
modulevariant
for thisModuleinst
. This corresponds to themodulevariant
attribute of a<moduleinst>
in an Eagle file.Return type: str
-
get_name
()[source]¶ Return the value of
name
for thisModuleinst
. This corresponds to thename
attribute of a<moduleinst>
in an Eagle file.Return type: str
-
get_offset
()[source]¶ Return the value of
offset
for thisModuleinst
. This corresponds to theoffset
attribute of a<moduleinst>
in an Eagle file.Return type: int
-
get_rot
()[source]¶ Return the value of
rot
for thisModuleinst
. This corresponds to therot
attribute of a<moduleinst>
in an Eagle file.Return type: str
-
get_smashed
()[source]¶ Return the value of
smashed
for thisModuleinst
. This corresponds to thesmashed
attribute of a<moduleinst>
in an Eagle file.Return type: str
-
get_x
()[source]¶ Return the value of
x
for thisModuleinst
. This corresponds to thex
attribute of a<moduleinst>
in an Eagle file.Return type: float
-
get_y
()[source]¶ Return the value of
y
for thisModuleinst
. This corresponds to they
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 thisModuleinst
. This corresponds to themodule
attribute of a<moduleinst>
in an Eagle file.Parameters: v – EagleFilePart
to set.Return type: self
-
set_modulevariant
(v)[source]¶ Set the value of
modulevariant
for thisModuleinst
. This corresponds to themodulevariant
attribute of a<moduleinst>
in an Eagle file.Parameters: v – EagleFilePart
to set.Return type: self
-
set_name
(v)[source]¶ Set the value of
name
for thisModuleinst
. This corresponds to thename
attribute of a<moduleinst>
in an Eagle file.Parameters: v – EagleFilePart
to set.Return type: self
-
set_offset
(v)[source]¶ Set the value of
offset
for thisModuleinst
. This corresponds to theoffset
attribute of a<moduleinst>
in an Eagle file.Parameters: v – EagleFilePart
to set.Return type: self
-
set_rot
(v)[source]¶ Set the value of
rot
for thisModuleinst
. This corresponds to therot
attribute of a<moduleinst>
in an Eagle file.Parameters: v – EagleFilePart
to set.Return type: self
-
set_smashed
(v)[source]¶ Set the value of
smashed
for thisModuleinst
. This corresponds to thesmashed
attribute of a<moduleinst>
in an Eagle file.Parameters: v – EagleFilePart
to set.Return type: self
-
set_x
(v)[source]¶ Set the value of
x
for thisModuleinst
. This corresponds to thex
attribute of a<moduleinst>
in an Eagle file.Parameters: v – EagleFilePart
to set.Return type: self
-
set_y
(v)[source]¶ Set the value of
y
for thisModuleinst
. This corresponds to they
attribute of a<moduleinst>
in an Eagle file.Parameters: v – EagleFilePart
to set.Return type: self
-
with_module
(v)[source]¶ Filter this
EagleFilePart
object based on the value ofmodule
. For use in combination withFrom
objects.Return
self
if one of the following is true:module
equalsv
v
is callable andv(self.get_module()
isTrue
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 andNone
otherwise.Return type: EagelFilePart
orNone
-
with_modulevariant
(v)[source]¶ Filter this
EagleFilePart
object based on the value ofmodulevariant
. For use in combination withFrom
objects.Return
self
if one of the following is true:modulevariant
equalsv
v
is callable andv(self.get_modulevariant()
isTrue
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 andNone
otherwise.Return type: EagelFilePart
orNone
-
with_name
(v)[source]¶ Filter this
EagleFilePart
object based on the value ofname
. For use in combination withFrom
objects.Return
self
if one of the following is true:name
equalsv
v
is callable andv(self.get_name()
isTrue
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 andNone
otherwise.Return type: EagelFilePart
orNone
-
with_offset
(v)[source]¶ Filter this
EagleFilePart
object based on the value ofoffset
. For use in combination withFrom
objects.Return
self
if one of the following is true:offset
equalsv
v
is callable andv(self.get_offset()
isTrue
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 andNone
otherwise.Return type: EagelFilePart
orNone
-
with_rot
(v)[source]¶ Filter this
EagleFilePart
object based on the value ofrot
. For use in combination withFrom
objects.Return
self
if one of the following is true:rot
equalsv
v
is callable andv(self.get_rot()
isTrue
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 andNone
otherwise.Return type: EagelFilePart
orNone
-
with_smashed
(v)[source]¶ Filter this
EagleFilePart
object based on the value ofsmashed
. For use in combination withFrom
objects.Return
self
if one of the following is true:smashed
equalsv
v
is callable andv(self.get_smashed()
isTrue
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 andNone
otherwise.Return type: EagelFilePart
orNone
-
with_x
(v)[source]¶ Filter this
EagleFilePart
object based on the value ofx
. For use in combination withFrom
objects.Return
self
if one of the following is true:x
equalsv
v
is callable andv(self.get_x()
isTrue
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 andNone
otherwise.Return type: EagelFilePart
orNone
-
with_y
(v)[source]¶ Filter this
EagleFilePart
object based on the value ofy
. For use in combination withFrom
objects.Return
self
if one of the following is true:y
equalsv
v
is callable andv(self.get_y()
isTrue
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 andNone
otherwise.Return type: EagelFilePart
orNone
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 ofSegment
objects.
-
add_segment
(s)[source]¶ Add a
Segment
to thesegments
of thisNet
.Parameters: s – The Segment
to add.Return type: self
-
clear_segments
()[source]¶ Remove all the
Segment
objects from thesegments
of thisNet
.Return type: self
-
clone
()[source]¶ Recursively clone this
Net
. It will be identical to the original, but it’s parent will beNone
.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 thisNet
. This corresponds to thenetclass
attribute of a<net>
in an Eagle file.Return type: str
-
get_name
()[source]¶ Return the value of
name
for thisNet
. This corresponds to thename
attribute of a<net>
in an Eagle file.Return type: str
-
get_nth_segment
(n)[source]¶ get then nth
Segment
object from thesegments
of thisNet
.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 ofSegment
objects for thisNet
.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 notNone
, 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
objectsReturn 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 thesegments
of thisNet
.Parameters: efp – The Segment
object to remove.Return type: self
-
set_class
(v)[source]¶ Set the value of
netclass
for thisNet
. This corresponds to thenetclass
attribute of a<net>
in an Eagle file.Parameters: v – EagleFilePart
to set.Return type: self
-
set_name
(v)[source]¶ Set the value of
name
for thisNet
. This corresponds to thename
attribute of a<net>
in an Eagle file.Parameters: v – EagleFilePart
to set.Return type: self
-
with_class
(v)[source]¶ Filter this
EagleFilePart
object based on the value ofnetclass
. For use in combination withFrom
objects.Return
self
if one of the following is true:netclass
equalsv
v
is callable andv(self.get_class()
isTrue
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 andNone
otherwise.Return type: EagelFilePart
orNone
-
with_name
(v)[source]¶ Filter this
EagleFilePart
object based on the value ofname
. For use in combination withFrom
objects.Return
self
if one of the following is true:name
equalsv
v
is callable andv(self.get_name()
isTrue
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 andNone
otherwise.Return type: EagelFilePart
orNone
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 beNone
.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 thisPin
. This corresponds to thedirection
attribute of a<pin>
in an Eagle file.Return type: str
-
get_function
()[source]¶ Return the value of
function
for thisPin
. This corresponds to thefunction
attribute of a<pin>
in an Eagle file.Return type: str
-
get_length
()[source]¶ Return the value of
length
for thisPin
. This corresponds to thelength
attribute of a<pin>
in an Eagle file.Return type: str
-
get_name
()[source]¶ Return the value of
name
for thisPin
. This corresponds to thename
attribute of a<pin>
in an Eagle file.Return type: str
-
get_rot
()[source]¶ Return the value of
rot
for thisPin
. This corresponds to therot
attribute of a<pin>
in an Eagle file.Return type: str
-
get_swaplevel
()[source]¶ Return the value of
swaplevel
for thisPin
. This corresponds to theswaplevel
attribute of a<pin>
in an Eagle file.Return type: int
-
get_visible
()[source]¶ Return the value of
visible
for thisPin
. This corresponds to thevisible
attribute of a<pin>
in an Eagle file.Return type: str
-
get_x
()[source]¶ Return the value of
x
for thisPin
. This corresponds to thex
attribute of a<pin>
in an Eagle file.Return type: float
-
get_y
()[source]¶ Return the value of
y
for thisPin
. This corresponds to they
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 thisPin
. This corresponds to thedirection
attribute of a<pin>
in an Eagle file.Parameters: v – EagleFilePart
to set.Return type: self
-
set_function
(v)[source]¶ Set the value of
function
for thisPin
. This corresponds to thefunction
attribute of a<pin>
in an Eagle file.Parameters: v – EagleFilePart
to set.Return type: self
-
set_length
(v)[source]¶ Set the value of
length
for thisPin
. This corresponds to thelength
attribute of a<pin>
in an Eagle file.Parameters: v – EagleFilePart
to set.Return type: self
-
set_name
(v)[source]¶ Set the value of
name
for thisPin
. This corresponds to thename
attribute of a<pin>
in an Eagle file.Parameters: v – EagleFilePart
to set.Return type: self
-
set_rot
(v)[source]¶ Set the value of
rot
for thisPin
. This corresponds to therot
attribute of a<pin>
in an Eagle file.Parameters: v – EagleFilePart
to set.Return type: self
-
set_swaplevel
(v)[source]¶ Set the value of
swaplevel
for thisPin
. This corresponds to theswaplevel
attribute of a<pin>
in an Eagle file.Parameters: v – EagleFilePart
to set.Return type: self
-
set_visible
(v)[source]¶ Set the value of
visible
for thisPin
. This corresponds to thevisible
attribute of a<pin>
in an Eagle file.Parameters: v – EagleFilePart
to set.Return type: self
-
set_x
(v)[source]¶ Set the value of
x
for thisPin
. This corresponds to thex
attribute of a<pin>
in an Eagle file.Parameters: v – EagleFilePart
to set.Return type: self
-
set_y
(v)[source]¶ Set the value of
y
for thisPin
. This corresponds to they
attribute of a<pin>
in an Eagle file.Parameters: v – EagleFilePart
to set.Return type: self
-
with_direction
(v)[source]¶ Filter this
EagleFilePart
object based on the value ofdirection
. For use in combination withFrom
objects.Return
self
if one of the following is true:direction
equalsv
v
is callable andv(self.get_direction()
isTrue
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 andNone
otherwise.Return type: EagelFilePart
orNone
-
with_function
(v)[source]¶ Filter this
EagleFilePart
object based on the value offunction
. For use in combination withFrom
objects.Return
self
if one of the following is true:function
equalsv
v
is callable andv(self.get_function()
isTrue
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 andNone
otherwise.Return type: EagelFilePart
orNone
-
with_length
(v)[source]¶ Filter this
EagleFilePart
object based on the value oflength
. For use in combination withFrom
objects.Return
self
if one of the following is true:length
equalsv
v
is callable andv(self.get_length()
isTrue
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 andNone
otherwise.Return type: EagelFilePart
orNone
-
with_name
(v)[source]¶ Filter this
EagleFilePart
object based on the value ofname
. For use in combination withFrom
objects.Return
self
if one of the following is true:name
equalsv
v
is callable andv(self.get_name()
isTrue
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 andNone
otherwise.Return type: EagelFilePart
orNone
-
with_rot
(v)[source]¶ Filter this
EagleFilePart
object based on the value ofrot
. For use in combination withFrom
objects.Return
self
if one of the following is true:rot
equalsv
v
is callable andv(self.get_rot()
isTrue
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 andNone
otherwise.Return type: EagelFilePart
orNone
-
with_swaplevel
(v)[source]¶ Filter this
EagleFilePart
object based on the value ofswaplevel
. For use in combination withFrom
objects.Return
self
if one of the following is true:swaplevel
equalsv
v
is callable andv(self.get_swaplevel()
isTrue
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 andNone
otherwise.Return type: EagelFilePart
orNone
-
with_visible
(v)[source]¶ Filter this
EagleFilePart
object based on the value ofvisible
. For use in combination withFrom
objects.Return
self
if one of the following is true:visible
equalsv
v
is callable andv(self.get_visible()
isTrue
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 andNone
otherwise.Return type: EagelFilePart
orNone
-
with_x
(v)[source]¶ Filter this
EagleFilePart
object based on the value ofx
. For use in combination withFrom
objects.Return
self
if one of the following is true:x
equalsv
v
is callable andv(self.get_x()
isTrue
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 andNone
otherwise.Return type: EagelFilePart
orNone
-
with_y
(v)[source]¶ Filter this
EagleFilePart
object based on the value ofy
. For use in combination withFrom
objects.Return
self
if one of the following is true:y
equalsv
v
is callable andv(self.get_y()
isTrue
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 andNone
otherwise.Return type: EagelFilePart
orNone
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 beNone
.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 thegate
attribute of this object. This is likeget_gate()
, except it returns theGate
object instead of its name.Returns: The object Return type: Gate
-
find_part
()[source]¶ Find the
Part
object refered to by thepart
attribute of this object. This is likeget_part()
, except it returns thePart
object instead of its name.Returns: The object Return type: Part
-
find_pin
()[source]¶ Find the
Pin
object refered to by thepin
attribute of this object. This is likeget_pin()
, except it returns thePin
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_gate
()[source]¶ Return the value of
gate
for thisPinref
. This corresponds to thegate
attribute of a<pinref>
in an Eagle file.Return type: str
-
get_part
()[source]¶ Return the value of
part
for thisPinref
. This corresponds to thepart
attribute of a<pinref>
in an Eagle file.Return type: str
-
get_pin
()[source]¶ Return the value of
pin
for thisPinref
. This corresponds to thepin
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 thisPinref
. This corresponds to thegate
attribute of a<pinref>
in an Eagle file.Parameters: v – EagleFilePart
to set.Return type: self
-
set_part
(v)[source]¶ Set the value of
part
for thisPinref
. This corresponds to thepart
attribute of a<pinref>
in an Eagle file.Parameters: v – EagleFilePart
to set.Return type: self
-
set_pin
(v)[source]¶ Set the value of
pin
for thisPinref
. This corresponds to thepin
attribute of a<pinref>
in an Eagle file.Parameters: v – EagleFilePart
to set.Return type: self
-
with_gate
(v)[source]¶ Filter this
EagleFilePart
object based on the value ofgate
. For use in combination withFrom
objects.Return
self
if one of the following is true:gate
equalsv
v
is callable andv(self.get_gate()
isTrue
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 andNone
otherwise.Return type: EagelFilePart
orNone
-
with_part
(v)[source]¶ Filter this
EagleFilePart
object based on the value ofpart
. For use in combination withFrom
objects.Return
self
if one of the following is true:part
equalsv
v
is callable andv(self.get_part()
isTrue
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 andNone
otherwise.Return type: EagelFilePart
orNone
-
with_pin
(v)[source]¶ Filter this
EagleFilePart
object based on the value ofpin
. For use in combination withFrom
objects.Return
self
if one of the following is true:pin
equalsv
v
is callable andv(self.get_pin()
isTrue
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 andNone
otherwise.Return type: EagelFilePart
orNone
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 beNone
.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 thisPort
. This corresponds to thedimension
attribute of a<port>
in an Eagle file.Return type: str
-
get_direction
()[source]¶ Return the value of
direction
for thisPort
. This corresponds to thedirection
attribute of a<port>
in an Eagle file.Return type: str
-
get_name
()[source]¶ Return the value of
name
for thisPort
. This corresponds to thename
attribute of a<port>
in an Eagle file.Return type: str
-
get_side
()[source]¶ Return the value of
side
for thisPort
. This corresponds to theside
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 thisPort
. This corresponds to thedimension
attribute of a<port>
in an Eagle file.Parameters: v – EagleFilePart
to set.Return type: self
-
set_direction
(v)[source]¶ Set the value of
direction
for thisPort
. This corresponds to thedirection
attribute of a<port>
in an Eagle file.Parameters: v – EagleFilePart
to set.Return type: self
-
set_name
(v)[source]¶ Set the value of
name
for thisPort
. This corresponds to thename
attribute of a<port>
in an Eagle file.Parameters: v – EagleFilePart
to set.Return type: self
-
set_side
(v)[source]¶ Set the value of
side
for thisPort
. This corresponds to theside
attribute of a<port>
in an Eagle file.Parameters: v – EagleFilePart
to set.Return type: self
-
with_dimension
(v)[source]¶ Filter this
EagleFilePart
object based on the value ofdimension
. For use in combination withFrom
objects.Return
self
if one of the following is true:dimension
equalsv
v
is callable andv(self.get_dimension()
isTrue
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 andNone
otherwise.Return type: EagelFilePart
orNone
-
with_direction
(v)[source]¶ Filter this
EagleFilePart
object based on the value ofdirection
. For use in combination withFrom
objects.Return
self
if one of the following is true:direction
equalsv
v
is callable andv(self.get_direction()
isTrue
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 andNone
otherwise.Return type: EagelFilePart
orNone
-
with_name
(v)[source]¶ Filter this
EagleFilePart
object based on the value ofname
. For use in combination withFrom
objects.Return
self
if one of the following is true:name
equalsv
v
is callable andv(self.get_name()
isTrue
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 andNone
otherwise.Return type: EagelFilePart
orNone
-
with_side
(v)[source]¶ Filter this
EagleFilePart
object based on the value ofside
. For use in combination withFrom
objects.Return
self
if one of the following is true:side
equalsv
v
is callable andv(self.get_side()
isTrue
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 andNone
otherwise.Return type: EagelFilePart
orNone
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 beNone
.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 themoduleinst
attribute of this object. This is likeget_moduleinst()
, except it returns theModuleinst
object instead of its name.Returns: The object Return type: Moduleinst
-
find_port
()[source]¶ Find the
Port
object refered to by theport
attribute of this object. This is likeget_port()
, except it returns thePort
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_moduleinst
()[source]¶ Return the value of
moduleinst
for thisPortref
. This corresponds to themoduleinst
attribute of a<portref>
in an Eagle file.Return type: str
-
get_port
()[source]¶ Return the value of
port
for thisPortref
. This corresponds to theport
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 thisPortref
. This corresponds to themoduleinst
attribute of a<portref>
in an Eagle file.Parameters: v – EagleFilePart
to set.Return type: self
-
set_port
(v)[source]¶ Set the value of
port
for thisPortref
. This corresponds to theport
attribute of a<portref>
in an Eagle file.Parameters: v – EagleFilePart
to set.Return type: self
-
with_moduleinst
(v)[source]¶ Filter this
EagleFilePart
object based on the value ofmoduleinst
. For use in combination withFrom
objects.Return
self
if one of the following is true:moduleinst
equalsv
v
is callable andv(self.get_moduleinst()
isTrue
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 andNone
otherwise.Return type: EagelFilePart
orNone
-
with_port
(v)[source]¶ Filter this
EagleFilePart
object based on the value ofport
. For use in combination withFrom
objects.Return
self
if one of the following is true:port
equalsv
v
is callable andv(self.get_port()
isTrue
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 andNone
otherwise.Return type: EagelFilePart
orNone
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 beNone
.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_xreflabel
()[source]¶ Return the value of
xreflabel
for thisSchematic
. This corresponds to thexreflabel
attribute of a<schematic>
in an Eagle file.Return type: str
-
get_xrefpart
()[source]¶ Return the value of
xrefpart
for thisSchematic
. This corresponds to thexrefpart
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 thisSchematic
. This corresponds to thexreflabel
attribute of a<schematic>
in an Eagle file.Parameters: v – EagleFilePart
to set.Return type: self
-
set_xrefpart
(v)[source]¶ Set the value of
xrefpart
for thisSchematic
. This corresponds to thexrefpart
attribute of a<schematic>
in an Eagle file.Parameters: v – EagleFilePart
to set.Return type: self
-
with_xreflabel
(v)[source]¶ Filter this
EagleFilePart
object based on the value ofxreflabel
. For use in combination withFrom
objects.Return
self
if one of the following is true:xreflabel
equalsv
v
is callable andv(self.get_xreflabel()
isTrue
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 andNone
otherwise.Return type: EagelFilePart
orNone
-
with_xrefpart
(v)[source]¶ Filter this
EagleFilePart
object based on the value ofxrefpart
. For use in combination withFrom
objects.Return
self
if one of the following is true:xrefpart
equalsv
v
is callable andv(self.get_xrefpart()
isTrue
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 andNone
otherwise.Return type: EagelFilePart
orNone
Segment¶
-
class
Swoop.
Segment
[source]¶ Bases:
Swoop.Swoop.EagleFilePart
Class representing the contents of a <segment> tag in Eagle files.
Attributes:
Collections:
pinref
: List ofPinref
objects.portref
: List ofPortref
objects.wire
: List ofWire
objects.junction
: List ofJunction
objects.label
: List ofLabel
objects.
-
add_junction
(s)[source]¶ Add a
Junction
to thejunctions
of thisSegment
.Parameters: s – The Junction
to add.Return type: self
-
add_label
(s)[source]¶ Add a
Label
to thelabels
of thisSegment
.Parameters: s – The Label
to add.Return type: self
-
add_pinref
(s)[source]¶ Add a
Pinref
to thepinrefs
of thisSegment
.Parameters: s – The Pinref
to add.Return type: self
-
add_portref
(s)[source]¶ Add a
Portref
to theportrefs
of thisSegment
.Parameters: s – The Portref
to add.Return type: self
-
add_wire
(s)[source]¶ Add a
Wire
to thewires
of thisSegment
.Parameters: s – The Wire
to add.Return type: self
-
clear_junctions
()[source]¶ Remove all the
Junction
objects from thejunctions
of thisSegment
.Return type: self
-
clear_labels
()[source]¶ Remove all the
Label
objects from thelabels
of thisSegment
.Return type: self
-
clear_pinrefs
()[source]¶ Remove all the
Pinref
objects from thepinrefs
of thisSegment
.Return type: self
-
clear_portrefs
()[source]¶ Remove all the
Portref
objects from theportrefs
of thisSegment
.Return type: self
-
clone
()[source]¶ Recursively clone this
Segment
. It will be identical to the original, but it’s parent will beNone
.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_junctions
(attrs=None, type=None)[source]¶ Return (and possibly filter) items in the the
junctions
list ofJunction
objects for thisSegment
.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 notNone
, 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
objectsReturn type: List of
Junction
objects
-
get_labels
(attrs=None, type=None)[source]¶ Return (and possibly filter) items in the the
labels
list ofLabel
objects for thisSegment
.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 notNone
, 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
objectsReturn type: List of
Label
objects
-
get_nth_junction
(n)[source]¶ get then nth
Junction
object from thejunctions
of thisSegment
.Parameters: n – Index of the item to return. Return type: Junction
object
-
get_nth_label
(n)[source]¶ get then nth
Label
object from thelabels
of thisSegment
.Parameters: n – Index of the item to return. Return type: Label
object
-
get_nth_pinref
(n)[source]¶ get then nth
Pinref
object from thepinrefs
of thisSegment
.Parameters: n – Index of the item to return. Return type: Pinref
object
-
get_nth_portref
(n)[source]¶ get then nth
Portref
object from theportrefs
of thisSegment
.Parameters: n – Index of the item to return. Return type: Portref
object
-
get_nth_wire
(n)[source]¶ get then nth
Wire
object from thewires
of thisSegment
.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 ofPinref
objects for thisSegment
.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 notNone
, 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
objectsReturn type: List of
Pinref
objects
-
get_portrefs
(attrs=None, type=None)[source]¶ Return (and possibly filter) items in the the
portrefs
list ofPortref
objects for thisSegment
.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 notNone
, 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
objectsReturn type: List of
Portref
objects
-
get_wires
(attrs=None, type=None)[source]¶ Return (and possibly filter) items in the the
wires
list ofWire
objects for thisSegment
.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 notNone
, 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
objectsReturn 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 thejunctions
of thisSegment
.Parameters: efp – The Junction
object to remove.Return type: self
-
remove_label
(efp)[source]¶ Remove a
Label
from thelabels
of thisSegment
.Parameters: efp – The Label
object to remove.Return type: self
-
remove_pinref
(efp)[source]¶ Remove a
Pinref
from thepinrefs
of thisSegment
.Parameters: efp – The Pinref
object to remove.Return type: self