ruff: Fix RUF010 Use explicit conversion flag.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
parent
52a7b0b6a3
commit
63246e4369
5 changed files with 7 additions and 7 deletions
|
@ -91,7 +91,7 @@ class MatrixToZulip:
|
||||||
return matrix_to_zulip
|
return matrix_to_zulip
|
||||||
|
|
||||||
async def _matrix_to_zulip(self, room: nio.MatrixRoom, event: nio.Event) -> None:
|
async def _matrix_to_zulip(self, room: nio.MatrixRoom, event: nio.Event) -> None:
|
||||||
logging.debug(f"_matrix_to_zulip; room {str(room.room_id)}, event: {str(event)}")
|
logging.debug(f"_matrix_to_zulip; room {room.room_id}, event: {event}")
|
||||||
|
|
||||||
# We do this to identify the messages generated from Zulip -> Matrix
|
# We do this to identify the messages generated from Zulip -> Matrix
|
||||||
# and we make sure we don't forward it again to the Zulip stream.
|
# and we make sure we don't forward it again to the Zulip stream.
|
||||||
|
@ -253,7 +253,7 @@ class ZulipToMatrix:
|
||||||
raise Bridge_FatalMatrixException(str(result))
|
raise Bridge_FatalMatrixException(str(result))
|
||||||
|
|
||||||
def _zulip_to_matrix(self, msg: Dict[str, Any]) -> None:
|
def _zulip_to_matrix(self, msg: Dict[str, Any]) -> None:
|
||||||
logging.debug(f"_zulip_to_matrix; msg: {str(msg)}")
|
logging.debug(f"_zulip_to_matrix; msg: {msg}")
|
||||||
|
|
||||||
room_id: Optional[str] = self.get_matrix_room_for_zulip_message(msg)
|
room_id: Optional[str] = self.get_matrix_room_for_zulip_message(msg)
|
||||||
if room_id is None:
|
if room_id is None:
|
||||||
|
@ -485,7 +485,7 @@ def read_configuration(config_file: str) -> Dict[str, Dict[str, Any]]:
|
||||||
if section.startswith("additional_bridge"):
|
if section.startswith("additional_bridge"):
|
||||||
if section_keys != bridge_key_set:
|
if section_keys != bridge_key_set:
|
||||||
raise Bridge_ConfigException(
|
raise Bridge_ConfigException(
|
||||||
f"Please ensure the bridge configuration section {section} contain the following keys: {str(bridge_key_set)}."
|
f"Please ensure the bridge configuration section {section} contain the following keys: {bridge_key_set}."
|
||||||
)
|
)
|
||||||
|
|
||||||
zulip_target = (section_config["stream"], section_config["topic"])
|
zulip_target = (section_config["stream"], section_config["topic"])
|
||||||
|
|
|
@ -282,7 +282,7 @@ def run_mirror() -> None:
|
||||||
else:
|
else:
|
||||||
since = datetime.fromtimestamp(float(timestamp), tz=pytz.utc)
|
since = datetime.fromtimestamp(float(timestamp), tz=pytz.utc)
|
||||||
except (ValueError, OSError) as e:
|
except (ValueError, OSError) as e:
|
||||||
logging.warn(f"Could not open resume file: {str(e)}")
|
logging.warn(f"Could not open resume file: {e}")
|
||||||
since = default_since()
|
since = default_since()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -160,7 +160,7 @@ def send_zulip(zulip_client: zulip.Client, zeph: ZephyrDict) -> Dict[str, Any]:
|
||||||
message["content"] = unwrap_lines(zeph["content"])
|
message["content"] = unwrap_lines(zeph["content"])
|
||||||
|
|
||||||
if options.test_mode and options.site == DEFAULT_SITE:
|
if options.test_mode and options.site == DEFAULT_SITE:
|
||||||
logger.debug(f"Message is: {str(message)}")
|
logger.debug(f"Message is: {message}")
|
||||||
return {"result": "success"}
|
return {"result": "success"}
|
||||||
|
|
||||||
return zulip_client.send_message(message)
|
return zulip_client.send_message(message)
|
||||||
|
|
|
@ -36,7 +36,7 @@ def get_bot_result(message_content: str, config: Dict[str, str], sender_id: str)
|
||||||
return res_json["result"]["fulfillment"]["speech"]
|
return res_json["result"]["fulfillment"]["speech"]
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logging.exception(str(e))
|
logging.exception(str(e))
|
||||||
return f"Error. {str(e)}."
|
return f"Error. {e}."
|
||||||
|
|
||||||
|
|
||||||
class DialogFlowHandler:
|
class DialogFlowHandler:
|
||||||
|
|
|
@ -145,7 +145,7 @@ class StateHandler:
|
||||||
self.state_[key] = self.marshal(value)
|
self.state_[key] = self.marshal(value)
|
||||||
response = self._client.update_storage({"storage": {key: self.state_[key]}})
|
response = self._client.update_storage({"storage": {key: self.state_[key]}})
|
||||||
if response["result"] != "success":
|
if response["result"] != "success":
|
||||||
raise StateHandlerError(f"Error updating state: {str(response)}")
|
raise StateHandlerError(f"Error updating state: {response}")
|
||||||
|
|
||||||
def get(self, key: str) -> Any:
|
def get(self, key: str) -> Any:
|
||||||
if key in self.state_:
|
if key in self.state_:
|
||||||
|
|
Loading…
Add table
Reference in a new issue