Skip to content

Commit

Permalink
tox
Browse files Browse the repository at this point in the history
  • Loading branch information
stringertheory committed Jan 30, 2024
1 parent 0c99fdc commit 683f3a6
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions clean_links/clean.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ def query_string(url: str, rules: list) -> str:
split = urlsplit(url)
params = parse_qs(split.query)

delete_keys = {None, ""}
delete_keys = {""}
for rule in rules:
for key in params:
if re.match("^" + rule + "$", key, flags=re.IGNORECASE):
delete_keys.add(key)

for delete_key in delete_keys:
params.pop(delete_key, "") # type: ignore[arg-type]
params.pop(delete_key, None)

params_string = urlencode(params, doseq=True)

Expand Down
3 changes: 2 additions & 1 deletion clean_links/unshorten.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import logging
from typing import Union

import requests
from urllib3.exceptions import InsecureRequestWarning
Expand Down Expand Up @@ -28,7 +29,7 @@
}


def get_last_url_from_exception(exc: Exception) -> str | None:
def get_last_url_from_exception(exc: Exception) -> Union[str, None]:
result = None

try:
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ allowlist_externals = poetry
commands =
poetry install -v
pytest --doctest-modules tests --cov --cov-config=pyproject.toml --cov-report=xml
mypy
mypy --disable-error-code attr-defined

0 comments on commit 683f3a6

Please sign in to comment.