diff --git a/zulip/integrations/bridge_with_matrix/matrix_bridge.py b/zulip/integrations/bridge_with_matrix/matrix_bridge.py index 3f950e86e..c6a191310 100644 --- a/zulip/integrations/bridge_with_matrix/matrix_bridge.py +++ b/zulip/integrations/bridge_with_matrix/matrix_bridge.py @@ -91,7 +91,7 @@ async def create( return matrix_to_zulip 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 # and we make sure we don't forward it again to the Zulip stream. @@ -253,7 +253,7 @@ def _matrix_send(self, **kwargs: Any) -> None: raise Bridge_FatalMatrixException(str(result)) 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) 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_keys != bridge_key_set: 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"]) diff --git a/zulip/integrations/codebase/zulip_codebase_mirror b/zulip/integrations/codebase/zulip_codebase_mirror index ead29da10..c2bd4e58b 100755 --- a/zulip/integrations/codebase/zulip_codebase_mirror +++ b/zulip/integrations/codebase/zulip_codebase_mirror @@ -282,7 +282,7 @@ def run_mirror() -> None: else: since = datetime.fromtimestamp(float(timestamp), tz=pytz.utc) 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() try: diff --git a/zulip/integrations/zephyr/zephyr_mirror_backend.py b/zulip/integrations/zephyr/zephyr_mirror_backend.py index a0f09ddea..7c244e85a 100755 --- a/zulip/integrations/zephyr/zephyr_mirror_backend.py +++ b/zulip/integrations/zephyr/zephyr_mirror_backend.py @@ -160,7 +160,7 @@ def send_zulip(zulip_client: zulip.Client, zeph: ZephyrDict) -> Dict[str, Any]: message["content"] = unwrap_lines(zeph["content"]) 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 zulip_client.send_message(message) diff --git a/zulip_bots/zulip_bots/bots/dialogflow/dialogflow.py b/zulip_bots/zulip_bots/bots/dialogflow/dialogflow.py index 592180ba0..16ea544d6 100644 --- a/zulip_bots/zulip_bots/bots/dialogflow/dialogflow.py +++ b/zulip_bots/zulip_bots/bots/dialogflow/dialogflow.py @@ -36,7 +36,7 @@ def get_bot_result(message_content: str, config: Dict[str, str], sender_id: str) return res_json["result"]["fulfillment"]["speech"] except Exception as e: logging.exception(str(e)) - return f"Error. {str(e)}." + return f"Error. {e}." class DialogFlowHandler: diff --git a/zulip_bots/zulip_bots/lib.py b/zulip_bots/zulip_bots/lib.py index 90ad0e2af..895ba6691 100644 --- a/zulip_bots/zulip_bots/lib.py +++ b/zulip_bots/zulip_bots/lib.py @@ -145,7 +145,7 @@ def put(self, key: str, value: Any) -> None: self.state_[key] = self.marshal(value) response = self._client.update_storage({"storage": {key: self.state_[key]}}) 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: if key in self.state_: