You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a MapAttribute is defined with an attribute of ListAttribute(of=NumberAttribute), mypy does not recognize the individual elements of the ListAttribute as float. This is not an issue with MapAttributes defined with NumberAttributes.
Example
class ExampleAttribute(MapAttribute):
ids = ListAttribute(null=False, of=NumberAttribute)
# mypy complains
# No overload variant of "int" matches argument type "NumberAttribute"mypycall-overload
example = ExampleAttribute()
result = [int(x) for x in example.ids]
# reveal_type(x) : NumberAttribute
class MapWithNumber(MapAttribute):
x = NumberAttribute()
# no issues
m = MapWithNumber()
int(m.x)
When a MapAttribute is defined with an attribute of
ListAttribute(of=NumberAttribute)
, mypy does not recognize the individual elements of the ListAttribute as float. This is not an issue with MapAttributes defined with NumberAttributes.Example
pynamodb version: pynamodb==5.5.0
mypy version: 1.8.0
python: 3.9.16
The text was updated successfully, but these errors were encountered: