cosapp.utils.naming

Functions

has_time(expression)

Checks if an expression contains 't'

natural_varname(name)

Strip references to common port names from variable name

Classes

CommonPorts(value[, names, module, ...])

Port names common to every system.

NameChecker([pattern, message, excluded])

Class handling admissible names, through regular expression filtering

class cosapp.utils.naming.CommonPorts(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: Enum

Port names common to every system.

INWARDS : For orphan input variables OUTWARDS : For orphan output variables MODEVARS_IN : For orphan input mode variables MODEVARS_OUT : For orphan output mode variables

INWARDS = 'inwards'
MODEVARS_IN = 'modevars_in'
MODEVARS_OUT = 'modevars_out'
OUTWARDS = 'outwards'
classmethod names() Set[str][source]

Returns common port names as a set.

class cosapp.utils.naming.NameChecker(pattern='^[A-Za-z][\\w]*$', message="Name must start with a letter, and contain only alphanumerics and '_'", excluded: List[str] = [])[source]

Bases: object

Class handling admissible names, through regular expression filtering

property excluded: Tuple[str]
is_valid(name: str) bool[source]

Method indicating whether or not a name is valid, under the current rule

property message: str

Returns a human-readable message, transcripted from regexp rule

property pattern: str
classmethod reserved() List[str][source]

List of reserved names

cosapp.utils.naming.has_time(expression: Any) bool[source]

Checks if an expression contains ‘t’

cosapp.utils.naming.natural_varname(name: str) str[source]

Strip references to common port names from variable name