graviti.portex.ptype
#
Parameter type releated classes.
Module Contents#
Classes#
The base class of parameter type. |
|
Unconstrained parameter type. |
|
Parameter type for JSON Boolean. |
|
Parameter type for JSON Array. |
|
Parameter type for JSON object. |
|
Parameter type for JSON number. |
|
Parameter type for JSON integer. |
|
Parameter type for JSON string. |
|
Parameter type for Portex enum values. |
|
Parameter type for Portex record fields. |
|
Parameter type for Portex type. |
Attributes#
- class graviti.portex.ptype.ParameterType[source]#
The base class of parameter type.
- static load(content, _=None)[source]#
Create an instance of the parameter type from the python content.
- Parameters
content (Any) – A python presentation of the parameter type.
_ (Optional[graviti.portex.package.Imports]) – The imports of the parameter type.
- Returns
An instance of the parameter type.
- Return type
- class graviti.portex.ptype.Any[source]#
Bases:
ParameterType
Unconstrained parameter type.
- class graviti.portex.ptype.Enum[source]#
Bases:
ParameterType
Parameter type for Portex enum values.
- static check(arg)[source]#
Check and transfer the parameter type.
- Parameters
arg (Any) – The argument which needs to be checked.
- Returns
A list of enum values created by the input argument.
- Return type
- static load(content, _=None)[source]#
Create Portex EnumValues instance from python object.
- Parameters
content (Union[Dict[int, graviti.portex.enum.EnumValueType], List[graviti.portex.enum.EnumValueType], None]) – A python list or dict representing a EnumValues.
_ (Optional[graviti.portex.package.Imports]) – The imports of the Portex field.
- Returns
A Portex EnumValues instance created from the input python list or dict.
- Raises
TypeError – When the input enum values is not in list or dict format.
- Return type
Optional[graviti.portex.enum.EnumValues]
- static dump(arg)[source]#
Dump the input Portex EnumValues instance to a python list or dict.
- Parameters
arg (graviti.portex.enum.EnumValues) – A Portex EnumValues instance.
- Returns
A Python list or dict representation of the Portex enum values.
- Return type
Union[Dict[int, graviti.portex.enum.EnumValueType], List[graviti.portex.enum.EnumValueType]]
- class graviti.portex.ptype.Fields[source]#
Bases:
ParameterType
Parameter type for Portex record fields.
- static check(arg)[source]#
Check and transfer the parameter type.
- static load(content, imports=None)[source]#
Create Portex field list instance from python list.
- Parameters
content (Optional[List[Any]]) – A python list representing a Portex field list.
imports (Optional[graviti.portex.package.Imports]) – The imports of the Portex field.
- Returns
A Portex field list instance created from the input python list.
- Return type
- static dump(arg)[source]#
Dump the input Portex field list instance to a python list.
- Parameters
arg (graviti.portex.field.Fields) – A Portex field list instance.
- Returns
A Python list representation of the Portex field list.
- Return type
List[Any]
- class graviti.portex.ptype.PortexType[source]#
Bases:
ParameterType
Parameter type for Portex type.
- static check(arg)[source]#
Check the parameter type.
- Parameters
arg (Any) – The argument which needs to be checked.
- Returns
The input argument unchanged.
- Raises
TypeError – When the input argument is not a Portex type.
- Return type
- static load(content, imports=None)[source]#
Create Portex type instance from python dict.
- Parameters
content (Optional[Dict[str, Any]]) – A python dict representing a Portex type.
imports (Optional[graviti.portex.package.Imports]) – The imports of the Portex type.
- Returns
A Portex type instance created from the input python dict.
- Return type
Optional[graviti.portex.base.PortexType]
- static dump(arg)[source]#
Dump the instance to a python dict.
- Parameters
arg (graviti.portex.base.PortexType) – A Portex type instance.
- Returns
A python dict representation of the Portex type.
- Return type
Dict[str, Any]