Skip to content

Commit

Permalink
fix linter issues
Browse files Browse the repository at this point in the history
  • Loading branch information
MohammadRaziei committed Nov 10, 2023
1 parent 0aa2806 commit 8f8a9a1
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/liburlparser/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,26 @@
import warnings
from pathlib import Path


from ._core import Host, Psl, Url, __doc__, __version__

psl = Psl() # psl
psl = Psl() # psl


def warning_on_one_line(message, category, filename, lineno, file=None, line=None):
return f'{filename}:{lineno}: {category.__name__}: {message}\n'


warnings.formatwarning = warning_on_one_line

try:
import requests

def psl_update():
resp = requests.get(psl.url)
psl.load_from_string(resp.text)

psl.update = psl_update

except ImportError:
pass

Expand All @@ -27,6 +32,6 @@ def psl_update():
if psl_filename.exists():
psl.load_from_path(psl_filename.as_posix())
else:
warnings.warn("Cannot find Public_suffix_list.dat. you must import it with \"psl.load_from_path\" or \"psl.load_from_string\" or \"psl.update\" functions",
RuntimeWarning, stacklevel=2)

warnings.warn(
"Cannot find Public_suffix_list.dat. you must import it with \"psl.load_from_path\" or \"psl.load_from_string\" or \"psl.update\" functions",
RuntimeWarning, stacklevel=2)

0 comments on commit 8f8a9a1

Please sign in to comment.