graviti.portex.builtin
#
The Portex builtin types.
Module Contents#
Classes#
The base class of Portex builtin type. |
|
Portex primitive type |
|
Portex primitive type |
|
Portex primitive type |
|
Portex primitive type |
|
Portex primitive type |
|
Portex primitive type |
|
Portex primitive type |
|
Portex complex type |
|
Portex complex type |
|
Portex complex type |
|
Portex complex type |
Attributes#
- class graviti.portex.builtin.PortexBuiltinType(nullable=False)[source]#
Bases:
graviti.portex.base.PortexType
The base class of Portex builtin type.
- Parameters
nullable (bool) –
- class graviti.portex.builtin.string(nullable=False)[source]#
Bases:
PortexBuiltinType
Portex primitive type
string
.- Parameters
nullable (bool) – Whether it is a nullable type.
Examples
>>> t = string() >>> t string()
- class graviti.portex.builtin.binary(nullable=False)[source]#
Bases:
PortexBuiltinType
Portex primitive type
binary
.- Parameters
nullable (bool) – Whether it is a nullable type.
Examples
>>> t = binary() >>> t binary()
- class graviti.portex.builtin.boolean(nullable=False)[source]#
Bases:
PortexBuiltinType
Portex primitive type
boolean
.- Parameters
nullable (bool) – Whether it is a nullable type.
Examples
>>> t = boolean() >>> t boolean()
- class graviti.portex.builtin.int32(nullable=False)[source]#
Bases:
PortexBuiltinType
Portex primitive type
int32
.- Parameters
nullable (bool) – Whether it is a nullable type.
Examples
>>> t = int32() >>> t int32()
- class graviti.portex.builtin.int64(nullable=False)[source]#
Bases:
PortexBuiltinType
Portex primitive type
int64
.- Parameters
nullable (bool) – Whether it is a nullable type.
Examples
>>> t = int64() >>> t int64()
- class graviti.portex.builtin.float32(nullable=False)[source]#
Bases:
PortexBuiltinType
Portex primitive type
float32
.- Parameters
nullable (bool) – Whether it is a nullable type.
Examples
>>> t = float32() >>> t float32()
- class graviti.portex.builtin.float64(nullable=False)[source]#
Bases:
PortexBuiltinType
Portex primitive type
float64
.- Parameters
nullable (bool) – Whether it is a nullable type.
Examples
>>> t = float64() >>> t float64()
- class graviti.portex.builtin.record(fields, nullable=False)[source]#
Bases:
PortexBuiltinType
Portex complex type
record
.- Parameters
fields (Union[Iterable[Tuple[str, graviti.portex.base.PortexType]], Mapping[str, graviti.portex.base.PortexType]]) – The fields of the record.
nullable (bool) – Whether it is a nullable type.
Examples
Create a record by dict:
>>> t = record({"f0": int32(), "f1": float32()}) >>> t record( fields={ 'f0': int32(), 'f1': float32(), }, )
Create a record by tuple list:
>>> t = record([("f0", string()), ("f1", enum(["v0", "v1"]))]) >>> t record( fields={ 'f0': string(), 'f1': enum( values=['v0', 'v1'], ), }, )
- class graviti.portex.builtin.enum(values, nullable=False)[source]#
Bases:
PortexBuiltinType
Portex complex type
enum
.- Parameters
values (Iterable[str]) – The values of the enum members.
nullable (bool) – Whether it is a nullable type.
Examples
>>> t = enum(["v0", "v1"]) >>> t enum( values=['v0', 'v1'], )
- class graviti.portex.builtin.array(items, length=None, nullable=False)[source]#
Bases:
PortexBuiltinType
Portex complex type
array
.- Parameters
items (graviti.portex.base.PortexType) – The item type of the array.
length (Optional[int]) – The length of the array.
nullable (bool) – Whether it is a nullable type.
Examples
>>> t = array(int32(0), 100) >>> t array( items=int32( minimum=0, ), length=100, )
- class graviti.portex.builtin.tensor(shape, items, nullable=False)[source]#
Bases:
PortexBuiltinType
Portex complex type
tensor
.- Parameters
shape (Iterable[Optional[int]]) – The shape of the tensor.
items (graviti.portex.base.PortexType) – The item type of the tensor.
nullable (bool) – Whether it is a nullable type.
Examples
>>> t = tensor((3, 3), float64()) >>> t tensor( shape=(3, 3), items=float64(), )