Skip to content

Commit

Permalink
Make typecheck happy
Browse files Browse the repository at this point in the history
  • Loading branch information
mnot committed Mar 4, 2025
1 parent 37b2eaf commit 45f73f3
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 10 deletions.
4 changes: 3 additions & 1 deletion redbot/formatter/html.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,9 @@ def finish_output(self) -> None:
if self.resource.response.complete:
validator_link = self.validators.get(media_type, None)
if validator_link:
validator_link = validator_link % e_query_arg(self.resource.request.uri)
validator_link = validator_link % e_query_arg(
self.resource.request.uri or ""
)
tpl = self.templates.get_template("response_finish.html")
self.output(
tpl.render(
Expand Down
1 change: 1 addition & 0 deletions redbot/resource/active_check/etag_validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

class ETagValidate(SubRequest):
"If an ETag is present, see if it will validate."

check_name = "ETag Validation"
response_phrase = "The ETag validation response"

Expand Down
1 change: 1 addition & 0 deletions redbot/resource/active_check/lm_validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

class LmValidate(SubRequest):
"If Last-Modified is present, see if it will validate."

check_name = "Last-Modified Validation"
response_phrase = "The Last-Modified validation response"
_weekdays = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"]
Expand Down
1 change: 1 addition & 0 deletions redbot/resource/active_check/range.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

class RangeRequest(SubRequest):
"Check for partial content support (if advertised)"

check_name = "Partial Content"
response_phrase = "The partial response"

Expand Down
8 changes: 3 additions & 5 deletions redbot/webui/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def __init__(

if (
"save" in self.query_string
and self.config.get("save_dir", "")
and self.config.get("save_dir")
and self.test_id
):
extend_saved_test(self)
Expand Down Expand Up @@ -175,10 +175,8 @@ def run_test(self) -> None:
if len(referers) > 1:
referer_error = "Multiple referers not allowed."

referer_spam_domains = [
i.strip()
for i in self.config.get("referer_spam_domains", fallback="").split()
]
config_spam_domains = self.config.get("referer_spam_domains") or ""
referer_spam_domains = [i.strip() for i in config_spam_domains.split()]
if (
referer_spam_domains
and referers
Expand Down
2 changes: 1 addition & 1 deletion redbot/webui/captcha.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def configured(self) -> bool:
if (
CAPTCHA_PROVIDERS.get(self.provider, "")
and self.secret
and self.webui.config.get("captcha_sitekey", "")
and self.webui.config.get("captcha_sitekey")
):
return True
return False
Expand Down
5 changes: 2 additions & 3 deletions redbot/webui/slack.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,8 @@ def formatter_done() -> None:

def verify_slack_secret(webui: "RedWebUi") -> bool:
"""Verify the slack secret."""
slack_signing_secret = webui.config.get("slack_signing_secret", fallback="").encode(
"utf-8"
)
config_secret = webui.config.get("slack_signing_secret") or ""
slack_signing_secret = config_secret.encode("utf-8")
timestamps = get_header(webui.req_headers, b"x-slack-request-timestamp")
if not timestamps or not timestamps[0].isdigit():
return False
Expand Down

0 comments on commit 45f73f3

Please sign in to comment.