Skip to content

Commit

Permalink
try custom repr
Browse files Browse the repository at this point in the history
  • Loading branch information
zzstoatzz committed Dec 16, 2024
1 parent 8426c5a commit 967a9c6
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions packages/atproto_client/models/string_formats.py
Original file line number Diff line number Diff line change
Expand Up @@ -438,16 +438,21 @@ def validate_uri(v: str) -> str:
return v


Handle = Annotated[str, BeforeValidator(validate_handle)]
Did = Annotated[str, BeforeValidator(validate_did)]
Nsid = Annotated[str, BeforeValidator(validate_nsid)]
Language = Annotated[str, BeforeValidator(validate_language)]
RecordKey = Annotated[str, BeforeValidator(validate_record_key)]
Cid = Annotated[str, BeforeValidator(validate_cid)]
AtUri = Annotated[str, BeforeValidator(validate_at_uri)]
DateTime = Annotated[str, BeforeValidator(validate_datetime)] # see pydantic-extra-types #239
Tid = Annotated[str, BeforeValidator(validate_tid)]
Uri = Annotated[str, BeforeValidator(validate_uri)]
class _ReprBeforeValidator(BeforeValidator):
def __repr__(self) -> str:
return f'<{self.func.__name__} function>'


Handle = Annotated[str, _ReprBeforeValidator(validate_handle)]
Did = Annotated[str, _ReprBeforeValidator(validate_did)]
Nsid = Annotated[str, _ReprBeforeValidator(validate_nsid)]
Language = Annotated[str, _ReprBeforeValidator(validate_language)]
RecordKey = Annotated[str, _ReprBeforeValidator(validate_record_key)]
Cid = Annotated[str, _ReprBeforeValidator(validate_cid)]
AtUri = Annotated[str, _ReprBeforeValidator(validate_at_uri)]
DateTime = Annotated[str, _ReprBeforeValidator(validate_datetime)] # see pydantic-extra-types #239
Tid = Annotated[str, _ReprBeforeValidator(validate_tid)]
Uri = Annotated[str, _ReprBeforeValidator(validate_uri)]

# Any valid ATProto string format
AtProtoString = Annotated[
Expand Down

0 comments on commit 967a9c6

Please sign in to comment.