mirror of
https://github.com/zulip/zulip.git
synced 2025-11-02 21:13:36 +00:00
models: Remove type prefixes from __str__ values.
The Django convention is for __repr__ to include the type and __str__
to omit it. In fact its default __repr__ implementation for models
automatically adds a type prefix to __str__, which has resulted in the
type being duplicated:
>>> UserProfile.objects.first()
<UserProfile: <UserProfile: emailgateway@zulip.com <Realm: zulipinternal 1>>>
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
committed by
Anders Kaseorg
parent
f66136fcc2
commit
2d9b2a2a05
@@ -10,7 +10,7 @@ exclude_lines =
|
||||
# Don't require coverage for test suite AssertionError -- they're usually for clarity
|
||||
raise AssertionError
|
||||
# Don't require coverage for __str__ statements just used for printing
|
||||
def __str__[(]self[)] -> .*:
|
||||
def __(repr|str)__[(]self[)] -> .*:
|
||||
# Don't require coverage for errors about unsupported webhook event types
|
||||
raise UnsupportedWebhookEventTypeError
|
||||
# Don't require coverage for blocks only run when type-checking
|
||||
|
||||
Reference in New Issue
Block a user