StructuredType
Represents a structured type with a defined calculus to simplify the construction of combined types when writing parsers that take multi-typed data
Supports a compound StructuredType where the types are keyed
Properties and Methods
__init__(self, base_type, shape=None, is_alternative=False, is_optional=False, default_value=None):
@property
is_simple(self):
add_types(self, other):
Constructs a new type by treating the two objects as siblings, that is if they can be merged due to type and shape similarity they will be, otherwise a non-nesting structure will be constructed from them
We'll also want a nesting version of this I'm guessing, which probably we hook into __call__ - `other`: `Any`
>No description... - `:returns`: `_`
>No description...
__add__(self, other):
compound_types(self, other):
Creates a structured type where rather than merging types they simply compound onto one another
other
:Any
No description…
:returns
:_
No description…
__call__(self, other):
repeat(self, n=None, m=None):
Returns a new version of the type, but with the appropriate shape for being repeated n-to-m times
n
:Any
No description…
m
:Any
No description…
:returns
:_
No description…
drop_axis(self, axis=0):
Returns a new version of the type, but with the appropriate shape for dropping an axis
axis
:int
No description…
:returns
:_
No description…
extend_shape(self, base_shape):
Extends the shape of the type such that base_shape precedes the existing shape
base_shape
:Any
No description…
:returns
:_
No description…
__repr__(self):
Examples
Edit Examples or
Create New Examples
Edit Template or
Create New Template
Edit Docstrings