lint: Pin black to avoid inconsistent formatting.
This also runs black to reformat the affected files, which had been causing failures because of upstream updates. Ideally, we need a more sophisticated toolchain for managing the versions of the dependencies instead of just requirements.txt. This should be due in a possible future cleanup. Signed-off-by: Zixuan James Li <p359101898@gmail.com>
This commit is contained in:
parent
63f46f4bbb
commit
1b8f1d6e51
22 changed files with 18 additions and 40 deletions
|
@ -1,6 +1,6 @@
|
||||||
crayons
|
crayons
|
||||||
twine
|
twine
|
||||||
black
|
black==23.3.0
|
||||||
isort
|
isort
|
||||||
flake8
|
flake8
|
||||||
mock
|
mock
|
||||||
|
|
|
@ -8,6 +8,7 @@ STREAM_NAME = "commits"
|
||||||
ZULIP_USER = "git-bot@example.com"
|
ZULIP_USER = "git-bot@example.com"
|
||||||
ZULIP_API_KEY = "0123456789abcdef0123456789abcdef"
|
ZULIP_API_KEY = "0123456789abcdef0123456789abcdef"
|
||||||
|
|
||||||
|
|
||||||
# commit_notice_destination() lets you customize where commit notices
|
# commit_notice_destination() lets you customize where commit notices
|
||||||
# are sent to with the full power of a Python function.
|
# are sent to with the full power of a Python function.
|
||||||
#
|
#
|
||||||
|
|
|
@ -5,6 +5,7 @@ from typing import Dict, Optional
|
||||||
ZULIP_USER = "openshift-bot@example.com"
|
ZULIP_USER = "openshift-bot@example.com"
|
||||||
ZULIP_API_KEY = "0123456789abcdef0123456789abcdef"
|
ZULIP_API_KEY = "0123456789abcdef0123456789abcdef"
|
||||||
|
|
||||||
|
|
||||||
# deployment_notice_destination() lets you customize where deployment notices
|
# deployment_notice_destination() lets you customize where deployment notices
|
||||||
# are sent to with the full power of a Python function.
|
# are sent to with the full power of a Python function.
|
||||||
#
|
#
|
||||||
|
|
|
@ -14,6 +14,7 @@ ZULIP_IGNORE_MISSING_STREAM = False
|
||||||
# P4_WEB = "https://p4web.example.com"
|
# P4_WEB = "https://p4web.example.com"
|
||||||
P4_WEB: Optional[str] = None
|
P4_WEB: Optional[str] = None
|
||||||
|
|
||||||
|
|
||||||
# commit_notice_destination() lets you customize where commit notices
|
# commit_notice_destination() lets you customize where commit notices
|
||||||
# are sent to with the full power of a Python function.
|
# are sent to with the full power of a Python function.
|
||||||
#
|
#
|
||||||
|
|
|
@ -4,6 +4,7 @@ from typing import Dict, Optional
|
||||||
ZULIP_USER = "svn-bot@example.com"
|
ZULIP_USER = "svn-bot@example.com"
|
||||||
ZULIP_API_KEY = "0123456789abcdef0123456789abcdef"
|
ZULIP_API_KEY = "0123456789abcdef0123456789abcdef"
|
||||||
|
|
||||||
|
|
||||||
# commit_notice_destination() lets you customize where commit notices
|
# commit_notice_destination() lets you customize where commit notices
|
||||||
# are sent to with the full power of a Python function.
|
# are sent to with the full power of a Python function.
|
||||||
#
|
#
|
||||||
|
|
|
@ -61,7 +61,7 @@ if options.sharded:
|
||||||
("tabbott-nagios-test-11", "e"),
|
("tabbott-nagios-test-11", "e"),
|
||||||
("tabbott-nagios-test-9", "f"),
|
("tabbott-nagios-test-9", "f"),
|
||||||
]
|
]
|
||||||
for (stream, test) in test_streams:
|
for stream, test in test_streams:
|
||||||
if stream == "message":
|
if stream == "message":
|
||||||
continue
|
continue
|
||||||
assert hashlib.sha1(stream.encode("utf-8")).hexdigest().startswith(test)
|
assert hashlib.sha1(stream.encode("utf-8")).hexdigest().startswith(test)
|
||||||
|
@ -73,7 +73,6 @@ else:
|
||||||
|
|
||||||
|
|
||||||
def print_status_and_exit(status: int) -> None:
|
def print_status_and_exit(status: int) -> None:
|
||||||
|
|
||||||
# The output of this script is used by Nagios. Various outputs,
|
# The output of this script is used by Nagios. Various outputs,
|
||||||
# e.g. true success and punting due to a SERVNAK, result in a
|
# e.g. true success and punting due to a SERVNAK, result in a
|
||||||
# non-alert case, so to give us something unambiguous to check in
|
# non-alert case, so to give us something unambiguous to check in
|
||||||
|
@ -127,7 +126,7 @@ except Exception:
|
||||||
|
|
||||||
# Subscribe to Zephyrs
|
# Subscribe to Zephyrs
|
||||||
zephyr_subs_to_add = []
|
zephyr_subs_to_add = []
|
||||||
for (stream, test) in test_streams:
|
for stream, test in test_streams:
|
||||||
if stream == "message":
|
if stream == "message":
|
||||||
zephyr_subs_to_add.append((stream, "personal", mit_user))
|
zephyr_subs_to_add.append((stream, "personal", mit_user))
|
||||||
else:
|
else:
|
||||||
|
@ -206,7 +205,7 @@ def gen_key(key_dict: Dict[str, Tuple[str, str]]) -> str:
|
||||||
|
|
||||||
|
|
||||||
def gen_keys(key_dict: Dict[str, Tuple[str, str]]) -> None:
|
def gen_keys(key_dict: Dict[str, Tuple[str, str]]) -> None:
|
||||||
for (stream, test) in test_streams:
|
for stream, test in test_streams:
|
||||||
key_dict[gen_key(key_dict)] = (stream, test)
|
key_dict[gen_key(key_dict)] = (stream, test)
|
||||||
|
|
||||||
|
|
||||||
|
@ -215,6 +214,7 @@ gen_keys(hzkeys)
|
||||||
|
|
||||||
notices = []
|
notices = []
|
||||||
|
|
||||||
|
|
||||||
# We check for new zephyrs multiple times, to avoid filling the zephyr
|
# We check for new zephyrs multiple times, to avoid filling the zephyr
|
||||||
# receive queue with 30+ messages, which might result in messages
|
# receive queue with 30+ messages, which might result in messages
|
||||||
# being dropped.
|
# being dropped.
|
||||||
|
@ -310,7 +310,6 @@ all_keys = set(list(zhkeys.keys()) + list(hzkeys.keys()))
|
||||||
|
|
||||||
|
|
||||||
def process_keys(content_list: List[str]) -> Tuple[Dict[str, int], Set[str], Set[str], bool, bool]:
|
def process_keys(content_list: List[str]) -> Tuple[Dict[str, int], Set[str], Set[str], bool, bool]:
|
||||||
|
|
||||||
# Start by filtering out any keys that might have come from
|
# Start by filtering out any keys that might have come from
|
||||||
# concurrent check-mirroring processes
|
# concurrent check-mirroring processes
|
||||||
content_keys = [key for key in content_list if key in all_keys]
|
content_keys = [key for key in content_list if key in all_keys]
|
||||||
|
|
|
@ -16,7 +16,6 @@ from types import FrameType
|
||||||
|
|
||||||
|
|
||||||
def die(signal: int, frame: FrameType) -> None:
|
def die(signal: int, frame: FrameType) -> None:
|
||||||
|
|
||||||
# We actually want to exit, so run os._exit (so as not to be caught and restarted)
|
# We actually want to exit, so run os._exit (so as not to be caught and restarted)
|
||||||
os._exit(1)
|
os._exit(1)
|
||||||
|
|
||||||
|
|
|
@ -222,7 +222,7 @@ def zephyr_bulk_subscribe(subs: List[Tuple[str, str, str]]) -> None:
|
||||||
finally:
|
finally:
|
||||||
zephyr_ctypes.ZFlushSubscriptions()
|
zephyr_ctypes.ZFlushSubscriptions()
|
||||||
|
|
||||||
for (cls, instance, recipient) in subs:
|
for cls, instance, recipient in subs:
|
||||||
if cls not in actual_zephyr_subs:
|
if cls not in actual_zephyr_subs:
|
||||||
logger.error(f"Zephyr failed to subscribe us to {cls}; will retry")
|
logger.error(f"Zephyr failed to subscribe us to {cls}; will retry")
|
||||||
# We'll retry automatically when we next check for
|
# We'll retry automatically when we next check for
|
||||||
|
@ -968,7 +968,7 @@ def subscribed_to_mail_messages() -> bool:
|
||||||
stored_result = os.environ.get("HUMBUG_FORWARD_MAIL_ZEPHYRS")
|
stored_result = os.environ.get("HUMBUG_FORWARD_MAIL_ZEPHYRS")
|
||||||
if stored_result is not None:
|
if stored_result is not None:
|
||||||
return stored_result == "True"
|
return stored_result == "True"
|
||||||
for (cls, instance, recipient) in parse_zephyr_subs(verbose=False):
|
for cls, instance, recipient in parse_zephyr_subs(verbose=False):
|
||||||
if cls.lower() == "mail" and instance.lower() == "inbox":
|
if cls.lower() == "mail" and instance.lower() == "inbox":
|
||||||
os.environ["HUMBUG_FORWARD_MAIL_ZEPHYRS"] = "True"
|
os.environ["HUMBUG_FORWARD_MAIL_ZEPHYRS"] = "True"
|
||||||
return True
|
return True
|
||||||
|
@ -981,7 +981,7 @@ def add_zulip_subscriptions(verbose: bool) -> None:
|
||||||
|
|
||||||
zephyr_subscriptions = set()
|
zephyr_subscriptions = set()
|
||||||
skipped = set()
|
skipped = set()
|
||||||
for (cls, instance, recipient) in parse_zephyr_subs(verbose=verbose):
|
for cls, instance, recipient in parse_zephyr_subs(verbose=verbose):
|
||||||
if cls.lower() == "message":
|
if cls.lower() == "message":
|
||||||
if recipient != "*":
|
if recipient != "*":
|
||||||
# We already have a (message, *, you) subscription, so
|
# We already have a (message, *, you) subscription, so
|
||||||
|
@ -1079,7 +1079,7 @@ Zulip subscription to these lines in ~/.zephyr.subs:
|
||||||
+ "\n"
|
+ "\n"
|
||||||
)
|
)
|
||||||
|
|
||||||
for (cls, instance, recipient, reason) in skipped:
|
for cls, instance, recipient, reason in skipped:
|
||||||
if verbose:
|
if verbose:
|
||||||
if reason != "":
|
if reason != "":
|
||||||
logger.info(f" [{cls},{instance},{recipient}] ({reason})")
|
logger.info(f" [{cls},{instance},{recipient}] ({reason})")
|
||||||
|
|
|
@ -148,7 +148,6 @@ def add_default_arguments(
|
||||||
patch_error_handling: bool = True,
|
patch_error_handling: bool = True,
|
||||||
allow_provisioning: bool = False,
|
allow_provisioning: bool = False,
|
||||||
) -> argparse.ArgumentParser:
|
) -> argparse.ArgumentParser:
|
||||||
|
|
||||||
if patch_error_handling:
|
if patch_error_handling:
|
||||||
|
|
||||||
def custom_error_handling(self: argparse.ArgumentParser, message: str) -> None:
|
def custom_error_handling(self: argparse.ArgumentParser, message: str) -> None:
|
||||||
|
@ -286,7 +285,6 @@ def generate_option_group(parser: optparse.OptionParser, prefix: str = "") -> op
|
||||||
|
|
||||||
|
|
||||||
def init_from_options(options: Any, client: Optional[str] = None) -> "Client":
|
def init_from_options(options: Any, client: Optional[str] = None) -> "Client":
|
||||||
|
|
||||||
if getattr(options, "provision", False):
|
if getattr(options, "provision", False):
|
||||||
requirements_path = os.path.abspath(os.path.join(sys.path[0], "requirements.txt"))
|
requirements_path = os.path.abspath(os.path.join(sys.path[0], "requirements.txt"))
|
||||||
try:
|
try:
|
||||||
|
@ -521,7 +519,6 @@ class Client:
|
||||||
assert self.zulip_version is not None
|
assert self.zulip_version is not None
|
||||||
|
|
||||||
def ensure_session(self) -> None:
|
def ensure_session(self) -> None:
|
||||||
|
|
||||||
# Check if the session has been created already, and return
|
# Check if the session has been created already, and return
|
||||||
# immediately if so.
|
# immediately if so.
|
||||||
if self.session:
|
if self.session:
|
||||||
|
@ -593,7 +590,7 @@ class Client:
|
||||||
request = {}
|
request = {}
|
||||||
req_files = []
|
req_files = []
|
||||||
|
|
||||||
for (key, val) in orig_request.items():
|
for key, val in orig_request.items():
|
||||||
if isinstance(val, str) or isinstance(val, str):
|
if isinstance(val, str) or isinstance(val, str):
|
||||||
request[key] = val
|
request[key] = val
|
||||||
else:
|
else:
|
||||||
|
@ -728,7 +725,7 @@ class Client:
|
||||||
if request is None:
|
if request is None:
|
||||||
request = dict()
|
request = dict()
|
||||||
marshalled_request = {}
|
marshalled_request = {}
|
||||||
for (k, v) in request.items():
|
for k, v in request.items():
|
||||||
if v is not None:
|
if v is not None:
|
||||||
marshalled_request[k] = v
|
marshalled_request[k] = v
|
||||||
versioned_url = API_VERSTRING + (url if url is not None else "")
|
versioned_url = API_VERSTRING + (url if url is not None else "")
|
||||||
|
@ -752,7 +749,6 @@ class Client:
|
||||||
narrow = []
|
narrow = []
|
||||||
|
|
||||||
def do_register() -> Tuple[str, int]:
|
def do_register() -> Tuple[str, int]:
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
if event_types is None:
|
if event_types is None:
|
||||||
res = self.register(None, None, **kwargs)
|
res = self.register(None, None, **kwargs)
|
||||||
|
@ -841,7 +837,6 @@ class Client:
|
||||||
return self.call_endpoint(url="messages", method="GET", request=message_filters)
|
return self.call_endpoint(url="messages", method="GET", request=message_filters)
|
||||||
|
|
||||||
def check_messages_match_narrow(self, **request: Dict[str, Any]) -> Dict[str, Any]:
|
def check_messages_match_narrow(self, **request: Dict[str, Any]) -> Dict[str, Any]:
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Example usage:
|
Example usage:
|
||||||
|
|
||||||
|
@ -1278,7 +1273,6 @@ class Client:
|
||||||
)
|
)
|
||||||
|
|
||||||
def add_default_stream(self, stream_id: int) -> Dict[str, Any]:
|
def add_default_stream(self, stream_id: int) -> Dict[str, Any]:
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Example usage:
|
Example usage:
|
||||||
|
|
||||||
|
@ -1292,7 +1286,6 @@ class Client:
|
||||||
)
|
)
|
||||||
|
|
||||||
def get_user_by_id(self, user_id: int, **request: Any) -> Dict[str, Any]:
|
def get_user_by_id(self, user_id: int, **request: Any) -> Dict[str, Any]:
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Example usage:
|
Example usage:
|
||||||
|
|
||||||
|
@ -1306,7 +1299,6 @@ class Client:
|
||||||
)
|
)
|
||||||
|
|
||||||
def deactivate_user_by_id(self, user_id: int) -> Dict[str, Any]:
|
def deactivate_user_by_id(self, user_id: int) -> Dict[str, Any]:
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Example usage:
|
Example usage:
|
||||||
|
|
||||||
|
@ -1319,7 +1311,6 @@ class Client:
|
||||||
)
|
)
|
||||||
|
|
||||||
def reactivate_user_by_id(self, user_id: int) -> Dict[str, Any]:
|
def reactivate_user_by_id(self, user_id: int) -> Dict[str, Any]:
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Example usage:
|
Example usage:
|
||||||
|
|
||||||
|
@ -1332,7 +1323,6 @@ class Client:
|
||||||
)
|
)
|
||||||
|
|
||||||
def update_user_by_id(self, user_id: int, **request: Any) -> Dict[str, Any]:
|
def update_user_by_id(self, user_id: int, **request: Any) -> Dict[str, Any]:
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Example usage:
|
Example usage:
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,6 @@ class TestDefineBot(BotTestCase, DefaultTests):
|
||||||
bot_name = "define"
|
bot_name = "define"
|
||||||
|
|
||||||
def test_bot(self) -> None:
|
def test_bot(self) -> None:
|
||||||
|
|
||||||
# Only one type(noun) of word.
|
# Only one type(noun) of word.
|
||||||
bot_response = (
|
bot_response = (
|
||||||
"**cat**:\n\n* (**noun**) a small domesticated carnivorous mammal "
|
"**cat**:\n\n* (**noun**) a small domesticated carnivorous mammal "
|
||||||
|
|
|
@ -14,6 +14,7 @@ You can send messages to any Flock user associated with your account from Zulip.
|
||||||
*Syntax*: **@botname to: message** where `to` is **firstName** of recipient.
|
*Syntax*: **@botname to: message** where `to` is **firstName** of recipient.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
# Matches the recipient name provided by user with list of users in his contacts.
|
# Matches the recipient name provided by user with list of users in his contacts.
|
||||||
# If matches, returns the matched User's ID
|
# If matches, returns the matched User's ID
|
||||||
def find_recipient_id(users: List[Any], recipient_name: str) -> str:
|
def find_recipient_id(users: List[Any], recipient_name: str) -> str:
|
||||||
|
|
|
@ -5,7 +5,6 @@ from zulip_bots.game_handler import BadMoveException, GameAdapter
|
||||||
|
|
||||||
|
|
||||||
class GameOfFifteenModel:
|
class GameOfFifteenModel:
|
||||||
|
|
||||||
final_board = [[0, 1, 2], [3, 4, 5], [6, 7, 8]]
|
final_board = [[0, 1, 2], [3, 4, 5], [6, 7, 8]]
|
||||||
|
|
||||||
initial_board = [[8, 7, 6], [5, 4, 3], [2, 1, 0]]
|
initial_board = [[8, 7, 6], [5, 4, 3], [2, 1, 0]]
|
||||||
|
@ -84,7 +83,6 @@ class GameOfFifteenModel:
|
||||||
|
|
||||||
|
|
||||||
class GameOfFifteenMessageHandler:
|
class GameOfFifteenMessageHandler:
|
||||||
|
|
||||||
tiles = {
|
tiles = {
|
||||||
"0": ":grey_question:",
|
"0": ":grey_question:",
|
||||||
"1": ":one:",
|
"1": ":one:",
|
||||||
|
|
|
@ -82,7 +82,7 @@ def parse_answer(query: str) -> Tuple[str, str]:
|
||||||
def generate_ticket_id(storage: Any) -> str:
|
def generate_ticket_id(storage: Any) -> str:
|
||||||
try:
|
try:
|
||||||
incident_num = storage.get("ticket_id")
|
incident_num = storage.get("ticket_id")
|
||||||
except (KeyError):
|
except KeyError:
|
||||||
incident_num = 0
|
incident_num = 0
|
||||||
incident_num += 1
|
incident_num += 1
|
||||||
incident_num = incident_num % (1000)
|
incident_num = incident_num % (1000)
|
||||||
|
|
|
@ -62,17 +62,14 @@ def beat(message, topic_name, merels_storage):
|
||||||
if match is None:
|
if match is None:
|
||||||
return unknown_command()
|
return unknown_command()
|
||||||
if match.group(1) is not None and match.group(2) is not None and match.group(3) is not None:
|
if match.group(1) is not None and match.group(2) is not None and match.group(3) is not None:
|
||||||
|
|
||||||
responses = ""
|
responses = ""
|
||||||
command = match.group(1)
|
command = match.group(1)
|
||||||
|
|
||||||
if command.lower() == "move":
|
if command.lower() == "move":
|
||||||
|
|
||||||
p1 = [int(x) for x in match.group(2).split(",")]
|
p1 = [int(x) for x in match.group(2).split(",")]
|
||||||
p2 = [int(x) for x in match.group(3).split(",")]
|
p2 = [int(x) for x in match.group(3).split(",")]
|
||||||
|
|
||||||
if mechanics.get_take_status(topic_name, merels_storage) == 1:
|
if mechanics.get_take_status(topic_name, merels_storage) == 1:
|
||||||
|
|
||||||
raise BadMoveException("Take is required to proceed." " Please try again.\n")
|
raise BadMoveException("Take is required to proceed." " Please try again.\n")
|
||||||
|
|
||||||
responses += mechanics.move_man(topic_name, p1, p2, merels_storage) + "\n"
|
responses += mechanics.move_man(topic_name, p1, p2, merels_storage) + "\n"
|
||||||
|
|
|
@ -6,7 +6,6 @@ class TestStackoverflowBot(BotTestCase, DefaultTests):
|
||||||
bot_name = "stack_overflow"
|
bot_name = "stack_overflow"
|
||||||
|
|
||||||
def test_bot(self) -> None:
|
def test_bot(self) -> None:
|
||||||
|
|
||||||
# Single-word query
|
# Single-word query
|
||||||
bot_request = "restful"
|
bot_request = "restful"
|
||||||
bot_response = """For search term:restful
|
bot_response = """For search term:restful
|
||||||
|
|
|
@ -92,7 +92,6 @@ def get_trivia_quiz() -> Dict[str, Any]:
|
||||||
|
|
||||||
|
|
||||||
def get_trivia_payload() -> Dict[str, Any]:
|
def get_trivia_payload() -> Dict[str, Any]:
|
||||||
|
|
||||||
url = "https://opentdb.com/api.php?amount=1&type=multiple"
|
url = "https://opentdb.com/api.php?amount=1&type=multiple"
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -31,7 +31,6 @@ class TestWeatherBot(BotTestCase, DefaultTests):
|
||||||
self._test("", self.help_content)
|
self._test("", self.help_content)
|
||||||
|
|
||||||
def test_bot(self) -> None:
|
def test_bot(self) -> None:
|
||||||
|
|
||||||
# City query
|
# City query
|
||||||
bot_response = "Weather in New York, US:\n71.33 F / 21.85 C\nMist"
|
bot_response = "Weather in New York, US:\n71.33 F / 21.85 C\nMist"
|
||||||
self._test("New York", bot_response, "test_only_city")
|
self._test("New York", bot_response, "test_only_city")
|
||||||
|
|
|
@ -6,7 +6,6 @@ class TestWikipediaBot(BotTestCase, DefaultTests):
|
||||||
bot_name = "wikipedia"
|
bot_name = "wikipedia"
|
||||||
|
|
||||||
def test_bot(self) -> None:
|
def test_bot(self) -> None:
|
||||||
|
|
||||||
# Single-word query
|
# Single-word query
|
||||||
bot_request = "happy"
|
bot_request = "happy"
|
||||||
bot_response = """For search term:happy
|
bot_response = """For search term:happy
|
||||||
|
|
|
@ -44,7 +44,6 @@ class YoutubeHandler:
|
||||||
logging.warning("Bad connection")
|
logging.warning("Bad connection")
|
||||||
|
|
||||||
def handle_message(self, message: Dict[str, str], bot_handler: BotHandler) -> None:
|
def handle_message(self, message: Dict[str, str], bot_handler: BotHandler) -> None:
|
||||||
|
|
||||||
if message["content"] == "" or message["content"] == "help":
|
if message["content"] == "" or message["content"] == "help":
|
||||||
bot_handler.send_reply(message, self.help_content)
|
bot_handler.send_reply(message, self.help_content)
|
||||||
else:
|
else:
|
||||||
|
@ -55,7 +54,6 @@ class YoutubeHandler:
|
||||||
|
|
||||||
|
|
||||||
def search_youtube(query: str, key: str, region: str, max_results: int = 1) -> List[List[str]]:
|
def search_youtube(query: str, key: str, region: str, max_results: int = 1) -> List[List[str]]:
|
||||||
|
|
||||||
videos = []
|
videos = []
|
||||||
params = {
|
params = {
|
||||||
"part": "id,snippet",
|
"part": "id,snippet",
|
||||||
|
@ -96,7 +94,6 @@ def get_command_query(message: Dict[str, str]) -> Tuple[Optional[str], str]:
|
||||||
def get_bot_response(
|
def get_bot_response(
|
||||||
query: Optional[str], command: Optional[str], config_info: Dict[str, str]
|
query: Optional[str], command: Optional[str], config_info: Dict[str, str]
|
||||||
) -> str:
|
) -> str:
|
||||||
|
|
||||||
key = config_info["key"]
|
key = config_info["key"]
|
||||||
max_results = int(config_info["number_of_results"])
|
max_results = int(config_info["number_of_results"])
|
||||||
region = config_info["video_region"]
|
region = config_info["video_region"]
|
||||||
|
|
|
@ -176,7 +176,6 @@ def use_storage(storage: BotStorage, keys: List[str]) -> Iterator[BotStorage]:
|
||||||
|
|
||||||
|
|
||||||
class BotHandler(Protocol):
|
class BotHandler(Protocol):
|
||||||
|
|
||||||
user_id: int
|
user_id: int
|
||||||
email: str
|
email: str
|
||||||
full_name: str
|
full_name: str
|
||||||
|
|
|
@ -145,7 +145,7 @@ class BotTestCase(unittest.TestCase):
|
||||||
# Start a new message handler for the full conversation.
|
# Start a new message handler for the full conversation.
|
||||||
bot, bot_handler = self._get_handlers()
|
bot, bot_handler = self._get_handlers()
|
||||||
|
|
||||||
for (request, expected_response) in conversation:
|
for request, expected_response in conversation:
|
||||||
message = self.make_request_message(request)
|
message = self.make_request_message(request)
|
||||||
bot_handler.reset_transcript()
|
bot_handler.reset_transcript()
|
||||||
bot.handle_message(message, bot_handler)
|
bot.handle_message(message, bot_handler)
|
||||||
|
|
|
@ -13,7 +13,6 @@ from zulip_bots.lib import extract_query_without_mention
|
||||||
|
|
||||||
|
|
||||||
class TestDefaultArguments(TestCase):
|
class TestDefaultArguments(TestCase):
|
||||||
|
|
||||||
our_dir = os.path.dirname(__file__)
|
our_dir = os.path.dirname(__file__)
|
||||||
path_to_bot = os.path.abspath(os.path.join(our_dir, "../bots/giphy/giphy.py"))
|
path_to_bot = os.path.abspath(os.path.join(our_dir, "../bots/giphy/giphy.py"))
|
||||||
packaged_bot_module = MagicMock(__version__="1.0.0")
|
packaged_bot_module = MagicMock(__version__="1.0.0")
|
||||||
|
|
Loading…
Add table
Reference in a new issue