Skip to content

pynamodb: fix rate_limited_scan defaults #2167

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jun 9, 2018
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion third_party/2and3/pynamodb/models.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,27 @@ class Model(metaclass=MetaModel):
@classmethod
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]: ...
@classmethod
def rate_limited_scan(cls: Type[_T], attributes_to_get: Optional[Sequence[Text]], segment: Optional[int] = ..., total_segments: Optional[int] = ..., limit: Optional[int] = ..., conditional_operator: Optional[Text] = ..., last_evaluated_key: Optional[Any] = ..., page_size: Optional[int] = ..., timeout_seconds: Optional[int] = ..., read_capacity_to_consume_per_second: int = ..., max_sleep_between_retry: int = ..., max_consecutive_exceptions: int = ..., **filters: Any): ...
def rate_limited_scan(
cls: Type[_T],
# TODO: annotate Condition class
filter_condition: Optional[Any]=...,
attributes_to_get: Optional[Sequence[Text]] = ...,
segment: Optional[int] = ...,
total_segments: Optional[int] = ...,
limit: Optional[int] = ...,
conditional_operator: Optional[Text] = ...,
last_evaluated_key: Optional[Any] = ...,
page_size: Optional[int] = ...,
timeout_seconds: Optional[int] = ...,
read_capacity_to_consume_per_second: int = ...,
allow_rate_limited_scan_without_consumed_capacity: Optional[bool]=None,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Defaults should always be ... (you'll get a lint error for this) and = should be surrounded by spaces if there's a type annotation.

max_sleep_between_retry: int = ...,
max_consecutive_exceptions: int = ...,
consistent_read: Optional[bool] = ...,
index_name: Optional[str] = ...,
**filters: Any
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like consistent_read and index_name are still missing?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, sorry for overlooking this.

) -> Iterator[_T]:
...
@classmethod
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]: ...
@classmethod
Expand Down