Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

addressee: Remove redundant casts.

Anders Kaseorg78f44828672a
diff --git a/mypy.ini b/mypy.ini
index 1219d77e07a..ea6963a91d0 100644
--- a/mypy.ini
+++ b/mypy.ini
@@ -13,6 +13,7 @@ disallow_untyped_defs = True
disallow_any_generics = True
warn_no_return = True
no_implicit_optional = True
+warn_redundant_casts = True
# Display the codes needed for # type: ignore[code] annotations.
show_error_codes = True
diff --git a/zerver/lib/addressee.py b/zerver/lib/addressee.py
index b0b57c1a4d7..cdb820eafa9 100644
--- a/zerver/lib/addressee.py
+++ b/zerver/lib/addressee.py
@@ -129,11 +129,9 @@ class Addressee:
raise JsonableError(_("Missing topic"))
if isinstance(stream_name_or_id, int):
- stream_id = cast(int, stream_name_or_id)
- return Addressee.for_stream_id(stream_id, topic_name)
+ return Addressee.for_stream_id(stream_name_or_id, topic_name)
- stream_name = cast(str, stream_name_or_id)
- return Addressee.for_stream_name(stream_name, topic_name)
+ return Addressee.for_stream_name(stream_name_or_id, topic_name)
elif message_type_name == 'private':
if not message_to:
raise JsonableError(_("Message must have recipients"))