We uses `pyupgrade --py3-plus` to automatically replace all occurence
of `Text`. But manual fix is required to remove the unused imports. Note
that with this configuration pyupgrade also convert string literals to
.format(...) style, which is manually not included in the commit as well.
In zulip/zulip@3947b0c80a, we replaced
the legacy endpoint to use the term "linkifier" instead of
"filter" and to return the data in a dictionary format.
None of the official clients currently actually use this
endpoint.
- Added `**kwargs` typed `object` in the definition of
`Client.call_on_each_*` .
- Replaced `**kwargs` type from `Any` to `object` in the
definition of `Client.register`.
Fixes part of #647
The mirror has some chance of running on Python 3 now, once the
python-zephyr patch is rebased on 0.2.1, though it’s untested.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
- Call `super()` in the init method.
- Change return hashlib.md5 syntax to encode properly for Python 3
Signed-off-by: Manu LN <manu+github@lacavernedemanu.fr>
Adds the method move_topic to the class Client that allows moving
topics between streams.
- The topic can be renamed if the new_topic argument is given
- Partial topic can be moved givent the proper message_id and
propagate_mode arguments.
- notification to old/new stream can be silenced (active by default)
This adds hash_util_decode() to decode a hash_util_encode() [present in
zulip/zulip's zerver/lib/url_encoding.py [1]] encoded string.
The intent is to facilitate code sharing among various python clients
(primarily, Zulip Terminal).
The string replacement before the `unquote` is to recoup for the custom
string replacements in zulip/zulip's zerver/lib/url_encoding.py [1].
Test added.
[1] See hash_util_encode() in https://github.com/zulip/zulip/blob/master/zerver/lib/url_encoding.py.
Additionally, pin the irc library version to 18.0 because the newer
version has an error in the AioReactor:
```
File "/home/rht/code/venv/lib/python3.8/site-packages/irc/bot.py", line 108, in run
self.bot.reactor.scheduler.execute_after(intvl, self.check)
AttributeError: 'AioReactor' object has no attribute 'scheduler'
```
This reduces the number of retries that might spam APIs.
There is some complexity here which is left un-managed -- for
instance, maybe_restart_mirroring_script does a number of restart
attempts, and then fails, but will be retried every 15s by the
surrounding `process_loop`. Previously, it would merely have looped
forever inside maybe_restart_mirroring_script.
Three loops are intentionally left as infinite `while True` loops,
that merely cap their backoff at the default 90s. Their callers do
not expect, or have any way to handle more gracefully, a failure of
the expected-infinite-loop in `process_loop` or `zulip_to_zephyr`.
They maintain their previous behavior of retrying forever, albeit more
slowly.