graviti.portex.base
#
The base elements of Portex type.
Module Contents#
Classes#
The base class of portex type. |
Functions#
Attributes#
- class graviti.portex.base.PortexType[source]#
The base class of portex type.
- get_keys(self, _=None)[source]#
Get the keys to locate the data.
- Returns
The keys to locate the data.
- Parameters
_ (Optional[str]) –
- Return type
List[Tuple[str, Ellipsis]]
- property imports(self)[source]#
Get the PortexType imports.
- Returns
The
Imports
instance of this PortexType.- Return type
- classmethod from_pyobj(cls, content, _imports=None)[source]#
Create Portex type instance from python dict.
- Parameters
content (Dict[str, Any]) – A python dict representing a Portex type.
cls (Type[_T]) –
_imports (Optional[graviti.portex.package.Imports]) –
- Returns
A Portex type instance created from the input python dict.
- Return type
_T
- classmethod from_pyarrow(cls, pyarrow_type)[source]#
Create Portex type instance from PyArrow type.
- Parameters
pyarrow_type (pyarrow.DataType) – The PyArrow type.
- Raises
TypeError – When the PyArrow type is not supported.
- Returns
The created Portex type instance.
- Return type
- classmethod from_json(cls, content)[source]#
Create Portex type instance from JSON string.
- Parameters
content (str) – A JSON string representing a Portex type.
- Returns
A Portex type instance created from the input JSON string.
- Return type
- classmethod from_yaml(cls, content)[source]#
Create Portex type instance from YAML string.
- Parameters
content (str) – A YAML string representing a Portex type.
- Returns
A Portex type instance created from the input YAML string.
- Return type
- to_pyobj(self, _with_imports=True)[source]#
Dump the instance to a python dict.
- Returns
A python dict representation of the Portex type.
- Parameters
_with_imports (bool) –
- Return type
Dict[str, Any]
- to_json(self)[source]#
Dump the instance to a JSON string.
- Returns
A JSON representation of the Portex type.
- Return type
str
- to_yaml(self)[source]#
Dump the instance to a YAML string.
- Returns
A YAML representation of the Portex type.
- Return type
str
- graviti.portex.base.read_yaml(path)[source]#
Read a yaml file into Portex type.
- Parameters
path (graviti.utility.PathLike) – The path of the yaml file.
- Returns
A Portex type instance created from the input yaml file.
- Return type