Closed JSAbrahams closed 1 year ago
When building a context from Python source, if a class-level variable is not assigned to then type annotations are ignored.
class MyClass: a: int def __init__(self): pass
Field a does not have a type.
a
However, when we build a context from:
class MyClass: a: int = 10 def __init__(self): pass
Field a does have type Int.
Int
Field a should be an Int in both cases.
This appears to be an issue with the underlying python parsing library python-parser-0.1.0.:
python-parser-0.1.0
a: 10
Assignment
a: 10 = 10
TypedAssgnment
See #319 , this is invalid Python code
Description of Bug
When building a context from Python source, if a class-level variable is not assigned to then type annotations are ignored.
How to Reproduce
Field
a
does not have a type.However, when we build a context from:
Field
a
does have typeInt
.Expected behavior
Field
a
should be anInt
in both cases.Additional context
This appears to be an issue with the underlying python parsing library
python-parser-0.1.0
.:a: 10
is parsed as anAssignment
a: 10 = 10
is parsed as anTypedAssgnment