Skip to content

Commit

Permalink
chore: address some nits and lints (pypi#16974)
Browse files Browse the repository at this point in the history
  • Loading branch information
miketheman authored Oct 28, 2024
1 parent e1daa02 commit 7b95714
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 9 deletions.
4 changes: 1 addition & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ cache_dir = "dev/.mypy_cache"
[[tool.mypy.overrides]]
# These modules do not yet have types available.
module = [
"alembic_postgresql_enum.*",
"automat.*",
"bpython.*", # https://github.com/bpython/bpython/issues/892
"b2sdk.*", # https://github.com/Backblaze/b2-sdk-python/issues/148
Expand All @@ -60,7 +59,6 @@ module = [
"google.cloud.*",
"forcediphttpsadapter.*",
"IPython.*", # has types, but only installed in dev
"linehaul.*",
"packaging_legacy.*",
"paginate.*",
"paginate_sqlalchemy.*",
Expand All @@ -77,7 +75,6 @@ module = [
"transaction.*",
"ua_parser.*", # https://github.com/ua-parser/uap-python/issues/110
"venusian.*",
"whitenoise.*",
"zope.sqlalchemy.*",
]
ignore_missing_imports = true
Expand All @@ -97,6 +94,7 @@ markers = [
]
filterwarnings = [
'ignore::warehouse.admin.services.InsecureStorageWarning',
'ignore::warehouse.utils.exceptions.InsecureIntegrityServiceWarning',
'ignore::warehouse.utils.exceptions.InsecureOIDCPublisherWarning',
'ignore::warehouse.packaging.services.InsecureStorageWarning',
'error:SELECT statement has a cartesian product:sqlalchemy.exc.SAWarning',
Expand Down
4 changes: 3 additions & 1 deletion tests/functional/manage/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,9 @@ def test_changing_password_succeeds(self, webtest, socket_enabled):
)

logged_in = two_factor_form.submit().follow(status=HTTPStatus.OK)
assert logged_in.html.find("title", text="Warehouse · The Python Package Index")
assert logged_in.html.find(
"title", string="Warehouse · The Python Package Index"
)

# Now visit the change password page
change_password_page = logged_in.goto("/manage/account/", status=HTTPStatus.OK)
Expand Down
2 changes: 1 addition & 1 deletion warehouse/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def format_tags(tags):


def format_classifiers(classifiers):
structured = collections.OrderedDict()
structured: collections.OrderedDict[str, list[str]] = collections.OrderedDict()

# Split up our classifiers into our data structure
for classifier in classifiers:
Expand Down
4 changes: 2 additions & 2 deletions warehouse/integrations/vulnerabilities/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ def __init__(
vulnerability_id: str,
advisory_link: str,
aliases: list[str],
details: str,
summary: str,
details: str | None,
summary: str | None,
fixed_in: list[str],
withdrawn: str | None,
):
Expand Down
2 changes: 1 addition & 1 deletion warehouse/logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def format(self, record):
"event": record.msg,
"thread": threading.get_ident(),
}
record.msg = RENDERER(None, None, event_dict)
record.msg = RENDERER(None, record.levelname, event_dict)

return super().format(record)

Expand Down
2 changes: 1 addition & 1 deletion warehouse/utils/sns.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def _get_pubkey(self, cert_url):
cert_host = cert_url_p.netloc
if cert_scheme != "https":
raise InvalidMessageError("Invalid scheme for SigningCertURL")
if _signing_url_host_re.fullmatch(cert_host) is None:
if not cert_host or _signing_url_host_re.fullmatch(cert_host) is None:
raise InvalidMessageError("Invalid location for SigningCertURL")

resp = self.http.get(cert_url)
Expand Down

0 comments on commit 7b95714

Please sign in to comment.