fix Snowflake.to_b32l() for negative values
This commit is contained in:
parent
e615cbb628
commit
1d6d5d72f8
2 changed files with 4 additions and 2 deletions
|
|
@ -27,7 +27,7 @@ from .itertools import makelist, kwargs_prefix, ltuple, rtuple, additem
|
|||
from .i18n import I18n, JsonI18n, TomlI18n
|
||||
from .snowflake import Snowflake, SnowflakeGen
|
||||
|
||||
__version__ = "0.3.0"
|
||||
__version__ = "0.3.1"
|
||||
|
||||
__all__ = (
|
||||
'Siq', 'SiqCache', 'SiqType', 'SiqGen', 'StringCase',
|
||||
|
|
|
|||
|
|
@ -131,7 +131,9 @@ class Snowflake(int):
|
|||
def to_oct(self) -> str:
|
||||
return f'{self:o}'
|
||||
def to_b32l(self) -> str:
|
||||
"""PSA Snowflake Base32 representations are padded to 10 bytes!"""
|
||||
# PSA Snowflake Base32 representations are padded to 10 bytes!
|
||||
if self < 0:
|
||||
return '_' + Snowflake.to_b32l(-self)
|
||||
return b32lencode(self.to_bytes(10, 'big')).lstrip('a')
|
||||
|
||||
@classmethod
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue