chore: migrating to ruff and updating pre-commit hooks
This commit is contained in:
+19
-11
@@ -1,4 +1,3 @@
|
||||
|
||||
__author__ = "Karim Shoair (karim.shoair@pm.me)"
|
||||
__version__ = "0.2.99"
|
||||
__copyright__ = "Copyright (c) 2024 Karim Shoair"
|
||||
@@ -7,35 +6,44 @@ __copyright__ = "Copyright (c) 2024 Karim Shoair"
|
||||
# A lightweight approach to create lazy loader for each import for backward compatibility
|
||||
# This will reduces initial memory footprint significantly (only loads what's used)
|
||||
def __getattr__(name):
|
||||
if name == 'Fetcher':
|
||||
if name == "Fetcher":
|
||||
from scrapling.fetchers import Fetcher as cls
|
||||
|
||||
return cls
|
||||
elif name == 'Adaptor':
|
||||
elif name == "Adaptor":
|
||||
from scrapling.parser import Adaptor as cls
|
||||
|
||||
return cls
|
||||
elif name == 'Adaptors':
|
||||
elif name == "Adaptors":
|
||||
from scrapling.parser import Adaptors as cls
|
||||
|
||||
return cls
|
||||
elif name == 'AttributesHandler':
|
||||
elif name == "AttributesHandler":
|
||||
from scrapling.core.custom_types import AttributesHandler as cls
|
||||
|
||||
return cls
|
||||
elif name == 'TextHandler':
|
||||
elif name == "TextHandler":
|
||||
from scrapling.core.custom_types import TextHandler as cls
|
||||
|
||||
return cls
|
||||
elif name == 'AsyncFetcher':
|
||||
elif name == "AsyncFetcher":
|
||||
from scrapling.fetchers import AsyncFetcher as cls
|
||||
|
||||
return cls
|
||||
elif name == 'StealthyFetcher':
|
||||
elif name == "StealthyFetcher":
|
||||
from scrapling.fetchers import StealthyFetcher as cls
|
||||
|
||||
return cls
|
||||
elif name == 'PlayWrightFetcher':
|
||||
elif name == "PlayWrightFetcher":
|
||||
from scrapling.fetchers import PlayWrightFetcher as cls
|
||||
|
||||
return cls
|
||||
elif name == 'CustomFetcher':
|
||||
elif name == "CustomFetcher":
|
||||
from scrapling.fetchers import CustomFetcher as cls
|
||||
|
||||
return cls
|
||||
else:
|
||||
raise AttributeError(f"module 'scrapling' has no attribute '{name}'")
|
||||
|
||||
|
||||
__all__ = ['Adaptor', 'Fetcher', 'AsyncFetcher', 'StealthyFetcher', 'PlayWrightFetcher']
|
||||
__all__ = ["Adaptor", "Fetcher", "AsyncFetcher", "StealthyFetcher", "PlayWrightFetcher"]
|
||||
|
||||
Reference in New Issue
Block a user