This also runs black to reformat the affected files, which had been
causing failures because of upstream updates.
Ideally, we need a more sophisticated toolchain for managing the
versions of the dependencies instead of just requirements.txt. This
should be due in a possible future cleanup.
Signed-off-by: Zixuan James Li <p359101898@gmail.com>
There are cases where the call to an endpoint may result in an
exception the traceback for which is converted into JSON and
returned to the caller. In the case of such an unsuccessful
response, we should just reraise the exception instead of parsing
the response as though it was successful.
The documented API for DELETE /api/v1/users/me/subscriptions is that
principals should be omitted to remove a subscription for the calling
user. A call with principals=[] should have a different meaning, but
a server bug currently conflates this with a call omitting principals.
Avoid relying on this bug.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
As part of supporting the change in zulip/zulip#18409, we add a
conditional to send the old/buggy format only to servers with feature
levels indicating they don't support the modern version.
To make sure that the API bindings is backward compatible with
older versions of zulip server that uses functions with different
signatures, we use a hack to replace the Client class with a
legacy-compatible version of it.
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
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.