mirror of
https://github.com/caronc/apprise.git
synced 2025-12-15 10:04:06 +08:00
addressed RUF059 linting fixes against codebase (#1413)
This commit is contained in:
@@ -732,7 +732,7 @@ class NotifyMatrix(NotifyBase):
|
||||
}
|
||||
|
||||
# Post our content
|
||||
postokay, response = self._fetch(
|
||||
postokay, _response = self._fetch(
|
||||
path, payload=image_payload)
|
||||
if not postokay:
|
||||
# Mark our failure
|
||||
@@ -744,7 +744,7 @@ class NotifyMatrix(NotifyBase):
|
||||
attachment["room_id"] = room_id
|
||||
attachment["type"] = "m.room.message"
|
||||
|
||||
postokay, response = self._fetch(
|
||||
postokay, _response = self._fetch(
|
||||
path, payload=attachment, method=method)
|
||||
|
||||
# Increment the transaction ID to avoid future messages
|
||||
@@ -804,7 +804,7 @@ class NotifyMatrix(NotifyBase):
|
||||
})
|
||||
|
||||
# Post our content
|
||||
postokay, response = self._fetch(
|
||||
postokay, _response = self._fetch(
|
||||
path, payload=payload, method=method
|
||||
)
|
||||
|
||||
@@ -1814,7 +1814,7 @@ class NotifyMatrix(NotifyBase):
|
||||
#
|
||||
verify_url = f"{base_url}/_matrix/client/versions"
|
||||
# Post our content
|
||||
code, response = self._fetch(
|
||||
code, _response = self._fetch(
|
||||
None, method="GET", url_override=verify_url
|
||||
)
|
||||
if code != requests.codes.ok:
|
||||
@@ -1856,7 +1856,7 @@ class NotifyMatrix(NotifyBase):
|
||||
verify_url = f"{identity_url}/_matrix/identity/v2"
|
||||
|
||||
# Post our content
|
||||
code, response = self._fetch(
|
||||
code, _response = self._fetch(
|
||||
None, method="GET", url_override=verify_url
|
||||
)
|
||||
if code != requests.codes.ok:
|
||||
|
||||
@@ -478,7 +478,7 @@ class NotifyNtfy(NotifyBase):
|
||||
f" {attachment.url(privacy=True)}"
|
||||
)
|
||||
|
||||
okay, response = self._send(
|
||||
okay, _response = self._send(
|
||||
topic,
|
||||
body=_body,
|
||||
title=_title,
|
||||
@@ -490,7 +490,7 @@ class NotifyNtfy(NotifyBase):
|
||||
return False
|
||||
else:
|
||||
# Send our Notification Message
|
||||
okay, response = self._send(
|
||||
okay, _response = self._send(
|
||||
topic, body=body, title=title, image_url=image_url
|
||||
)
|
||||
if not okay:
|
||||
|
||||
@@ -657,7 +657,7 @@ class NotifyPushSafer(NotifyBase):
|
||||
payload["v"] = str(self.vibration)
|
||||
|
||||
if not attachments:
|
||||
okay, response = self._send(payload)
|
||||
okay, _response = self._send(payload)
|
||||
if not okay:
|
||||
has_error = True
|
||||
continue
|
||||
@@ -685,7 +685,7 @@ class NotifyPushSafer(NotifyBase):
|
||||
f'Added attachment ({filename}) to "{recipient}".'
|
||||
)
|
||||
|
||||
okay, response = self._send(_payload)
|
||||
okay, _response = self._send(_payload)
|
||||
if not okay:
|
||||
has_error = True
|
||||
continue
|
||||
|
||||
@@ -527,7 +527,7 @@ class NotifyReddit(NotifyBase):
|
||||
"text": body,
|
||||
})
|
||||
|
||||
postokay, response = self._fetch(self.submit_url, payload=payload)
|
||||
postokay, _response = self._fetch(self.submit_url, payload=payload)
|
||||
# only toggle has_error flag if we had an error
|
||||
if not postokay:
|
||||
# Mark our failure
|
||||
|
||||
@@ -212,7 +212,7 @@ class NotifyRevolt(NotifyBase):
|
||||
has_error = False
|
||||
channel_ids = list(self.targets)
|
||||
for channel_id in channel_ids:
|
||||
postokay, response = self._send(payload, channel_id)
|
||||
postokay, _response = self._send(payload, channel_id)
|
||||
if not postokay:
|
||||
# Failed to send message
|
||||
has_error = True
|
||||
|
||||
@@ -573,7 +573,7 @@ class NotifySendPulse(NotifyBase):
|
||||
payload["email"]["bcc"].append(item)
|
||||
|
||||
# Perform our post
|
||||
success, response = self._fetch(
|
||||
success, _response = self._fetch(
|
||||
self.notify_email_url, payload, target, retry=1)
|
||||
if not success:
|
||||
has_error = True
|
||||
|
||||
@@ -542,7 +542,7 @@ class NotifySES(NotifyBase):
|
||||
quote(from_name, " "), quote(self.from_addr, "@ ")
|
||||
)
|
||||
|
||||
(result, response) = self._post(payload=payload, to=to_addr)
|
||||
(result, _response) = self._post(payload=payload, to=to_addr)
|
||||
if not result:
|
||||
# Mark our failure
|
||||
has_error = True
|
||||
|
||||
@@ -684,7 +684,7 @@ class NotifySparkPost(NotifyBase):
|
||||
payload["content"]["headers"] = headers
|
||||
|
||||
# Send our message
|
||||
status_code, response = self.__post(
|
||||
status_code, _response = self.__post(
|
||||
payload, self.sparkpost_retry_attempts
|
||||
)
|
||||
|
||||
|
||||
@@ -369,7 +369,7 @@ class NotifyTwist(NotifyBase):
|
||||
return True
|
||||
|
||||
# Send Logout Message
|
||||
postokay, response = self._fetch("users/logout")
|
||||
_postokay, _response = self._fetch("users/logout")
|
||||
|
||||
# reset our token
|
||||
self.token = None
|
||||
@@ -600,7 +600,7 @@ class NotifyTwist(NotifyBase):
|
||||
"content": body,
|
||||
}
|
||||
|
||||
postokay, response = self._fetch(
|
||||
postokay, _response = self._fetch(
|
||||
"threads/add",
|
||||
payload=payload,
|
||||
)
|
||||
|
||||
@@ -584,7 +584,7 @@ class NotifyTwitter(NotifyBase):
|
||||
target["recipient_id"] = user_id
|
||||
|
||||
# Send Twitter DM
|
||||
postokay, response = self._fetch(
|
||||
postokay, _response = self._fetch(
|
||||
self.twitter_dm,
|
||||
payload=payload,
|
||||
)
|
||||
|
||||
@@ -585,7 +585,7 @@ def test_plugin_matrix_fetch(mock_post, mock_get, mock_put):
|
||||
"retry_after_ms": 1,
|
||||
})
|
||||
|
||||
code, response = obj._fetch("/retry/apprise/unit/test")
|
||||
code, _response = obj._fetch("/retry/apprise/unit/test")
|
||||
assert code is False
|
||||
|
||||
request.content = dumps(
|
||||
@@ -595,11 +595,11 @@ def test_plugin_matrix_fetch(mock_post, mock_get, mock_put):
|
||||
}
|
||||
}
|
||||
)
|
||||
code, response = obj._fetch("/retry/apprise/unit/test")
|
||||
code, _response = obj._fetch("/retry/apprise/unit/test")
|
||||
assert code is False
|
||||
|
||||
request.content = dumps({"error": {}})
|
||||
code, response = obj._fetch("/retry/apprise/unit/test")
|
||||
code, _response = obj._fetch("/retry/apprise/unit/test")
|
||||
assert code is False
|
||||
del obj
|
||||
|
||||
|
||||
@@ -277,7 +277,7 @@ def test_plugin_signal_yaml_config(request_mock):
|
||||
"""NotifySignalAPI() YAML Configuration."""
|
||||
|
||||
# Load our configuration
|
||||
result, config = ConfigBase.config_parse_yaml(cleandoc("""
|
||||
result, _ = ConfigBase.config_parse_yaml(cleandoc("""
|
||||
urls:
|
||||
- signal://signal:8080/+1234567890:
|
||||
- to: +0987654321
|
||||
@@ -301,7 +301,7 @@ def test_plugin_signal_yaml_config(request_mock):
|
||||
#
|
||||
|
||||
# Load our configuration
|
||||
result, config = ConfigBase.config_parse_yaml(cleandoc("""
|
||||
result, _config = ConfigBase.config_parse_yaml(cleandoc("""
|
||||
urls:
|
||||
- signal://signal:8080/+1234567890/+0987654321:
|
||||
- tag: signal
|
||||
|
||||
@@ -57,7 +57,7 @@ def request_mock(mocker):
|
||||
def test_plugin_title_maxlen(request_mock):
|
||||
"""Plugin title maxlen blending support."""
|
||||
# Load our configuration
|
||||
result, config = ConfigBase.config_parse_yaml(cleandoc("""
|
||||
result, _ = ConfigBase.config_parse_yaml(cleandoc("""
|
||||
urls:
|
||||
|
||||
# Our JSON plugin allows for a title definition; we enforce a html format
|
||||
@@ -103,7 +103,7 @@ def test_plugin_title_maxlen(request_mock):
|
||||
#
|
||||
# Reverse the configuration file and expect the same results
|
||||
#
|
||||
result, config = ConfigBase.config_parse_yaml(cleandoc("""
|
||||
result, _config = ConfigBase.config_parse_yaml(cleandoc("""
|
||||
urls:
|
||||
|
||||
# Telegram has a title_maxlen of 0
|
||||
|
||||
Reference in New Issue
Block a user