diff --git a/src/suou/__init__.py b/src/suou/__init__.py index b56f3eb..9b2f722 100644 --- a/src/suou/__init__.py +++ b/src/suou/__init__.py @@ -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', diff --git a/src/suou/snowflake.py b/src/suou/snowflake.py index e9f2708..06ea85e 100644 --- a/src/suou/snowflake.py +++ b/src/suou/snowflake.py @@ -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