Skip to content

fix: get_partitions_to_optimize should return a Sequence, not Iterable#405

Merged
tkaemming merged 4 commits into
masterfrom
python3-filter
Aug 9, 2019
Merged

fix: get_partitions_to_optimize should return a Sequence, not Iterable#405
tkaemming merged 4 commits into
masterfrom
python3-filter

Conversation

@tkaemming

Copy link
Copy Markdown
Contributor

Similar to GH-403, this maintains the Python 2 behavior.

@tkaemming
tkaemming requested review from a team and mattrobenolt August 9, 2019 03:01
Comment thread snuba/optimize.py

if before:
parts = filter(lambda p: (p[0] + timedelta(days=6 - p[0].weekday())) < before, parts)
parts = [p for p in parts if (p[0] + timedelta(days=6 - p[0].weekday())) < before]

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Without this change, but preserving the annotations::

(snuba) ted@veneno % python -m mypy --follow-imports skip snuba/optimize.py
snuba/optimize.py:73: error: Incompatible types in assignment (expression has type "Iterator[Part]", variable has type "List[Part]")

Comment thread snuba/util.py

def decode_part_str(part_str):
class Part(NamedTuple):
date: datetime

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This should probably be a date and not a datetime, but I haven't checked to see if that would break anything that expects it to be one and not the other.

@tkaemming
tkaemming merged commit 95c7748 into master Aug 9, 2019
@tkaemming
tkaemming deleted the python3-filter branch August 9, 2019 18:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants