Without universal_newlines=True or text=True, subprocess.check_output
returns bytes, not str, so it makes no sense to compare its return to
"true". But upstream Git’s behavior only depends on the filename, not
whether the repository is bare; emulate this more closely.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
Add packaged_helloworld as an example of a PyPI package setup for
an external zulip bot that can be installed via pip and lanuched
without the need to include it in the zulip_bots/bots directory.
Now we will be able to execute `zulip-run-bot` with the `-r` argument
to search for and run bots from the `zulip_bots.registry` entry_point.
Each entry point should have the name correspond to the bot name,
and have the value be the bot module. E.g, an Python package for a
bot called "packaged_bot" should have an `entry_points` setup like
the following:
setup(
...
entry_points={
"zulip_bot.registry":[
"packaged_bot=packaged_bot.packaged_bot"
]
}
...
)
whose file structure may look like this:
packaged_bot/
├───packaged_bot/
| ├───packaged_bot.py # The bot module
| ├───test_packaged_bot.py
| ├───packaged_bot.conf
| └───doc.md
└───setup.py # Register the entry points here
Add test case.
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>
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.
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
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.