cosapp.utils.parsing¶
Functions
|
Decompose a variable specification into its name and its mask. |
|
Extension of str.split, accounting for more than one split separators. |
-
cosapp.utils.parsing.get_indices(syst: cosapp.core.module.Module, name: str) → Tuple[str, Optional[numpy.ndarray]][source]¶ Decompose a variable specification into its name and its mask.
- Parameters
syst (Module) – Module to which belong the variable
name (str) – Variable specification
- Returns
Tuple (variable name, variable mask or None)
- Return type
Tuple[str, Optional[numpy.ndarray[bool]]]
-
cosapp.utils.parsing.multi_split(expression: str, separators: List[str]) → Tuple[List[str], List[str]][source]¶ Extension of str.split, accounting for more than one split separators.
- expression [str]:
Expression to be split.
- separators [List[str]]:
List of separators.
- expressions [List[str]]:
List of n split expressions.
- separators [List[str]]:
Sequence of (n - 1) separators between split expressions.
>>> multi_split('a+b-c-d+e', list('+-')) ['a', 'b', 'c', 'd', 'e'], ['+', '-', '-', '+']