Skip to content

Commit 683f3a6

Browse files
tox
1 parent 0c99fdc commit 683f3a6

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

clean_links/clean.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ def query_string(url: str, rules: list) -> str:
1212
split = urlsplit(url)
1313
params = parse_qs(split.query)
1414

15-
delete_keys = {None, ""}
15+
delete_keys = {""}
1616
for rule in rules:
1717
for key in params:
1818
if re.match("^" + rule + "$", key, flags=re.IGNORECASE):
1919
delete_keys.add(key)
2020

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

2424
params_string = urlencode(params, doseq=True)
2525

clean_links/unshorten.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import logging
2+
from typing import Union
23

34
import requests
45
from urllib3.exceptions import InsecureRequestWarning
@@ -28,7 +29,7 @@
2829
}
2930

3031

31-
def get_last_url_from_exception(exc: Exception) -> str | None:
32+
def get_last_url_from_exception(exc: Exception) -> Union[str, None]:
3233
result = None
3334

3435
try:

tox.ini

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ allowlist_externals = poetry
1616
commands =
1717
poetry install -v
1818
pytest --doctest-modules tests --cov --cov-config=pyproject.toml --cov-report=xml
19-
mypy
19+
mypy --disable-error-code attr-defined

0 commit comments

Comments
 (0)