class documentation
class LiteralType(ProperType): (source)
The type of a Literal instance. Literal[Value] A Literal always consists of: 1. A native Python object corresponding to the contained inner value 2. A fallback for this Literal. The fallback also corresponds to the parent type this Literal subtypes. For example, 'Literal[42]' is represented as 'LiteralType(value=42, fallback=instance_of_int)' As another example, `Literal[Color.RED]` (where Color is an enum) is represented as `LiteralType(value="RED", fallback=instance_of_color)'.
Class Method | deserialize |
Undocumented |
Method | __eq__ |
Undocumented |
Method | __hash__ |
Undocumented |
Method | __init__ |
Undocumented |
Method | accept |
Undocumented |
Method | can |
Undocumented |
Method | can |
Undocumented |
Method | is |
Undocumented |
Method | is |
Undocumented |
Method | serialize |
Undocumented |
Method | value |
Returns the string representation of the underlying type. |
Class Variable | __slots__ |
Undocumented |
Instance Variable | fallback |
Undocumented |
Instance Variable | value |
Undocumented |
Instance Variable | _hash |
Undocumented |
Inherited from Type
(via ProperType
):
Method | __repr__ |
Undocumented |
Method | can |
Undocumented |
Method | can |
Undocumented |
Property | can |
Undocumented |
Property | can |
Undocumented |
Instance Variable | _can |
Undocumented |
Instance Variable | _can |
Undocumented |
Inherited from Context
(via ProperType
, Type
):
Method | set |
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 |
Undocumented |
Instance Variable | end |
Undocumented |
Instance Variable | line |
Undocumented |
def __init__(self, value:
LiteralValue
, fallback: Instance
, line: int
= -1, column: int
= -1):
(source)
¶
overrides
mypy.types.Type.__init__
Undocumented