Commit graph

2273 commits

Author SHA1 Message Date
Anders Kaseorg 922446ddf4 test-static-analysis: Delete.
The only thing it did over ‘tools/lint --skip=gitlint’ was redundantly
run mypy again.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-04 14:05:38 -08:00
Anders Kaseorg 2e3c65a044 lint: Remove custom --no-gitlint option.
zulint already has --skip for this.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-04 14:04:53 -08:00
LoopThrough-i-j c4a78d0832 lint: Remove gitlint from static analysis. 2021-03-04 11:37:15 -08:00
LoopThrough-i-j cce18ed11b lint: Setup gitlint.
Setup gitlint for developers to write well formatted
commit messages.

Note: .gitlint, gitlint-rules.py and lint-commits
are taken directly from zulip/zulip with minor changes.
2021-03-04 11:36:47 -08:00
LoopThrough-i-j f8cd424495 docs: Add set and fetch upstream.
Set and Fetch upstream is required for gitlint, while
setting up development env.
2021-03-04 11:36:28 -08:00
Ganesh Pawar 44b6fd395a tests: Fix tests failing on Windows.
Tests were failing on Windows since paths are case-insensitive on it.
This uses pathlib library to compare paths on all platforms.

Fixes #651
2021-03-04 11:28:35 -08:00
Ganesh Pawar 5f1590f12a requirements: Upgrade zulint and mypy.
mypy version 0.770 has a bug where it raises false "syntax error in type
comment" warnings on Python 3.9
https://github.com/python/mypy/issues/8627
It has been fixed.

zulint had a bug where it raised UnicodeDecodeError while running on
Windows, which has been fixed.
14e3974001
2021-03-04 11:28:35 -08:00
LoopThrough-i-j f56f824676 zulip-bots: Replace ExternalBotHandler type by BotHandler.
The functions `extract_query_without_mention` and
`is_private_message_but_not_group_pm` now accept `BotHandler`
instead of `ExternalBotHandler` which allows passing objects of both
`EmbeddedBotHandler` and `ExternalBotHandler`.

Fixes #639
2021-03-03 13:31:59 -08:00
LoopThrough-i-j 1fb3d529a9 zulip-bots: Set bot_handler type to BotHandler.
- Set `bot_handler` type to `BotHandler`.
- Fix mypy issues in improperly typed variables, params and returns.

Fixes part of #639
2021-03-03 13:31:50 -08:00
LoopThrough-i-j a994c58439 zulip-bots: Add BotHandler Protocol.
- The `BotHandler` Protocol is a mypy Protocol
  s.t. all BotHandlers can use it as a default type.
- Fix ExternalBotHandler and StubBotHandler to
  follow `BotHandler` Protocol

Fixes part of #639
2021-03-03 13:31:37 -08:00
LoopThrough-i-j 889e5e333d zulip-bots: Add BotStorage Protocol.
The `BotStorage` Protocol is created to add a common type to all
storage classes.

Note: Protocol is imported from `typing_extensions` as `typing`
doesn't provide Protocol for python <= 3.7.
2021-03-03 13:30:55 -08:00
LoopThrough-i-j 3887ad102e python-zulip-api: Drop python3.5 support.
Fixes Part of #655
2021-02-26 07:32:47 -08:00
Debayan Ganguly 6ac2165bf1
provision: Replace virtualenv with python native venv.
- Replace virtualenv with python 3's native venv feature. The venv used is native to
  python3.5+, so there's no need for a separate dependency.
- Remove redundant activation script. An activation script is required
  to use the pip and python in the virtual environment, but because we're
  calling the pip inside the venv, we don't need one.

Fixes #625.
2021-02-24 18:20:49 -08:00
LoopThrough-i-j 4c75057de1 dropbox-bot: Update to support dropbox>=11.0.0.
Changes in dropox version >= 11.0 broke the dropbox bot.
The required fixes are mentioned at:
https://github.com/dropbox/dropbox-sdk-python/blob/main/UPGRADING.md#upgrading-from-v10xx-to-v1100
2021-02-23 19:19:16 -08:00
Alex Vandiver 424404d074 README: Fix extra space in Markdown link. 2021-02-23 13:57:49 -08:00
Alex Vandiver f100dba3f3 editorconfig: Adjust to 2-space indents for yaml.
This matches the current configuration in zulip/zulip.
2021-02-23 13:51:14 -08:00
LoopThrough-i-j ca4f6e527f CI: Add gh-action badge and remove travis badge. 2021-02-23 12:11:13 -08:00
LoopThrough-i-j 6337eca57f CI: Setup CI with Github Actions replacing Travis. 2021-02-23 12:11:13 -08:00
LoopThrough-i-j 3e28506607 zulip-apis: Update reaction_data type.
Update `reaction_data` type in add_reaction and
remove_reaction, from Dict[str, str] to Dict[str, Any]
2021-02-23 08:58:23 -08:00
Ahmed Abuamra 9ce2ea53a5 integrations: Remove !avatar from game handler.
The issue linked to this commit suggest suggests to replace the avatar
with the username only, I just needed to remove !avatar as the code
already shows the username.

