-
Notifications
You must be signed in to change notification settings - Fork 24
[DRAFT] Improve init, encode, cli #39
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
base: main
Are you sure you want to change the base?
Conversation
@@ -297,7 +308,9 @@ def __get_pydantic_core_schema__(cls, source: Any, handler: GetCoreSchemaHandler | |||
core_schema.union_schema([ | |||
core_schema.is_instance_schema(ULID), | |||
core_schema.no_info_plain_validator_function(ULID), | |||
core_schema.str_schema(pattern=r"[A-Z0-9]{26}", min_length=26, max_length=26), | |||
core_schema.str_schema( | |||
pattern=rf"[{base32.ENCODE}]{{26}}", min_length=26, max_length=26 |
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.
There is a test that would need to be adapted. Good catch with the I
, though.
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.
Ok, I missed this issue and I'll follow up on a fix
|
||
@staticmethod | ||
def _gen_bytes_from_ts(ts_ms: int | None = None) -> bytes: | ||
"""Generate a new ULID bytes from the timestamp(ms).""" |
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.
- All the other methods use the more lengthy word "timestamp" so that I would like to keep it consistent: What do you think about
_bytes_from_timestamp(...)
- The docstring could be "Generate a ULID byte sequence of from a timestamp"
Please execute the tests with |
Ok, sorry for the misunderstanding, it's still just part of this PR (it's not a full version) |
Close #38