Node

The Node class is the base class of all devices-this includes variables, commands, and more.

Node Class Description

class pyrogue.Node(*, name, description='', expand=True, hidden=False, groups=None, guiGroup=None)[source]

Class which serves as a managed object within the pyrogue package. Each node has the following public fields:

name: Global name of object description: Description of the object. groups: Group or groups this node belongs to.

Examples: ‘Hidden’, ‘NoState’, ‘NoConfig’, ‘NoStream’, ‘NoSql’, ‘NoServe’

classtype: text string matching name of node sub-class path: Full path to the node (ie. node1.node2.node3)

Each node is associated with a parent and has a link to the top node of a tree. A node has a list of sub-nodes as well as each sub-node being attached as an attribute. This allows tree browsing using: node1.node2.node3

Parameters:
  • name – global name of object

  • description – Description of object

  • path – full path to the node (ie. node1.node2.node3)

  • expand

  • guiGroup – arbitrary groups for gui and graphical aesthetic purposes

property name

assigns and returns name attribute to class variable

property description

assigns and returns description attribute to class variable

property groups

assigns and returns groups attribute to class variable

inGroup(group)[source]
Parameters:

group

filterByGroup(incGroups, excGroups)[source]

Filter by the passed list of inclusion and exclusion groups

Parameters:
  • incGroups – list of passed inclusion groups

  • excGroups – list of passed exclusion groups

addToGroup(group)[source]

Add this node to the passed group, recursive to children

Parameters:

group – variable denoting a node that has not been passed

removeFromGroup(group)[source]

Remove this node from the passed group, not recursive

Parameters:

group – variable denoting a node that is in the passed group

Return type:

if in group, remove from group

property hidden

assigns and returns hidden attribute to class variable

add(node)[source]

Add node as sub-node

Parameters:

node

addNode(nodeClass, **kwargs)[source]
Parameters:
  • nodeClass

  • **kwargs

addNodes(nodeClass, number, stride, **kwargs)[source]
Parameters:
  • nodeClass

  • number

  • stride

  • **kwargs

property nodeList

Get a recursive list of nodes.

getNodes(typ, excTyp=None, incGroups=None, excGroups=None)[source]

Get a filtered ordered dictionary of nodes. pass a class type to receive a certain type of node class type may be a string when called over Pyro4 exc is a class type to exclude, incGroups is an optional group or list of groups that this node must be part of excGroups is an optional group or list of groups that this node must not be part of

Parameters:
  • typ

  • excTyp – (Default value = None)

  • incGroups – (Default value = None)

  • excGroups – (Default value = None)

Return type:

ordered dictionary of nodes

property nodes

Get a ordered dictionary of all nodes.

variablesByGroup(incGroups=None, excGroups=None)[source]
Parameters:
  • incGroups – (Default value = None)

  • excGroups – (Default value = None)

Returns:

Pass list of include and / or exclude groups

Return type:

type

property variableList

Get a recursive list of variables and commands.

commandsByGroup(incGroups=None, excGroups=None)[source]
Parameters:
  • incGroups – (Default value = None)

  • excGroups – (Default value = None)

Returns:

Pass list of include and / or exclude groups

Return type:

type

devicesByGroup(incGroups=None, excGroups=None)[source]
Parameters:
  • incGroups – (Default value = None)

  • excGroups – (Default value = None)

Returns:

Pass list of include and / or exclude groups

Return type:

type

property deviceList

Get a recursive list of devices

node(name)[source]
Parameters:

name

find(*, recurse=True, typ=None, **kwargs)[source]

Find all child nodes that are a base class of ‘typ’ and whose properties match all of the kwargs. For string properties, accepts regexes.

Parameters:
  • *

  • recurse – (Default value = True)

  • typ – (Default value = None)

  • **kwargs

callRecursive(func, nodeTypes=None, **kwargs)[source]
Parameters:
  • func

  • nodeTypes – (Default value = None)

  • **kwargs

makeRecursive(func, nodeTypes=None)[source]
Parameters:
  • func

  • nodeTypes – (Default value = None)

isinstance(typ)[source]
Parameters:

typ

getYaml(readFirst=False, modes=['RW', 'RO', 'WO'], incGroups=None, excGroups=['Hidden'], recurse=True)[source]

Get current values as yaml data. modes is a list of variable modes to include. If readFirst=True a full read from hardware is performed.

nodeMatch(name)[source]
Parameters:

name

Returns:

be a single value or a list accessor: value value[9] value[0:1] value[*] value[:] Variables will only match if their depth matches the passed lookup and wildcard: value[*] will match a variable named value[1] but not a variable named value[2][3] value[*][*] will match a variable named value[2][3]. The second return field will contain the array information if the base name matches an item in the non list array.

Return type:

type