graviti.portex.param
#
Parameter releated classes.
Module Contents#
Classes#
Functions#
|
The factory function of Param. |
- graviti.portex.param.param(default=Parameter.empty, options=None, ptype=PTYPE.Any)[source]#
The factory function of Param.
- class graviti.portex.param.Param(name, default=_empty, options=None, ptype=PTYPE.Any)[source]#
Bases:
inspect.Parameter
Represents a parameter of a portex type.
- Parameters
- classmethod from_pyobj(cls, pyobj, ptype=PTYPE.Any)[source]#
Create Param instance from python dict.
- property required(self)[source]#
Whether this parameter is a required parameter.
- Returns
True
for required andFalse
for non-required parameter.- Return type
bool
- to_pyobj(self)[source]#
Dump the instance to a python dict.
- Returns
A python dict representation of the Param.
- Return type
Dict[str, Any]
- load(self, content, imports)[source]#
Create an instance of the parameter type from the python content.
- Parameters
content (Any) – A python presentation of the parameter type.
imports (graviti.portex.package.Imports) – The imports of the parameter type.
- Returns
An instance of the parameter type.
- Return type
- class graviti.portex.param.Params(values=None)[source]#
Bases:
graviti.utility.UserMapping
[str
,Param
]Represents all parameters of a portex type.
- to_pyobj(self)[source]#
Dump the instance to a python list.
- Returns
A python list representation of the Params.
- Return type
List[Dict[str, Any]]
- add(self, value)[source]#
Add a parameter.
- Parameters
value (Param) – The parameter which needs to be added to this instance.
- Raises
KeyError – When the parameter name is duplicated.
- Return type
None