class documentation

class UnionType(ProperType): (source)

View In Hierarchy

The union type Union[T1, ..., Tn] (at least one type argument).
Class Method deserialize Undocumented
Static Method make​_union Undocumented
Method __eq__ Undocumented
Method __hash__ Undocumented
Method __init__ Undocumented
Method accept Undocumented
Method has​_readable​_member For a tree of unions of instances, check whether all instances have a given member.
Method length Undocumented
Method relevant​_items Removes NoneTypes from Unions when strict Optional checking is off.
Method serialize Undocumented
Class Variable __slots__ Undocumented
Instance Variable can​_be​_false Undocumented
Instance Variable can​_be​_true Undocumented
Instance Variable is​_evaluated Undocumented
Instance Variable items Undocumented
Instance Variable uses​_pep604​_syntax Undocumented

Inherited from Type (via ProperType):

Method __repr__ Undocumented
Method can​_be​_false​_default Undocumented
Method can​_be​_true​_default Undocumented

Inherited from Context (via ProperType, Type):

Method get​_column Don't use. Use x.column.
Method get​_line Don't use. Use x.line.
Method set​_line If target is a node, pull line (and column) information into this node. If column is specified, this will override any column information coming from a node.
Instance Variable column Undocumented
Instance Variable end​_line Undocumented
Instance Variable line Undocumented
@classmethod
def deserialize(cls, data): (source)

Undocumented

Parameters
data:JsonDictUndocumented
Returns
UnionTypeUndocumented
@staticmethod
def make_union(items, line=-1, column=-1): (source)

Undocumented

Parameters
items:Sequence[Type]Undocumented
line:intUndocumented
column:intUndocumented
Returns
TypeUndocumented
def __eq__(self, other): (source)

Undocumented

Parameters
other:objectUndocumented
Returns
boolUndocumented
def __hash__(self): (source)

Undocumented

Returns
intUndocumented
def __init__(self, items, line=-1, column=-1, is_evaluated=True, uses_pep604_syntax=False): (source)

Undocumented

Parameters
items:Sequence[Type]Undocumented
line:intUndocumented
column:intUndocumented
is​_evaluated:boolUndocumented
uses​_pep604​_syntax:boolUndocumented
def accept(self, visitor): (source)

Undocumented

Parameters
visitor:TypeVisitor[T]Undocumented
Returns
TUndocumented
def has_readable_member(self, name): (source)

For a tree of unions of instances, check whether all instances have a given member.

TODO: Deal with attributes of TupleType etc. TODO: This should probably be refactored to go elsewhere.

Parameters
name:strUndocumented
Returns
boolUndocumented
def length(self): (source)

Undocumented

Returns
intUndocumented
def relevant_items(self): (source)
Removes NoneTypes from Unions when strict Optional checking is off.
Returns
List[Type]Undocumented
def serialize(self): (source)

Undocumented

Returns
JsonDictUndocumented
__slots__: tuple[str, ...] = (source)

Undocumented

can_be_false = (source)

Undocumented

can_be_true = (source)

Undocumented

is_evaluated = (source)

Undocumented

items = (source)

Undocumented

uses_pep604_syntax = (source)

Undocumented