Commit graph

2278 commits

Author SHA1 Message Date
anehls93
71d488e560 zulip_bots: Add doc.md for game_of_fifteen bot.
Finishes #513.
2021-06-28 12:40:20 -02:30
PIG208
df60a1ac03 matrix: Fix test failure brought by the hint for usernames change.
Fixes a188a4e72a.
2021-06-28 11:35:54 -02:30
Tim Abbott
a188a4e72a matrix: Better hint the format for Matrix usernames. 2021-06-17 14:04:38 -07:00
Anders Kaseorg
d1b3ac8d94 gitlint-rules: Remove convoluted binary search for imperative forms.
This also fixes the suggestions for the following words: disabled,
disables, disabling, implemented, implementing, implements, kept,
made, took, using.

(Copied from zulip/zulip@91f048c056a66eb78a102c095e714eff5f28e36e.)

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-06-14 13:36:30 -07:00
PIG208
9ce7c52a10 pyupgrade: Reformat with --py36-plus.
This includes mainly fixes of string literals using f-strings or
.format(...), as well as unpacking of list comprehensions.
2021-06-02 18:45:57 -07:00
PIG208
e27ac0ddbe pyupgrade: Replace Text with str.
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.
2021-06-02 18:45:57 -07:00
PIG208
a54cccc012 lint: Add black as a linter. 2021-06-02 18:45:57 -07:00
PIG208
c4edf4bd2f lint: Add isort as a linter. 2021-06-02 18:45:57 -07:00
PIG208
6f3f9bf7e4 black: Reformat without skipping string normalization. 2021-06-02 18:45:57 -07:00
PIG208
fba21bb00d black: Reformat skipping string normalization. 2021-06-02 18:45:57 -07:00
PIG208
5580c68ae5 isort: Reformat using isort. 2021-06-02 18:45:57 -07:00
PIG208
37e2596124 zulip_bots: Add docstrings and comments for TerminalBotHandler. 2021-05-27 23:52:07 -07:00
PIG208
d949f2024f zulip_bots: Rename SimpleMessageServer to MockMessageServer.
Given that the purpose of this message server is solely for testing,
we rename it for clarity.
2021-05-27 23:52:07 -07:00
rht
5f21952b77 Add click as req in setup.py for zulip-cli. 2021-05-27 23:51:32 -07:00
PIG208
bd27631dd1 zulip-bots: Yield cache storage instead bot storage.
Fixes the bug that the context manager doesn't actually manage the
storage.
2021-05-27 23:49:41 -07:00
rht
06bbfd752e Initialize CLI interface for python-zulip-api. 2021-05-24 14:35:02 -07:00
PIG208
b8389b78c1 zulip-bots: Use context manager for incrementor. 2021-05-24 14:30:19 -07:00
PIG208
86fa9f5e35 zulip-bots: Implement context manager.
The context manager is implemented based on a newly added storage called
CachedStorage. It is a bufferred storage that doesn't sync with the
database until it's flushed. With CachedStorage, we can implement the
context manager easily by loading all the data on __enter__ and just
flush all the modified (dirty) data on __exit__. This approach can help
the user minimize the number of round-trips to the server almost
invisibly (despite the fact that they need to use it with "with").

Fixes: #679
2021-05-24 14:30:19 -07:00
PIG208
e0723c1db4 zulip-bots: Move protocols for context manager. 2021-05-24 14:30:19 -07:00
PIG208
b04f5f9753 terminal: Implement react for TerminalBotHandler.
Fixes: #686
2021-05-24 14:22:29 -07:00
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
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