1 from .exceptions import DoesNotExist as DoesNotExist
\r
2 from typing import Any, Dict, Generic, Iterable, Iterator, List, Optional, Sequence, Tuple, Type, TypeVar, Text, Union
\r
6 class DefaultMeta: ...
\r
8 class ResultSet(Iterable):
\r
12 def __init__(self, results, operation, arguments) -> None: ...
\r
13 def __iter__(self): ...
\r
15 class MetaModel(type):
\r
16 def __init__(self, name: Text, bases: Tuple[type, ...], attrs: Dict[Any, Any]) -> None: ...
\r
18 _T = TypeVar('_T', bound='Model')
\r
19 KeyType = Union[Text, bytes, float, int, Tuple]
\r
21 class Model(metaclass=MetaModel):
\r
22 DoesNotExist = DoesNotExist
\r
23 attribute_values: Dict[Text, Any]
\r
24 def __init__(self, hash_key: Optional[KeyType] = ..., range_key: Optional[Any] = ..., **attrs) -> None: ...
\r
26 def has_map_or_list_attributes(cls: Type[_T]) -> bool: ...
\r
28 def batch_get(cls: Type[_T], items: Iterable[Union[KeyType, Iterable[KeyType]]], consistent_read: Optional[bool] = ..., attributes_to_get: Optional[Sequence[Text]] = ...) -> Iterator[_T]: ...
\r
30 def batch_write(cls: Type[_T], auto_commit: bool = ...) -> BatchWrite[_T]: ...
\r
31 def delete(self, condition: Optional[Any] = ..., conditional_operator: Optional[Text] = ..., **expected_values) -> Any: ...
\r
32 def update(self, attributes: Optional[Dict[Text, Dict[Text, Any]]] = ..., actions: Optional[List[Any]] = ..., condition: Optional[Any] = ..., conditional_operator: Optional[Text] = ..., **expected_values) -> Any: ...
\r
33 def update_item(self, attribute: Text, value: Optional[Any] = ..., action: Optional[Text] = ..., conditional_operator: Optional[Text] = ..., **expected_values): ...
\r
34 def save(self, condition: Optional[Any] = ..., conditional_operator: Optional[Text] = ..., **expected_values) -> Dict[str, Any]: ...
\r
35 def refresh(self, consistent_read: bool = ...): ...
\r
37 def get(cls: Type[_T], hash_key: KeyType, range_key: Optional[KeyType] = ..., consistent_read: bool = ...) -> _T: ...
\r
39 def from_raw_data(cls: Type[_T], data) -> _T: ...
\r
41 def count(cls: Type[_T], hash_key: Optional[KeyType] = ..., consistent_read: bool = ..., index_name: Optional[Text] = ..., limit: Optional[int] = ..., **filters) -> int: ...
\r
43 def query(cls: Type[_T], hash_key: KeyType, consistent_read: bool = ..., index_name: Optional[Text] = ..., scan_index_forward: Optional[Any] = ..., conditional_operator: Optional[Text] = ..., limit: Optional[int] = ..., last_evaluated_key: Optional[Any] = ..., attributes_to_get: Optional[Iterable[Text]] = ..., page_size: Optional[int] = ..., **filters) -> Iterator[_T]: ...
\r
45 def rate_limited_scan(
\r
47 # TODO: annotate Condition class
\r
48 filter_condition: Optional[Any] = ...,
\r
49 attributes_to_get: Optional[Sequence[Text]] = ...,
\r
50 segment: Optional[int] = ...,
\r
51 total_segments: Optional[int] = ...,
\r
52 limit: Optional[int] = ...,
\r
53 conditional_operator: Optional[Text] = ...,
\r
54 last_evaluated_key: Optional[Any] = ...,
\r
55 page_size: Optional[int] = ...,
\r
56 timeout_seconds: Optional[int] = ...,
\r
57 read_capacity_to_consume_per_second: int = ...,
\r
58 allow_rate_limited_scan_without_consumed_capacity: Optional[bool] = ...,
\r
59 max_sleep_between_retry: int = ...,
\r
60 max_consecutive_exceptions: int = ...,
\r
61 consistent_read: Optional[bool] = ...,
\r
62 index_name: Optional[str] = ...,
\r
64 ) -> Iterator[_T]: ...
\r
66 def scan(cls: Type[_T], segment: Optional[int] = ..., total_segments: Optional[int] = ..., limit: Optional[int] = ..., conditional_operator: Optional[Text] = ..., last_evaluated_key: Optional[Any] = ..., page_size: Optional[int] = ..., **filters) -> Iterator[_T]: ...
\r
68 def exists(cls: Type[_T]) -> bool: ...
\r
70 def delete_table(cls): ...
\r
72 def describe_table(cls): ...
\r
74 def create_table(cls: Type[_T], wait: bool = ..., read_capacity_units: Optional[Any] = ..., write_capacity_units: Optional[Any] = ...): ...
\r
78 def dump(cls, filename): ...
\r
80 def loads(cls, data): ...
\r
82 def load(cls, filename): ...
\r
84 def add_throttle_record(cls, records): ...
\r
86 def get_throttle(cls): ...
\r
88 def _get_attributes(cls) -> Dict[str, Any]: ...
\r
90 class ModelContextManager(Generic[_T]):
\r
94 pending_operations: List[Dict[Text, Any]]
\r
95 def __init__(self, model: Type[_T], auto_commit: bool = ...) -> None: ...
\r
96 def __enter__(self) -> ModelContextManager[_T]: ...
\r
98 class BatchWrite(Generic[_T], ModelContextManager[_T]):
\r
99 def save(self, put_item: _T) -> None: ...
\r
100 def delete(self, del_item: _T) -> None: ...
\r
101 def __enter__(self) -> BatchWrite[_T]: ...
\r
102 def __exit__(self, exc_type, exc_val, exc_tb) -> None: ...
\r
103 pending_operations: Any
\r
104 def commit(self) -> None: ...
\r