mirror of
https://github.com/zulip/zulip.git
synced 2025-11-02 21:13:36 +00:00
queue_processors, python_examples: Fix mypy errors.
zerver/openapi/python_examples.py:105: error: Argument 1 to "get_user_presence" of "Client" has incompatible type "str"; expected "Dict[str, Any]"
zerver/openapi/python_examples.py:563: error: Argument 1 to "add_reaction" of "Client" has incompatible type "Dict[str, object]"; expected "Dict[str, str]"
zerver/openapi/python_examples.py:576: error: Argument 1 to "remove_reaction" of "Client" has incompatible type "Dict[str, object]"; expected "Dict[str, str]"
zerver/worker/queue_processors.py:587: error: Argument "client" to "extract_query_without_mention" has incompatible type "EmbeddedBotHandler"; expected "ExternalBotHandler"
These were only missed because mypy daemon mode requires us to set
`follow_imports = skip` for the `zulip` package.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
This commit is contained in:
committed by
Tim Abbott
parent
bfc5617f04
commit
a5596011a0
6
mypy.ini
6
mypy.ini
@@ -96,6 +96,12 @@ follow_imports = skip
|
||||
[mypy-zulint.printer]
|
||||
follow_imports = skip
|
||||
|
||||
[mypy-zulip_bots.custom_exceptions]
|
||||
follow_imports = skip
|
||||
|
||||
[mypy-zulip_bots.lib]
|
||||
follow_imports = skip
|
||||
|
||||
|
||||
#
|
||||
#
|
||||
|
||||
@@ -132,8 +132,8 @@ python-magic==0.4.15
|
||||
# these tightly, including fetching content not included in the normal
|
||||
# release tarballs (which is a bug). So we need to pin it makes sense
|
||||
# to pin a version from Git rather than a release.
|
||||
-e "git+https://github.com/zulip/python-zulip-api.git@0.6.1#egg=zulip==0.6.1_git&subdirectory=zulip"
|
||||
-e "git+https://github.com/zulip/python-zulip-api.git@0.6.1#egg=zulip_bots==0.6.1+git&subdirectory=zulip_bots"
|
||||
-e "git+https://github.com/zulip/python-zulip-api.git@804501610b6a205334e71b4e441fca60acf650da#egg=zulip==0.6.1_git&subdirectory=zulip"
|
||||
-e "git+https://github.com/zulip/python-zulip-api.git@804501610b6a205334e71b4e441fca60acf650da#egg=zulip_bots==0.6.1+git&subdirectory=zulip_bots"
|
||||
|
||||
# Used for Hesiod lookups, etc.
|
||||
py3dns==3.2.0
|
||||
|
||||
@@ -14,8 +14,8 @@ git+https://github.com/zulip/line_profiler.git#egg=line_profiler==2.1.2.zulip1
|
||||
git+https://github.com/zulip/talon.git@7d8bdc4dbcfcc5a73298747293b99fe53da55315#egg=talon==1.2.10.zulip1
|
||||
git+https://github.com/zulip/ultrajson@70ac02bec#egg=ujson==1.35+git
|
||||
git+https://github.com/zulip/zulint@aaed679f1ad38b230090eadd3870b7682500f60c#egg=zulint==0.0.1
|
||||
git+https://github.com/zulip/python-zulip-api.git@0.6.1#egg=zulip==0.6.1_git&subdirectory=zulip
|
||||
git+https://github.com/zulip/python-zulip-api.git@0.6.1#egg=zulip_bots==0.6.1+git&subdirectory=zulip_bots
|
||||
git+https://github.com/zulip/python-zulip-api.git@804501610b6a205334e71b4e441fca60acf650da#egg=zulip==0.6.1_git&subdirectory=zulip
|
||||
git+https://github.com/zulip/python-zulip-api.git@804501610b6a205334e71b4e441fca60acf650da#egg=zulip_bots==0.6.1+git&subdirectory=zulip_bots
|
||||
alabaster==0.7.12 # via sphinx
|
||||
apns2==0.5.0
|
||||
argon2-cffi==19.1.0
|
||||
@@ -179,7 +179,6 @@ twilio==6.29.2
|
||||
twisted==19.2.1
|
||||
typed-ast==1.4.0 # via mypy
|
||||
typing-extensions==3.7.4
|
||||
typing==3.6.6
|
||||
urllib3==1.25.3 # via botocore, requests, transifex-client
|
||||
virtualenv-clone==0.5.3
|
||||
w3lib==1.20.0 # via parsel, scrapy
|
||||
|
||||
@@ -13,8 +13,8 @@ git+https://github.com/zulip/libthumbor.git@60ed2431c07686a12f2770b2d852c5650f3c
|
||||
git+https://github.com/zulip/line_profiler.git#egg=line_profiler==2.1.2.zulip1
|
||||
git+https://github.com/zulip/talon.git@7d8bdc4dbcfcc5a73298747293b99fe53da55315#egg=talon==1.2.10.zulip1
|
||||
git+https://github.com/zulip/ultrajson@70ac02bec#egg=ujson==1.35+git
|
||||
git+https://github.com/zulip/python-zulip-api.git@0.6.1#egg=zulip==0.6.1_git&subdirectory=zulip
|
||||
git+https://github.com/zulip/python-zulip-api.git@0.6.1#egg=zulip_bots==0.6.1+git&subdirectory=zulip_bots
|
||||
git+https://github.com/zulip/python-zulip-api.git@804501610b6a205334e71b4e441fca60acf650da#egg=zulip==0.6.1_git&subdirectory=zulip
|
||||
git+https://github.com/zulip/python-zulip-api.git@804501610b6a205334e71b4e441fca60acf650da#egg=zulip_bots==0.6.1+git&subdirectory=zulip_bots
|
||||
apns2==0.5.0
|
||||
argon2-cffi==19.1.0
|
||||
asn1crypto==0.24.0 # via cryptography
|
||||
@@ -113,7 +113,6 @@ stripe==2.21.0
|
||||
tornado==4.5.3
|
||||
traitlets==4.3.2 # via ipython
|
||||
twilio==6.29.2
|
||||
typing==3.6.6
|
||||
typing_extensions==3.7.4
|
||||
urllib3==1.25.3 # via requests
|
||||
uwsgi==2.0.17.1
|
||||
|
||||
@@ -26,4 +26,4 @@ LATEST_RELEASE_ANNOUNCEMENT = "https://blog.zulip.org/2019/03/01/zulip-2-0-relea
|
||||
# historical commits sharing the same major version, in which case a
|
||||
# minor version bump suffices.
|
||||
|
||||
PROVISION_VERSION = '48.1'
|
||||
PROVISION_VERSION = '49.0'
|
||||
|
||||
@@ -605,7 +605,7 @@ def send_message(client):
|
||||
def add_reaction(client, message_id):
|
||||
# type: (Client, int) -> None
|
||||
request = {
|
||||
'message_id': message_id,
|
||||
'message_id': str(message_id),
|
||||
'emoji_name': 'joy',
|
||||
'emoji_code': '1f602',
|
||||
'emoji_type': 'unicode_emoji'
|
||||
@@ -618,7 +618,7 @@ def add_reaction(client, message_id):
|
||||
def remove_reaction(client, message_id):
|
||||
# type: (Client, int) -> None
|
||||
request = {
|
||||
'message_id': message_id,
|
||||
'message_id': str(message_id),
|
||||
'emoji_name': 'joy',
|
||||
'emoji_code': '1f602',
|
||||
'reaction_type': 'unicode_emoji'
|
||||
|
||||
@@ -44,7 +44,7 @@ from zerver.lib.redis_utils import get_redis_client
|
||||
from zerver.context_processors import common_context
|
||||
from zerver.lib.outgoing_webhook import do_rest_call, get_outgoing_webhook_service_handler
|
||||
from zerver.models import get_bot_services, RealmAuditLog
|
||||
from zulip_bots.lib import extract_query_without_mention
|
||||
from zulip_bots.lib import ExternalBotHandler, extract_query_without_mention
|
||||
from zerver.lib.bot_lib import EmbeddedBotHandler, get_bot_handler, EmbeddedBotQuitException
|
||||
from zerver.lib.exceptions import RateLimited
|
||||
from zerver.lib.export import export_realm_wrapper
|
||||
@@ -586,7 +586,7 @@ class EmbeddedBotWorker(QueueProcessingWorker):
|
||||
if event['trigger'] == 'mention':
|
||||
message['content'] = extract_query_without_mention(
|
||||
message=message,
|
||||
client=self.get_bot_api_client(user_profile),
|
||||
client=cast(ExternalBotHandler, self.get_bot_api_client(user_profile)),
|
||||
)
|
||||
assert message['content'] is not None
|
||||
bot_handler.handle_message(
|
||||
|
||||
Reference in New Issue
Block a user