PynamoDB
PynamoDB copied to clipboard
How to type annotate `foo = MapAttribute(…)`?
Given strict mypy settings, in particular disallow_any_generics, and a requirement to pass pylint, how should I type annotate a MapAttribute?
details: MapAttribute[str, str] = MapAttribute(null=True)results in "E1136: Value 'MapAttribute' is unsubscriptable (unsubscriptable-object)" frompylintdetails: MapAttribute = MapAttribute(null=True)instead results in 'Missing type parameters for generic type "MapAttribute" [type-arg]' frommypy
Workaround: Use the second version above with a # type: ignore[type-arg] annotation.