Skip to content

Commit 34ba12a

Browse files
committed
addressing pylint comments
1 parent fd62436 commit 34ba12a

6 files changed

Lines changed: 376 additions & 205 deletions

sdk/cosmos/azure-cosmos/azure/cosmos/_cosmos_client_connection.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3371,10 +3371,11 @@ def __GetBodiesFromQueryResult(result: dict[str, Any]) -> list[dict[str, Any]]:
33713371
if feed_range_epk is not None:
33723372
if resource_id is None:
33733373
raise ValueError("resource_id is required for feed_range continuation.")
3374-
# Narrow ``resource_id`` (Optional[str]) to ``str`` for the helpers below.
3375-
# ``cast`` carries the narrowing reliably across the alias even when
3376-
# mypy widens it again later in this long pagination block.
3377-
resource_id_str: str = cast(str, resource_id)
3374+
# The None-check above already narrows ``resource_id`` to ``str``
3375+
# for the rest of this block. Bind it to a clearly-named local so
3376+
# the feed_range helpers below read as ``resource_id_str`` instead
3377+
# of the generic ``resource_id``.
3378+
resource_id_str: str = resource_id
33783379
# (a) Look at the continuation the caller passed in.
33793380
# - Empty or from a pre-fix SDK: start fresh.
33803381
# - One of our v=1 envelopes: check the collection, query, and
@@ -3452,9 +3453,10 @@ def __GetBodiesFromQueryResult(result: dict[str, Any]) -> list[dict[str, Any]]:
34523453
# loop iteration sees a single overlap and falls through to
34533454
# the normal single-partition POST below.
34543455
#
3455-
# Note: if the caller had already pulled some rows from X
3456-
# before the split, those rows show up again on this resume.
3457-
# The customer dedupes by document id.
3456+
# One edge case remains by design: if some rows were already
3457+
# read from parent X before it split, those rows can show up
3458+
# once more after resume when children X1/X2 restart from the
3459+
# start of their slices.
34583460
if pagination_state.explode_on_multi_overlap(overlapping):
34593461
current_feedrange = pagination_state.current_feedrange
34603462
if current_feedrange is None:

0 commit comments

Comments
 (0)