Repository navigation
1. Жажин Владислав Артемович. 613 #54
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
Open
2016pac
wants to merge
14
commits into
python-department:main
Choose a base branch
from
2016pac:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
15cc96d
Solve task 1
2016pac 9daa20e
Merge branch 'python-department:main' into main
2016pac 051c96e
Solve task 1
2016pac 2b743a9
Merge branch 'python-department:main' into main
2016pac e8c312b
Вот такие дела, собачка
2016pac 5bf9697
Solve Task 2
2016pac 9b933e5
Solve task 3
2016pac 2d21e7d
Correct Homework
2016pac f6a6934
Correct place for homework
2016pac 66d5c42
Correct place for homework
2016pac 3307799
Merge branch 'python-department:main' into main
2016pac aa2e840
Solve Task 4
2016pac ed95c0e
Merge branch 'python-department:main' into main
2016pac 167f2d9
Solve Task 5
2016pac File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,38 +1,11 @@ | ||
| """Bit layout and default epoch for the Twitter Snowflake ID generator. | ||
|
|
||
| A Snowflake identifier is a 63-bit positive integer packed as follows, from | ||
| the most significant bit downwards: | ||
|
|
||
| 1 bit unused sign bit, always zero | ||
| 41 bits milliseconds elapsed since a custom epoch | ||
| 10 bits node identifier | ||
| 12 bits per-millisecond sequence counter | ||
|
|
||
| The shift and mask constants should be derived from the bit widths so that | ||
| changing a width keeps everything else consistent. | ||
| """ | ||
|
|
||
| from typing import Final | ||
|
|
||
|
|
||
| # TODO: замените заглушки (0) на корректные значения, см. TASK.md. | ||
| # Все константы, зависящие от ёмкостей *_BITS, должны вычисляться из них. | ||
|
|
||
| # Twitter's original Snowflake epoch: 2010-11-04 01:42:54.657 UTC. | ||
| EPOCH_MS_DEFAULT: Final[int] = 0 | ||
|
|
||
| # Node identifier used when the caller does not supply one. | ||
| NODE_ID_DEFAULT: Final[int] = 0 | ||
|
|
||
| # Width of each field, in bits. | ||
| TIMESTAMP_BITS: Final[int] = 0 | ||
| NODE_ID_BITS: Final[int] = 0 | ||
| SEQUENCE_ID_BITS: Final[int] = 0 | ||
|
|
||
| # Largest value each field can hold. | ||
| TIMESTAMP_MS_MAX: Final[int] = 0 | ||
| NODE_ID_MAX: Final[int] = 0 | ||
| SEQUENCE_ID_MAX: Final[int] = 0 | ||
|
|
||
| # Здесь можно добавить собственные вспомогательные константы | ||
| # (например, сдвиги полей при сборке идентификатора). | ||
| EPOCH_MS_DEFAULT: Final[int] = 1288834974657 | ||
| NODE_ID_DEFAULT: Final[int] = 1 | ||
| TIMESTAMP_BITS: Final[int] = 41 | ||
| NODE_ID_BITS: Final[int] = 10 | ||
| SEQUENCE_ID_BITS: Final[int] = 12 | ||
| TIMESTAMP_MS_MAX: Final[int] = 2**TIMESTAMP_BITS - 1 | ||
| NODE_ID_MAX: Final[int] = 2**NODE_ID_BITS - 1 | ||
| SEQUENCE_ID_MAX: Final[int] = 2**SEQUENCE_ID_BITS - 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Лучше не экономить строки и оставлять пробелы (пустые строки) между логическими блоками. Так читабельность кода улучшается.