From 97fecc9d5fe6f428a9be5268f14f3e290b01d04a Mon Sep 17 00:00:00 2001 From: Karim shoair Date: Fri, 29 Nov 2024 21:14:52 +0200 Subject: [PATCH] Style adjustments by flake8 --- .flake8 | 4 ++-- scrapling/core/utils.py | 14 +++++++------- scrapling/engines/toolbelt/navigation.py | 2 +- setup.py | 6 +++--- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/.flake8 b/.flake8 index 5a89b58..fae58af 100644 --- a/.flake8 +++ b/.flake8 @@ -1,3 +1,3 @@ [flake8] -ignore = E501 # line too long -exclude = .git,__pycache__,docs,.github,build,dist \ No newline at end of file +ignore = E501, F401 +exclude = .git,.venv,__pycache__,docs,.github,build,dist,tests,benchmarks.py \ No newline at end of file diff --git a/scrapling/core/utils.py b/scrapling/core/utils.py index 748020b..3cf887c 100644 --- a/scrapling/core/utils.py +++ b/scrapling/core/utils.py @@ -11,12 +11,12 @@ from lxml import html html_forbidden = {html.HtmlComment, } logging.basicConfig( - level=logging.ERROR, - format='%(asctime)s - %(levelname)s - %(message)s', - handlers=[ - logging.StreamHandler() - ] - ) + level=logging.ERROR, + format='%(asctime)s - %(levelname)s - %(message)s', + handlers=[ + logging.StreamHandler() + ] +) def is_jsonable(content: Union[bytes, str]) -> bool: @@ -94,7 +94,7 @@ class _StorageTools: parent = element.getparent() return tuple( (element.tag,) if parent is None else ( - cls._get_element_path(parent) + (element.tag,) + cls._get_element_path(parent) + (element.tag,) ) ) diff --git a/scrapling/engines/toolbelt/navigation.py b/scrapling/engines/toolbelt/navigation.py index 363f233..faf4402 100644 --- a/scrapling/engines/toolbelt/navigation.py +++ b/scrapling/engines/toolbelt/navigation.py @@ -43,7 +43,7 @@ def construct_proxy_dict(proxy_string: Union[str, Dict[str, str]]) -> Union[Dict } except ValueError: # Urllib will say that one of the parameters above can't be casted to the correct type like `int` for port etc... - raise TypeError(f'The proxy argument\'s string is in invalid format!') + raise TypeError('The proxy argument\'s string is in invalid format!') elif isinstance(proxy_string, dict): valid_keys = ('server', 'username', 'password', ) diff --git a/setup.py b/setup.py index 91aa89c..c360b7a 100644 --- a/setup.py +++ b/setup.py @@ -7,9 +7,9 @@ with open("README.md", "r", encoding="utf-8") as fh: setup( name="scrapling", version="0.2.7", - description="""Scrapling is a powerful, flexible, and high-performance web scraping library for Python. It - simplifies the process of extracting data from websites, even when they undergo structural changes, and offers - impressive speed improvements over many popular scraping tools.""", + description="""Scrapling is a powerful, flexible, and high-performance web scraping library for Python. It + simplifies the process of extracting data from websites, even when they undergo structural changes, and offers + impressive speed improvements over many popular scraping tools.""", long_description=long_description, long_description_content_type="text/markdown", author="Karim Shoair",