class RawExpressionType(ProperType): (source)
A synthetic type representing some arbitrary expression that does not cleanly translate into a type. This synthetic type is only used at the beginning stages of semantic analysis and should be completely removing during the process for mapping UnboundTypes to actual types: we either turn it into a LiteralType or an AnyType. For example, suppose `Foo[1]` is initially represented as the following: UnboundType( name='Foo', args=[ RawExpressionType(value=1, base_type_name='builtins.int'), ], ) As we perform semantic analysis, this type will transform into one of two possible forms. If 'Foo' was an alias for 'Literal' all along, this type is transformed into: LiteralType(value=1, fallback=int_instance_here) Alternatively, if 'Foo' is an unrelated class, we report an error and instead produce something like this: Instance(type=typeinfo_for_foo, args=[AnyType(TypeOfAny.from_error)) If the "note" field is not None, the provided note will be reported alongside the error at this point. Note: if "literal_value" is None, that means this object is representing some expression that cannot possibly be a parameter of Literal[...]. For example, "Foo[3j]" would be represented as: UnboundType( name='Foo', args=[ RawExpressionType(value=None, base_type_name='builtins.complex'), ], )
Method | __eq__ |
Undocumented |
Method | __hash__ |
Undocumented |
Method | __init__ |
Undocumented |
Method | accept |
Undocumented |
Method | serialize |
Undocumented |
Method | simple |
Undocumented |
Class Variable | __slots__ |
Undocumented |
Instance Variable | base |
Undocumented |
Instance Variable | literal |
Undocumented |
Instance Variable | note |
Undocumented |
Inherited from Type
(via ProperType
):
Class Method | deserialize |
Undocumented |
Method | __repr__ |
Undocumented |
Method | can |
Undocumented |
Method | can |
Undocumented |
Method | can |
Undocumented |
Method | can |
Undocumented |
Method | is |
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 |
LiteralValue|None
, base_type_name: str
, line: int
= -1, column: int
= -1, note: str|None
= None):
(source)
¶
mypy.types.Type.__init__
Undocumented