Commit graph

2258 commits

Author SHA1 Message Date
PIG208 0b35ed0a93 terminal: Extract message server from the handler.
This makes the user and the bot to share the message server when
sending messages. As a result, the message id can be shared. And history
messages sent by the user will be stored as well.
2021-05-24 14:22:29 -07:00
PIG208 fb77f4bad4 terminal: Apply BotHandler for TerminalBotHandler. 2021-05-24 14:22:29 -07:00
rht 05eaaff802 slack-bridge: Order imports properly. 2021-05-24 14:17:38 -07:00
rht 5b2da94ba5 slack-bridge: Use threading instead of multiprocessing.
This will fix the bug reported in
https://chat.zulip.org/#narrow/stream/127-integrations/topic/bridge_with_slack/near/1182555,
which is specific to macOS.

The error message is
```
AttributeError: Can't pickle local object 'SlackBridge.zulip_to_slack.<locals>._zulip_to_slack'
```
2021-05-24 14:17:38 -07:00
rht 2d9cf64db8 slack-bridge: Use slack_sdk instead of the deprecated slackclient. 2021-05-24 14:17:38 -07:00
LoopThrough-i-j 470967cfdb lint: Set repository variable in tools/lint-commits.
refer to:
zulip/zulip#17506
2021-05-24 14:16:41 -07:00
PIG208 4083849b5d lint: Configure Black. 2021-05-24 14:02:51 -07:00
PIG208 74c99ac405 lint: Configure isort for py files. 2021-05-24 14:02:51 -07:00
PIG208 f537c7f4d5 lint: Disable E203 that will conflict with Black. 2021-05-24 14:02:51 -07:00
PIG208 5a17c60987 lint: Pre-fix places where Black will reformat incorrectly. 2021-05-24 14:02:51 -07:00
Eeshan Garg 63fefd2a0f pypi: Release version 0.8.0. 2021-05-19 22:44:45 -02:30
LoopThrough-i-j dda9e0a638 botserver: Fix mypy error.
Value of type "Optional[Any]" is not indexable error
was originated in PR #682. This is due to request in Flask 2.0.
2021-05-12 15:17:52 -07:00
PIG208 5b32b32914 botserver: Return a valid JSON that is acceptable to outgoing webhooks.
In zulip/zulip@b998138d3a, we introduce
a check for responses from outgoing webhooks that require them to be
a dictionary. This commit fixes the return value of the botserver view
function to accommodate with the change from the serverside.
2021-05-11 09:08:04 -07:00
Abhijeet Prasad Bodas 4d482e0ef3 zulip: Replace GET realm/filters with realm/linkifiers.
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.
2021-04-27 11:06:17 -07:00
LoopThrough-i-j 3c3c361f50 zulip: Fix call_on_each_event.
Fix Improper assignement of narrow variable outside its scope.
2021-04-26 14:14:14 -07:00
Tim Abbott 175972ce49
docs: Create FUNDING.yml. 2021-04-08 06:29:09 -07:00
Anders Kaseorg 83d4a0c217 sync-public-streams: Rewrite using an event queue.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-04-06 23:36:35 -07:00
Anders Kaseorg 15c46dce46 sync-public-streams: Fix for Python 3.
bytes are not JSON serializable.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-04-06 23:36:35 -07:00
PIG208 42aecf683e zulip-bots: Fix incrementor to handle edit time limit error.
When the incrementor attempts to edit a message that was sent long
ago, it will fail and the message will not be updated, nor will a
new message be sent.

Fixes: #673
2021-04-06 17:36:22 -07:00
Tim Abbott 4627b07396 zephyr: Decrease update frequency of sync-public-streams. 2021-04-06 15:15:42 -07:00
LoopThrough-i-j 70f457f82a zulip: Add support for additional args for Client.call_on_each_*.
- 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
2021-03-24 15:00:44 -07:00
Ganesh Pawar 262c926bbf ci: Setup Github Actions for Windows. 2021-03-11 10:04:31 -08:00
Ganesh Pawar 7b889a122b tools: Add test-main equivalent for Powershell on Windows. 2021-03-11 10:04:31 -08:00
Ganesh Pawar 68f811d4d8 ci: Avoid installing virtualenv.
virtualenv was replace with python native venv in
6ac2165.
2021-03-11 10:04:31 -08:00
rht 61abb4f59c Add list_subscriptions() back for backward compatibility. 2021-03-11 00:00:56 -08:00
rht 57e8886dfe API: Rename list_subscriptions to get_subscriptions. 2021-03-11 00:00:56 -08:00
Anders Kaseorg 503e8ed82d zephyr: Attempt to fix types.
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>
2021-03-10 23:59:15 -08:00
Anders Kaseorg 34012a4015 mypy: Add stubs for zephyr.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-10 23:59:15 -08:00
Anders Kaseorg 19f5b4f6a6 mypy: Fix exec_module type: ignore comments.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-10 09:58:18 -08:00
Anders Kaseorg f2e2f1c7ff zulip_bots: Remove fallback code for Python < 3.5.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-04 15:41:08 -08:00
Anders Kaseorg 56f4d3b2a8 simple_lib: Replace deprecated ConfigParser.readfp call.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-04 15:30:57 -08:00
Anders Kaseorg 717a549f4b mypy: Prohibit unreachable code.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-04 15:17:09 -08:00
Anders Kaseorg 30f241a126 mypy: Remove unused type: ignore comments.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-04 15:09:58 -08:00
Anders Kaseorg 5b5fda2354 Fix % formatting without a tuple.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-04 15:04:38 -08:00
Anders Kaseorg edcb894776 requirements: Upgrade mypy from 0.790 to 0.812.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-04 14:16:37 -08:00
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