1 from typing import Any, Callable, Dict, Generic, Iterable, List, Mapping, Optional, Text, Type, TypeVar, Union, Set
\r
3 from datetime import datetime
\r
8 _MT = TypeVar('_MT', bound='MapAttribute')
\r
10 class Attribute(Generic[_T]):
\r
11 attr_name: Optional[Text]
\r
17 def __init__(self, hash_key: bool = ..., range_key: bool = ..., null: Optional[bool] = ..., default: Optional[Union[_T, Callable[..., _T]]] = ..., attr_name: Optional[Text] = ...) -> None: ...
\r
18 def __set__(self, instance: Any, value: Optional[_T]) -> None: ...
\r
19 def serialize(self, value: Any) -> Any: ...
\r
20 def deserialize(self, value: Any) -> Any: ...
\r
21 def get_value(self, value: Any) -> Any: ...
\r
22 def between(self, lower: Any, upper: Any) -> Any: ...
\r
23 def is_in(self, *values: Any) -> Any: ...
\r
24 def exists(self) -> Any: ...
\r
25 def does_not_exist(self) -> Any: ...
\r
26 def is_type(self) -> Any: ...
\r
27 def startswith(self, prefix: str) -> Any: ...
\r
28 def contains(self, item: Any) -> Any: ...
\r
29 def append(self, other: Any) -> Any: ...
\r
30 def prepend(self, other: Any) -> Any: ...
\r
31 def set(self, value: Any) -> Any: ...
\r
32 def remove(self) -> Any: ...
\r
33 def add(self, *values: Any) -> Any: ...
\r
34 def delete(self, *values: Any) -> Any: ...
\r
36 class SetMixin(object):
\r
37 def serialize(self, value): ...
\r
38 def deserialize(self, value): ...
\r
40 class BinaryAttribute(Attribute[bytes]):
\r
41 def __get__(self, instance: Any, owner: Any) -> bytes: ...
\r
43 class BinarySetAttribute(SetMixin, Attribute[Set[bytes]]):
\r
44 def __get__(self, instance: Any, owner: Any) -> Set[bytes]: ...
\r
46 class UnicodeSetAttribute(SetMixin, Attribute[Set[Text]]):
\r
47 def element_serialize(self, value: Any) -> Any: ...
\r
48 def element_deserialize(self, value: Any) -> Any: ...
\r
49 def __get__(self, instance: Any, owner: Any) -> Set[Text]: ...
\r
51 class UnicodeAttribute(Attribute[Text]):
\r
52 def __get__(self, instance: Any, owner: Any) -> Text: ...
\r
54 class JSONAttribute(Attribute[Any]):
\r
55 def __get__(self, instance: Any, owner: Any) -> Any: ...
\r
57 class LegacyBooleanAttribute(Attribute[bool]):
\r
58 def __get__(self, instance: Any, owner: Any) -> bool: ...
\r
60 class BooleanAttribute(Attribute[bool]):
\r
61 def __get__(self, instance: Any, owner: Any) -> bool: ...
\r
63 class NumberSetAttribute(SetMixin, Attribute[Set[float]]):
\r
64 def __get__(self, instance: Any, owner: Any) -> Set[float]: ...
\r
66 class NumberAttribute(Attribute[float]):
\r
67 def __get__(self, instance: Any, owner: Any) -> float: ...
\r
69 class UTCDateTimeAttribute(Attribute[datetime]):
\r
70 def __get__(self, instance: Any, owner: Any) -> datetime: ...
\r
72 class NullAttribute(Attribute[None]):
\r
73 def __get__(self, instance: Any, owner: Any) -> None: ...
\r
75 class MapAttributeMeta(type):
\r
76 def __init__(cls, name, bases, attrs) -> None: ...
\r
78 class MapAttribute(Generic[_KT, _VT], Attribute[Mapping[_KT, _VT]], metaclass=MapAttributeMeta):
\r
79 attribute_values: Any
\r
80 def __init__(self, hash_key: bool = ..., range_key: bool = ..., null: Optional[bool] = ..., default: Optional[Union[Any, Callable[..., Any]]] = ..., attr_name: Optional[Text] = ..., **attrs) -> None: ...
\r
81 def __iter__(self) -> Iterable[_VT]: ...
\r
82 def __getattr__(self, attr: str) -> _VT: ...
\r
83 def __getitem__(self, item: _KT) -> _VT: ...
\r
84 def __set__(self, instance: Any, value: Union[None, MapAttribute[_KT, _VT], Mapping[_KT, _VT]]) -> None: ...
\r
85 def __get__(self: _MT, instance: Any, owner: Any) -> _MT: ...
\r
86 def is_type_safe(self, key: Any, value: Any) -> bool: ...
\r
87 def validate(self) -> bool: ...
\r
89 class ListAttribute(Generic[_T], Attribute[List[_T]]):
\r
91 def __init__(self, hash_key: bool = ..., range_key: bool = ..., null: Optional[bool] = ..., default: Optional[Union[Any, Callable[..., Any]]] = ..., attr_name: Optional[Text] = ..., of: Optional[Type[_T]] = ...) -> None: ...
\r
92 def __get__(self, instance: Any, owner: Any) -> List[_T]: ...
\r
94 DESERIALIZE_CLASS_MAP: Dict[Text, Attribute]
\r
95 SERIALIZE_CLASS_MAP: Dict[Type, Attribute]
\r
96 SERIALIZE_KEY_MAP: Dict[Type, Text]
\r