cosapp.utils.find_variables

Functions

find_system_properties(system[, include_const])

Returns system properties, defined either as class properties (with @property decorator), or with System.add_property.

find_variables(watched_object, includes, …)

Generate the list of requested variables.

get_attributes(obj)

Returns non-callable members of an object

make_wishlist(wishlist[, name])

cosapp.utils.find_variables.find_system_properties(system, include_const=False)Set[str][source]

Returns system properties, defined either as class properties (with @property decorator), or with System.add_property. The latter are excluded if optional argument include_const is False (default).

Parameters
  • system [cosapp.systems.System] (-) – System of interest

  • include_const [bool (-) – Defines if read-only properties defined with System.add_property will be accepted or not. Default: False.

  • optional] – Defines if read-only properties defined with System.add_property will be accepted or not. Default: False.

Returns

Set of property names.

Return type

  • Set[str]

cosapp.utils.find_variables.find_variables(watched_object: cosapp.systems.System, includes: Union[str, List[str]], excludes: Union[str, List[str]], advanced_filter: Callable[[Any], bool] = <function <lambda>>, inputs: bool = True, outputs: bool = True, include_const: bool = False)List[str][source]

Generate the list of requested variables.

The variables are sorted in alphabetical order.

Parameters
  • watched_object (cosapp.systems.System) – Object that owns the variables searched

  • includes (str or List[str]) – Variables matching these patterns will be included

  • excludes (str or List[str]) – Variables matching these patterns will be excluded

  • advanced_filter (Callable[[Any], bool]) – Function taking the variable as input and returning an acceptance criteria (True if variable is valid)

  • inputs (bool) – Defines if input variables will be accepted or not

  • outputs (bool) – Defines if output variables will be accepted or not

  • include_const (bool) – Defines if read-only properties defined with System.add_property will be accepted or not

Returns

  • List[str] – Variable names matching the includes/excludes patterns of the user in the watched object.

  • .. note:: – Inward and outward variables will appear without the prefix inwards. or outwards..

cosapp.utils.find_variables.get_attributes(obj)Set[str][source]

Returns non-callable members of an object

cosapp.utils.find_variables.make_wishlist(wishlist: Union[str, List[str]], name='wishlist')List[str][source]