mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-21 19:32:13 +08:00
Treat all pynamodb Numbers as floats (#1895)
Previously we specified this as a Union type, which caused more problems than it helped with, namely when reading data off a Pynamo property We still had to cast to the appropriate type. Pynamo simply reads the type out of Dynamo, which more closely models a float as it can be an int or a float - https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/HowItWorks.NamingRulesDataTypes.html
This commit is contained in:
committed by
Jelle Zijlstra
parent
37ec012113
commit
0f36f7ea09
9
third_party/2and3/pynamodb/attributes.pyi
vendored
9
third_party/2and3/pynamodb/attributes.pyi
vendored
@@ -6,7 +6,6 @@ _T = TypeVar('_T')
|
||||
_KT = TypeVar('_KT')
|
||||
_VT = TypeVar('_VT')
|
||||
_MT = TypeVar('_MT', bound='MapAttribute')
|
||||
Number = Union[int, float]
|
||||
|
||||
class Attribute(Generic[_T]):
|
||||
attr_name: Optional[Text]
|
||||
@@ -48,11 +47,11 @@ class LegacyBooleanAttribute(Attribute[bool]):
|
||||
class BooleanAttribute(Attribute[bool]):
|
||||
def __get__(self, instance: Any, owner: Any) -> bool: ...
|
||||
|
||||
class NumberSetAttribute(SetMixin, Attribute[Set[Number]]):
|
||||
def __get__(self, instance: Any, owner: Any) -> Set[Number]: ...
|
||||
class NumberSetAttribute(SetMixin, Attribute[Set[float]]):
|
||||
def __get__(self, instance: Any, owner: Any) -> Set[float]: ...
|
||||
|
||||
class NumberAttribute(Attribute[Number]):
|
||||
def __get__(self, instance: Any, owner: Any) -> Number: ...
|
||||
class NumberAttribute(Attribute[float]):
|
||||
def __get__(self, instance: Any, owner: Any) -> float: ...
|
||||
|
||||
class UTCDateTimeAttribute(Attribute[datetime]):
|
||||
def __get__(self, instance: Any, owner: Any) -> datetime: ...
|
||||
|
||||
Reference in New Issue
Block a user