Skip to content

1. Дябденко Богдан Константинович. 613 - #74

Closed
sw1py wants to merge 11 commits into
python-department:mainfrom
sw1py:main
Closed

sw1py wants to merge 11 commits into
python-department:mainfrom
sw1py:main

Conversation

@sw1py

@sw1py sw1py commented Sep 25, 2026

Copy link
Copy Markdown

No description provided.

@github-actions github-actions Bot added the 613 label Sep 25, 2026
Comment thread src/part1/snowflake.py
"""

import time # noqa: F401
import time

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Не проходит ruff check

Comment thread src/part1/snowflake.py
print(f"timestamp overflows: {elapsed_ms} > {TIMESTAMP_MS_MAX}")
return None
snowflake_id = (
(elapsed_ms << (NODE_ID_BITS + SEQUENCE_ID_BITS))

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Вычисление сдвига дублировано в функции decode_timestamp_ms. Это может быть опасно, так как если логика поменяется, то надо будет исправлять в 2х местах, а это можно забыть, поэтому лучше было вынести вычисление в отдельную константу.
Кстати это пункт S1, так что если бы работа оценивалась не на 0, то был бы минус балл

@sw1py sw1py closed this Oct 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants