Commit graph

581 commits

Author SHA1 Message Date
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
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
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
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
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
Eeshan Garg befbb953dd pypi: Release version 0.7.1. 2020-10-09 15:50:43 -02:30
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
Lunatic Luna 3b1ef57694 bots: Support adding reactions to message for a bot.
It adds a react() function that allows a bot to react to a message in lib.py.
It adds an example of the use of react() function and its test.

The changes are in the following files:
  - lib.py
  - helloworld.py
  - tests/test_lib.py
  - test_lib.py
2020-05-08 10:46:56 -04:00
neiljp (Neil Pilgrim) 540d453237 setup.py: Add Source & Documentation project_urls.
The only existing url points to zulip.org -> zulipchat.com
2020-05-05 09:20:50 -04:00
pemontto a9268a1947 jira: Add JQL search command. 2020-04-28 12:46:40 -07:00
pemontto a46dae37f5 jira: Add search command. 2020-04-28 12:46:40 -07:00
pemontto b0c2b1b9c8 jira: Use display_url in output. 2020-04-28 12:45:36 -07:00
pemontto 3ca336246d jira: Allow overriding https. 2020-04-28 12:45:36 -07:00
pemontto ae8a3516fb jira: Fix deprecation warning. 2020-04-28 12:45:36 -07:00
Rohitt Vashishtha bdf0c7ff5c bots: Use ids for sending message. 2020-04-28 11:56:16 -04:00
Rohitt Vashishtha 5c32054415 bots: Do not reply in group PMs unless explicitly mentioned.
Previously, if a bot was accidentally added to a group PM, we would
have no option but to leave that conversation because the bot would
reply to all the messages sent in that conversation. This also has
potential to cause infinite loops in case two bots are added to a
group PM since they could keep on replying to each other's messages.

Fixes #551.
2020-04-28 11:56:16 -04:00
Rohitt Vashishtha fe78a363b0 bots: Do not remove self from list of recipients in group PMs.
The origin of this line seems like an arbitary decision when writing the
wikipedia bot in ad25f27853. Removing self
doesn't have any other significance, and not making any changes to the
recipient list helps with https://github.com/zulip/zulip/issues/14228.

Fixes #552.
2020-04-28 11:56:16 -04:00
Eeshan Garg 1dac75f979 pypi: Release version 0.7.0. 2020-04-20 23:23:58 -02:30
Anders Kaseorg 17cf26aa1f cleanup: Move line breaks before binary operators.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2020-04-18 20:31:14 -07:00
Anders Kaseorg 6f40bcf745 cleanup: Fix whitespace around parameter equals.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2020-04-18 20:31:14 -07:00
Anders Kaseorg 562fe610b7 cleanup: Fix whitespace around function annotation arrows.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2020-04-18 20:31:14 -07:00
Anders Kaseorg bd9bb0a4e8 cleanup: Fix indentation.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2020-04-18 20:31:14 -07:00
Anders Kaseorg 07c64673f7 test_jira: Remove redefined test_edit method.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2020-04-18 20:31:14 -07:00
Anders Kaseorg a01e5e37f4 cleanup: Remove more unused variables.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2020-04-18 20:31:14 -07:00
Anders Kaseorg 54b2578204 cleanup: Remove unused variables.
Generated by autoflake.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2020-04-18 20:31:14 -07:00
Anders Kaseorg f5d96dbcce cleanup: Remove duplicate imports.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2020-04-18 20:31:14 -07:00
Anders Kaseorg adde59e5c3 cleanup: Remove more unused imports.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2020-04-18 20:31:14 -07:00
Anders Kaseorg 2f6623bbc4 cleanup: Remove unused imports.
Generated by autoflake.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2020-04-18 20:31:14 -07:00
Anders Kaseorg 64d2f5ac32 test_connect_four: Expand star import.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2020-04-18 20:31:14 -07:00
Anders Kaseorg 5428c5f296 typing: Convert function type annotations to Python 3 style.
Generated by com2ann (slightly patched to avoid also converting
assignment type annotations, which require Python 3.6), followed by
some manual whitespace adjustment, and two fixes for use-before-define
issues:

-    def set_zulip_client(self, zulipToJabberClient: ZulipToJabberBot) -> None:
+    def set_zulip_client(self, zulipToJabberClient: 'ZulipToJabberBot') -> None:

-def init_from_options(options: Any, client: Optional[str] = None) -> Client:
+def init_from_options(options: Any, client: Optional[str] = None) -> 'Client':

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2020-04-18 20:31:14 -07:00
Anders Kaseorg 7c5f73dce9 salesforce: Add missing typing import. 2020-04-18 20:31:14 -07:00
Anders Kaseorg fe72f3b131 typing: Remove ‘if False’ guard for typing imports.
typing is in the Python 3.5 standard library.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2020-04-18 20:31:14 -07:00
Anders Kaseorg 1a417b1610 finder: Remove ModuleNotFoundError handler.
ModuleNotFoundError is a subclass of ImportError, which is handled on
the previous line; furthermore, it doesn’t exist in Python 3.5.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2020-04-18 20:20:53 -07:00
Anders Kaseorg d68437d5f5 Rewrite some strings using raw string syntax.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2020-04-18 15:04:36 -07:00
Anders Kaseorg e30b3b094b Modernize legacy Python 2 syntax with pyupgrade.
Generated by `pyupgrade --py3-plus --keep-percent-format` followed by
manual indentation fixes.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2020-04-18 15:04:36 -07:00
Eeshan Garg dd201926fa pypi_packages: Use README files for long descriptions. 2020-04-16 19:35:54 -07:00
Eeshan Garg c55bf78c6b pypi: Specify the correct license classifier for all packages. 2020-04-16 19:35:54 -07:00
Steve Howell 2ec5bb7b70 minor: Warn about missing usage handlers. 2020-04-05 06:53:40 -04:00
rht 4600ce59a3 Remove all remaining from __future__ imports. 2020-04-03 08:18:08 -04:00
Steve Howell 754a9f7880 bots: Remove unmaintained bots. 2020-04-01 08:41:51 -04:00
fishfred 87b57f879c bots: Fixed incorrect computer play message 2020-03-30 12:02:32 -04:00
fishfred 0a0f9e9d21 bots: Fix tictactoe, connect_four emoji 2020-03-30 12:02:32 -04:00
Eeshan Garg ce73dab121 pypi: Release version 0.6.4. 2020-03-26 19:52:46 -02:30