Skip to content

Commit

Permalink
ruff: Fix RUF010 Use explicit conversion flag.
Browse files Browse the repository at this point in the history
Signed-off-by: Anders Kaseorg <anders@zulip.com>
  • Loading branch information
andersk committed Oct 28, 2023
1 parent 52a7b0b commit 63246e4
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions zulip/integrations/bridge_with_matrix/matrix_bridge.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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"])
Expand Down
2 changes: 1 addition & 1 deletion zulip/integrations/codebase/zulip_codebase_mirror
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion zulip/integrations/zephyr/zephyr_mirror_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion zulip_bots/zulip_bots/bots/dialogflow/dialogflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion zulip_bots/zulip_bots/lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -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_:
Expand Down

0 comments on commit 63246e4

Please sign in to comment.