pyflightstream.cases.selection (provisional)¶
Generated from the docstrings at build time: every one of the 5 names in the __all__ of pyflightstream.cases.selection has an entry below. The names a guide or an example uses come first; the others follow under Advanced.
The selection of families and aliases: which surfaces an entry names.
Pipeline role: reads a selector word, an alias of the setup or a family name
against a row's inventory. :func:select_families expands the selectors,
:func:resolve_alias and :data:BoundaryAliases resolve the setup's aliases,
and :func:select_group_members lists the members of a plot or loads group.
The package root re-exports these functions (AD-16). This module reads its errors from
:mod:pyflightstream.cases.reference_blocks and never imports the package root.
Advanced¶
pyflightstream.cases.selection.BoundaryAliases
module-attribute
¶
BoundaryAliases = Annotated[
dict[str, list[str]], AfterValidator(_check_aliases)
]
pyflightstream.cases.selection.EXPANDING_SELECTORS
module-attribute
¶
EXPANDING_SELECTORS = ('all', 'each', 'each_blade')
pyflightstream.cases.selection.resolve_alias
¶
resolve_alias(
token: str,
inventory: Sequence[str],
aliases: Mapping[str, Sequence[str]] | None,
) -> list[str] | None
Resolve one cited name as an alias of the setup, or None when it is not one.
An alias is a name the setup's
[aliases] table gives to a list of boundary names or families,
and it is read wherever a boundary is cited, the exact spelling
first and case folded second, as a family is. Each member resolves as
a name does, an exact name of the inventory first and a family (the
label without its trailing number) second; a member the inventory
does not carry is ignored, which is how one setup serves a wing-body
and a rotor. A NUMBERED member is that exact name and never its
numbered siblings: Hub1 over a mesh carrying Hub2 and Hub3
selects nothing, and is not refused. The names come back in member
order, each once; an alias every member of which is absent resolves to
an empty list, and
the caller says what that means for its key.
A member may be another alias, and the reader follows it to the end. A member the inventory carries is that boundary first, whatever else shares its spelling.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
token
|
str
|
The cited name. |
required |
inventory
|
sequence of str
|
The boundary names the row's geometry carries. |
required |
aliases
|
mapping of str to sequence of str or None
|
The |
required |
Returns:
| Type | Description |
|---|---|
list of str or None
|
The boundary names the alias resolves to, in member order, each once; None when the name is not an alias of the setup. |
Raises:
| Type | Description |
|---|---|
AliasCycleError
|
If following the members returns to an alias already on the path,
naming both sides. A member that names its OWN alias is not a
ring: it falls back to the FAMILY reading, exactly as it did
before aliases could nest, so |
pyflightstream.cases.selection.select_families
¶
select_families(
selection: str | Sequence[str],
inventory: Sequence[str],
is_blade: Callable[[str], bool],
aliases: Mapping[str, Sequence[str]] | None = None,
*,
strict: bool = True,
) -> list[list[str]]
Expand one families entry over the geometry's inventory.
The selectors and each give inventory order; a literal list or an alias keeps the order
in which its members were written.
Returns a list of family lists, one per emitted entry: a single list
for a selector or a literal list, one list per family for each
and each_blade. A family the geometry does not carry is left out,
as the reference driver filtered its tables to the components it opened; an
entry that resolves to nothing is an empty result and the caller
skips it. all is the empty list standing for the command's own
every-boundary form, which the caller spells as -1; as a list member it
adds every surface of the inventory. A cited word is read as a
[groups] member is: an exact boundary name of the inventory first,
then an ALIAS of the row's setup,
then a family, and only then as a selector word (all, each and
each_blade, which this function expands, and the retired airframe
and blades), as the bare string and as a list member. So an exact
boundary wins over an alias of the same spelling, and airframe and
blades are the setup's own where it defines them and refused as
selectors where it does not.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
selection
|
str or sequence of str
|
The entry's |
required |
inventory
|
sequence of str
|
The boundary names the row's geometry carries, in its order. |
required |
is_blade
|
callable
|
Whether a boundary name is a blade's. |
required |
aliases
|
mapping of str to sequence of str
|
The |
None
|
strict
|
bool
|
Refuse, at plan, a numbered boundary the entry cites ALONE (a bare word, or a list of that one word) that the geometry lacks while it carries the family; False warns and skips it in post. A member of a longer list or of an alias selects its exact name only and is never refused here: one the geometry lacks is the caller's to warn about (FR-320) or refuse (FR-435). |
True
|
Returns:
| Type | Description |
|---|---|
list of list of str
|
One family list per emitted entry; empty when the entry resolves to nothing. |
pyflightstream.cases.selection.select_group_members
¶
select_group_members(
members: Sequence[int | str],
inventory: Sequence[str],
aliases: Mapping[str, Sequence[str]] | None = None,
*,
strict: bool = True,
) -> list[str]
Resolve one [groups] entry's members against an inventory, in member order.
An EMPTY group is every
name of the inventory. Otherwise each member is, tried in this order,
an exact name of the inventory; an ALIAS of the row's setup
(:func:resolve_alias), so airframe and blades are whatever
the setup says and nothing is hardcoded; or a FAMILY, the label
without its trailing number, selecting every member of it the
inventory carries (Blade is Blade1 to Blade6). A member
resolving to nothing is left out, which is how one artifact serves a
wing-body and an isolated rotor; a POSITION is not a name and is left
to the caller, which is the motion path that has an index to give it.
The inventory is whatever the caller judges by: the boundary labels
of the opened file on the script path, the surface rows of the loads
table at products time.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
members
|
sequence of int or str
|
The group's members as written; a position is left to the caller. |
required |
inventory
|
sequence of str
|
The names the caller judges by. |
required |
aliases
|
mapping of str to sequence of str
|
The |
None
|
strict
|
bool
|
Refuse, during planning, a numbered boundary a ONE-MEMBER entry cites (a matrix cell's reading) that the geometry lacks while it carries the family. Post-processing passes False to warn and leave it out instead. A member of a longer entry selects its exact name only and is left out without a refusal (FR-320, FR-435). |
True
|
Returns:
| Type | Description |
|---|---|
list of str
|
The selected names, in member order, each once. |