mirror of https://github.com/zulip/zulip.git
message_send: Avoid unchecked cast.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
parent
f6c73ed45a
commit
48719cb8c4
|
@ -8,17 +8,6 @@ rules:
|
|||
languages: [python]
|
||||
severity: ERROR
|
||||
|
||||
- id: useless-if-body
|
||||
patterns:
|
||||
- pattern: |
|
||||
if $X:
|
||||
$S
|
||||
else:
|
||||
$S
|
||||
message: "Useless if statment; both blocks have the same body"
|
||||
languages: [python]
|
||||
severity: ERROR
|
||||
|
||||
- id: dont-use-stream-objects-filter
|
||||
pattern: Stream.objects.filter(...)
|
||||
message: "Please use access_stream_by_*() to fetch Stream objects"
|
||||
|
|
|
@ -195,10 +195,10 @@ def send_message_backend(request: HttpRequest, user_profile: UserProfile,
|
|||
# Also, mypy can't detect that a single-item
|
||||
# list populated from a Union[int, str] is actually
|
||||
# a Union[Sequence[int], Sequence[str]].
|
||||
message_to = cast(
|
||||
Union[Sequence[int], Sequence[str]],
|
||||
[stream_indicator],
|
||||
)
|
||||
if isinstance(stream_indicator, int):
|
||||
message_to = [stream_indicator]
|
||||
else:
|
||||
message_to = [stream_indicator]
|
||||
else:
|
||||
message_to = extract_private_recipients(req_to)
|
||||
|
||||
|
|
Loading…
Reference in New Issue