Expressions module
This module implements parameterizable strings for use within experiment spec.
Expressions employ self
variable, which corresponds to the currently executing stage.
See also yaml_loader.py
module for more implementation details.
- class Expression(value, pattern=re.compile('\\$\\{([^}^{]+)\\}'), ctx=None, doc=None)[исходный код]
Базовые классы:
object
Implements a parameterizable string which values are computed at runtime from the currently available parameters in the context
- to_json()[исходный код]
- class defaultdict_v2(*args, default=None, **kwargs)[исходный код]
Базовые классы:
dict
- eval_ctx(p, ctx=None, doc=None)[исходный код]
Evaluates an expression
p
in contextctx
The following variables are available for expressions:
env
: adict
that includesos.environ
andMLDevSettings().environ
if a key is missing,None
is returned to expression_
: a context object
These functions are available for expressions:
json(o)
: converts its argumento
to json stringpath(p)
: expands its argument to an absolute pathparams(dict)
: converts dict to a sequence of--<key> <value>
pairs
See
_EVAL_FUNCTIONS
- Параметры
ctx – context to evaluate
p
p – expression to evaluate
- Результат
result of evaluation