Fixes part of #632.
2021-02-18 18:35:01 -08:00
LoopThrough-i-j e995e52896 dropbox_share bot: Pin dropbox version to 10.10.0.
Tests for dropbox_share bot fails for version >= 11.0.0.
2021-01-26 12:57:44 -08:00
Alex Vandiver 385fb51f01 zulip-botserver: Document use of environment var in README.md 2021-01-07 00:31:26 -08:00
LoopThrough-i-j bcf183d2b1 zulip-botserver: Allow passing config via JSON formatted environment variable.
Fixes #485.

Co-authored-by: Alex Vandiver <alexmv@zulip.com>
2021-01-07 00:31:26 -08:00
Unam LN 984d9151d5
bots: Fix RSS bot for Python 3.x support.
- 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>
2020-12-22 16:34:32 -08:00
Tim Abbott 59a0a912a8 process_ccache: Update path to Zulip supervisord files. 2020-12-20 11:46:24 -08:00
Anders Kaseorg f2d80c657a
README: Migrate Travis badge to travis-ci.com.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-10-27 16:08:39 -07:00
Steve Howell f100ab07aa jabber mirror: Remove code for occupy/vacate events.
The server no longer sends occupy/vacate events
for streams.

The mirror should continue to work fine by processing
subsription-related events.
2020-10-20 11:21:44 -07:00
Eeshan Garg befbb953dd pypi: Release version 0.7.1. 2020-10-09 15:50:43 -02:30
Aman Agrawal d469352180 README: Fix link to virtualenv doc. 2020-09-22 13:14:55 -04:00
qedk 21f87b3e88 provision: Fix source command on Windows. 2020-09-20 20:38:07 -07:00
Aman Agrawal 5ca3548bd3 requirements: Upgrade zulint. 2020-09-20 07:33:36 -04:00
Thomas Michelat 3630208389
api: Add binding for moving topics between streams.
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)
2020-09-14 15:13:10 -07:00
Kartik Srivastava 1df19c0665 api: update_user_group_members should have a user_group_id parameter.
This avoids weirdly passing an extra field in the request, and also
makes the bindings better align with the API.
2020-08-27 12:55:21 -07:00
Preet Mishra 9a4abb9f87 zulip: Add hash_util_decode() to decode server encoded URL excerpts.
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.
2020-08-25 16:08:32 -07:00
rht e992f14522 slack-bridge: Use WebClient to post message in Slack. 2020-08-25 15:55:25 -07:00
rht 47a4f258d7 slack-bridge: Update processing of members list according to new API. 2020-08-25 15:55:25 -07:00
rht 89d0dd56b9 slack-bridge: Fall back to real_name when display_name is empty.
This will intentionally raise exception when a real_name field of a user
is empty.
2020-08-25 15:55:25 -07:00
rht 02867979ee bridge: Initialize bridge_with_slack. 2020-08-25 15:55:25 -07:00
Kartik Srivastava 0e98533186 api: Implement GET /users/{user_id}/subscriptions/{stream_id} endpoint. 2020-08-14 16:22:12 -07:00
rht f529bc0d01 IRC bridge: Add documentation on nick password. 2020-08-10 17:12:04 -07:00
rht fe2a4d6fe8 [BUGFIX] IRC bridge: Use connection initialized from aio_reactor.
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'
```
2020-08-10 17:12:04 -07:00
Kartik Srivastava 36071821c3 api: Update type annotation in 'remove_subscriptions'.
This updates the type annotation for the 'principals' argument
to accept a list of email addresses as well as user ids.
2020-08-10 16:38:39 -07:00
Alex Vandiver 9745ec9ceb doc: Document the backoff class better. 2020-08-10 15:07:01 -07:00
Alex Vandiver 7a7cfe637e zephyr: Mark the infinite loops as NoReturn. 2020-08-10 15:07:01 -07:00
Alex Vandiver a20c9cc6d7 zephyr: Use exponential backoffs in retry loops.
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.
2020-08-10 15:07:01 -07:00
rht 8670cce8e9 Matrix bridge: Change the condition of not_from_zulip_bot. 2020-08-07 08:15:07 -04:00
Kartik Srivastava 20e7f197e3 api: Implement DELETE /realm/emoji/{emoji_name}. 2020-08-03 10:29:38 -07:00
Anders Kaseorg 396ef1d11a Update zulipchat.com emails to zulip.com.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-06-11 21:06:58 -07:00
Anders Kaseorg 5f81eb3a70 Update zulipchat.com links to zulip.com.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-06-11 21:06:58 -07:00
Aman Agrawal ad8a9dd56d requirements: Bump zulint. 2020-06-07 14:01:53 -07:00