Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

UNSET values inrepr are extremely verbose#825

forest-benchling started this conversation inFeature request
Discussion options

Is your feature request related to a problem? Please describe.
When printing out models, we often get extremely verbose strings, such as:

CustomEntityUpdate(entity_registry_id=<benchling_api_client.types.Unset object at0x10453d2b0>, author_ids=<benchling_api_client.types.Unset object at 0x10453d2b0>, aliases=<benchling_api_client.types.Unset object at 0x10453d2b0>, custom_fields=<benchling_api_client.types.Unset object at 0x10453d2b0>, fields=Fields(additional_properties={'Request 1': Field(value='test_plate', display_value=<benchling_api_client.types.Unset object at 0x10453d2b0>, is_multi=<benchling_api_client.types.Unset object at 0x10453d2b0>, text_value=<benchling_api_client.types.Unset object at 0x10453d2b0>, type=<benchling_api_client.types.Unset object at 0x10453d2b0>), 'Request 2': Field(value='test_plate', display_value=<benchling_api_client.types.Unset object at 0x10453d2b0>, is_multi=<benchling_api_client.types.Unset object at 0x10453d2b0>, text_value=<benchling_api_client.types.Unset object at 0x10453d2b0>, type=<benchling_api_client.types.Unset object at 0x10453d2b0>), 'Request 3': Field(value='test_plate', display_value=<benchling_api_client.types.Unset object at 0x10453d2b0>, is_multi=<benchling_api_client.types.Unset object at 0x10453d2b0>, text_value=<benchling_api_client.types.Unset object at 0x10453d2b0>, type=<benchling_api_client.types.Unset object at 0x10453d2b0>)}), folder_id=<benchling_api_client.types.Unset object at 0x10453d2b0>, name=<benchling_api_client.types.Unset object at 0x10453d2b0>, schema_id=<benchling_api_client.types.Unset object at 0x10453d2b0>)

This makes debugging much more challenging.

Describe the solution you'd like
Ideally it would print

CustomEntityUpdate(fields=Fields(additional_properties={'Request 1': Field(value='test_plate'), 'Request 2': Field(value='test_plate'), 'Request 3': Field(value='test_plate')}))

Describe alternatives you've considered
It would also be an improvement if the repr ofUNSET itself was shortened. I know@dbanty mentioned a PEP a while back that would allow us to make it a sentinel.

Additional context
cc@GitOnUp

You must be logged in to vote

Replies: 3 comments

Comment options

Relevant PEP is still a draft, so, we'll be stuck withUNSET for a long time

You must be logged in to vote
0 replies
Comment options

Maybe it's possible to rely on pydantics unset?

You must be logged in to vote
0 replies
Comment options

A sentinal will be useful later, but defining__repr__ would be better than the current state. Can we do this for now?

classUnset:def__bool__(self)->Literal[False]:returnFalsedef__str__(self)->str:return"<UNSET>"def__repr__(self)->str:return"UNSET"
You must be logged in to vote
0 replies
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Labels
✨ enhancementNew feature or improvement
4 participants
@forest-benchling@13rac1@benedikt-bartscher@dbanty
Converted from issue

This discussion was converted from issue #463 on August 13, 2023 01:59.


[8]ページ先頭

©2009-2025 Movatter.jp