Commit graph

2247 commits

Author SHA1 Message Date
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
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