Commit graph

567 commits

Author SHA1 Message Date
Anders Kaseorg
d546a39731 ruff: Fix B018 Found useless expression.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-10-30 11:48:03 -07:00
Anders Kaseorg
03d132e99e ruff: Fix B007 Loop control variable not used within loop body.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-10-30 11:44:10 -07:00
Anders Kaseorg
347490c647 ruff: Fix RUF015 Prefer next(iter(…)) over single element slice.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-10-30 11:44:10 -07:00
Anders Kaseorg
610683ea41 ruff: Fix RUF005 Consider unpacking instead of concatenation.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-10-30 11:44:10 -07:00
Anders Kaseorg
12e63f493f ruff: Fix PLW2901 for loop variable overwritten by assignment target.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-10-30 11:44:10 -07:00
Anders Kaseorg
18805ac181 ruff: Fix PLW0603 Using the global statement to update is discouraged.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-10-30 11:44:10 -07:00
Anders Kaseorg
e18d35dbf3 ruff: Fix PLW0602 Using global but no assignment is done.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-10-30 11:44:10 -07:00
Anders Kaseorg
11ea5c7b62 ruff: Fix PLR5501 Use elif instead of else then if, to reduce indentation.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-10-30 11:44:10 -07:00
Anders Kaseorg
5c934e544d ruff: Fix PLR1722 Use sys.exit() instead of exit.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-10-30 11:44:10 -07:00
Anders Kaseorg
93bb7eb61e ruff: Fix PLR1714 Consider merging multiple comparisons.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-10-30 11:44:10 -07:00
Anders Kaseorg
54263e5d52 ruff: Fix N818 Exception name should be named with an Error suffix.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-10-30 11:44:10 -07:00
Anders Kaseorg
a8aec780d2 ruff: Fix N816 Variable in global scope should not be mixedCase.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-10-30 11:44:10 -07:00
Anders Kaseorg
87e7d31403 ruff: Fix N806 Variable in function should be lowercase.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-10-30 11:44:10 -07:00
Anders Kaseorg
5e708e3661 ruff: Fix N803 Argument name should be lowercase.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-10-30 11:44:10 -07:00
Anders Kaseorg
2c4e7069ad ruff: Fix N801 Class name should use CapWords convention.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-10-30 11:44:10 -07:00
Anders Kaseorg
7aeb8f2619 ruff: Fix PIE810 Call startswith once with a tuple.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-10-29 18:17:39 -07:00
Anders Kaseorg
008efed12b ruff: Fix SIM300 Yoda conditions are discouraged.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-10-29 18:17:39 -07:00
Anders Kaseorg
93156d994a ruff: Fix SIM118 Use key in dict instead of key in dict.keys().
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-10-29 18:17:39 -07:00
Anders Kaseorg
6a37290cec ruff: Fix SIM114 Combine if branches using logical or operator.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-10-29 18:17:39 -07:00
Anders Kaseorg
b009dcd7d3 ruff: Fix SIM108 Use ternary operator instead of if-else-block.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-10-29 18:17:39 -07:00
Anders Kaseorg
2aa36f90fb ruff: Fix SIM105 Use contextlib.suppress instead of try-except-pass.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-10-29 18:17:39 -07:00
Anders Kaseorg
58a3026f37 ruff: Fix SIM102 Use a single if statement instead of nested if statements.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-10-29 18:17:39 -07:00
Anders Kaseorg
c75f5b3a09 ruff: Fix SIM101 Multiple isinstance calls for val, merge into a single call.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-10-29 18:17:39 -07:00
Anders Kaseorg
774edb434e ruff: Fix C400 Unnecessary generator (rewrite as a list comprehension).
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-10-29 17:36:51 -07:00
Anders Kaseorg
353c2de050 ruff: Fix EXE002 The file is executable but no shebang is present.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-10-29 16:54:40 -07:00
Anders Kaseorg
ca3e5a2746 ruff: Fix EXE001 Shebang is present but file is not executable.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-10-29 16:54:40 -07:00
Anders Kaseorg
6b2861c3ec ruff: Fix G004 Logging statement uses f-string.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-10-28 16:18:11 -07:00
Anders Kaseorg
d85ace8e7e ruff: Fix G003 Logging statement uses +.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-10-28 16:17:21 -07:00
Anders Kaseorg
02e0555e0d ruff: Fix G002 Logging statement uses %.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-10-28 16:17:21 -07:00
Anders Kaseorg
e537bbefdf ruff: Fix G001 Logging statement uses str.format.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-10-28 16:17:21 -07:00
Anders Kaseorg
1ccb5db6ef ruff: Fix G010 Logging statement uses warn instead of warning.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-10-28 16:17:21 -07:00
Anders Kaseorg
63246e4369 ruff: Fix RUF010 Use explicit conversion flag.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-10-27 22:41:04 -07:00
Anders Kaseorg
c471f26d45 ruff: Fix ISC001 Implicitly concatenated string literals on one line.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-10-27 22:14:10 -07:00
Anders Kaseorg
fcd4fe330d ruff: Fix UP031 Use format specifiers instead of percent format.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-10-27 22:04:41 -07:00
Anders Kaseorg
ddccf0eda3 ruff: Fix UP032 Use f-string instead of format call.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-10-27 22:01:58 -07:00
Anders Kaseorg
a49add3d02 lint: Replace Black with Ruff.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-10-27 19:08:40 -07:00
Anders Kaseorg
6cb1d5f775 mypy: Enable explicit-override error.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-10-26 14:03:17 -07:00
Anders Kaseorg
43654b9cf2 mypy: Enable ignore-without-code error.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-10-26 13:43:42 -07:00
Anders Kaseorg
95b33b83b5 mypy: Enable redundant-expr error.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-10-26 13:41:24 -07:00
Anders Kaseorg
a9e3fe9d0c zulip_trello: Add type annotations.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-10-25 16:21:34 -07:00
Anders Kaseorg
40fba154c2 get-google-credentials: Remove Python 2 compatibility.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-10-25 16:19:32 -07:00
Anders Kaseorg
f55d5ea555 Mark Python 3.11 supported.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-10-25 16:00:47 -07:00
Anders Kaseorg
8eb3d4e1e2 Upgrade requirements.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-10-25 13:23:51 -07:00
Anders Kaseorg
2ecabb3260 Fix signal handler types.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-10-25 13:23:51 -07:00
Anders Kaseorg
98e23bdfd4 Remove Python 3.7 support.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-10-25 13:23:37 -07:00
Anders Kaseorg
a9607dfdf9 Convert type comments to Python ≥ 3.6 variable annotations.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-10-18 01:04:47 -07:00
Daniel Teunis
35a8ff8839 zulip-integrations: Add missing dependencies to requirement files.
Adds missing items to the requirement files for the zulip integrations
in `zulip/integrations/*`.
2023-08-11 12:36:11 -07:00
Zixuan James Li
8016ed144c api: Update add_realm_filter to support url_template.
This adds support to adding linkifiers with the new URL template syntax.

Signed-off-by: Zixuan James Li <p359101898@gmail.com>
2023-08-11 12:35:46 -07:00
Daniel Teunis
ae142a380d rss-bot: Allow overriding the topic default.
rss-bot selects the topic of its RSS notification messages based on the
topic of the RSS feed. Monitoring a large number of RSS feeds therefore
leads to a large number of topics in the stream. Also, the user has no
option to customize the topic names.

This patch adds a new `--topic` argument that replaces the topic for
all RSS feed notifications with the provided string. If no custom topic
is provided, the bot uses the default behaviour described above.
2023-06-12 12:24:29 -07:00
root
5b2b0617a6 call_on_each_event: Do not pass heartbeat events to clients.
Heartbeat events are intended to be an invisible part of the Zulip
longpolling protocol, not an event that an application should every
process, so it makes sense to exclude them from the events we pass to
this application.

Reproducer: https://github.com/showell/zulip-api-examples/blob/main/heartbeat_bug.py.

See https://chat.zulip.org/#narrow/stream/137-feedback/topic/api.20client.20silent.20failure
for more context.
2023-05-30 17:17:38 -07:00