|
The
Groups
module provides utilities to generate lists of
group AtomMaps, selected according to various
criteria.
The
Groups
module is located in Yup.Tools. Thus, the required
import statement is some variant of:
from
Yup.Tools.Groups import
*.
All
the following functions return a flat list of group
AtomMaps. The AtomMaps are obtained from the
specified parent AtomMap and recursively from any
group AtomMaps within the parent AtomMap. The
AtomMap is traversed depth-first and from left to
right starting from the parent AtomMap:
|
EveryGroup()
|
All
groups are selected.
|
|
MatchedGroups()
|
Groups
whose name match the given group name
pattern are selected.
|
|
GroupsWithAtoms()
|
Groups
that contain at least one atom are
selected.
|
The
EveryGroup()
function searches in the given parent AtomMap and
recursively in any group AtomMaps. The search is
depth-first from left to right. Any group AtomMap
that is found is appended to a list which is then
returned as a tuple. The parent group itself is not
included.
|
Function
Name
|
Number
of Arguments
|
Return
Value
|
|
EveryGroup
|
1
|
Tuple
of group AtomMap
|
|
Argument
|
Type
|
Preset
Value
|
|
parent
|
AtomMap
|
-
|
If
parent is an atom AtomMap, the return value
is None.
The
MatchedGroups()
function searches in the same places as
EveryGroup(), looking for group AtomMaps with names
that match the given pattern.
|
Function
Name
|
Number
of Arguments
|
Return
Value
|
|
MatchedGroups
|
2
|
Tuple
of group AtomMap
|
|
Argument
|
Type
|
Preset
Value
|
|
parent
|
AtomMap
|
-
|
|
pattern
|
string
|
r'.+'
|
If
the parent argument contains an atom
AtomMap, the return value is None.
The
preset value of the pattern argument is a
raw string that matches a non-empty string of any
character except for newline. This argument must
contain a regular expression and should most likely
be expressed as a raw string.
The
GroupsWithAtoms()
function searches in the same places as
EveryGroup(), returning a list of group AtomMaps
that contain at least one atom AtomMap.
|
Method
Name
|
Number
of Arguments
|
Return
Value
|
|
GroupsWithAtoms
|
1
|
Tuple
of group AtomMap
|
|
Argument
|
Type
|
Preset
Value
|
|
parent
|
AtomMap
|
-
|
If
the parent argument contains an atom
AtomMap, the return value is None.
|