chore: migrating to ruff and updating pre-commit hooks

This commit is contained in:
Karim shoair
2025-04-13 17:32:00 +02:00
parent f34b42ea33
commit 0c8dd63f87
35 changed files with 2324 additions and 1182 deletions
+20 -8
View File
@@ -5,21 +5,33 @@ from scrapling.core.utils import log
# 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
log.warning('This import is deprecated now and it will be removed with v0.3. Use `from scrapling.fetchers import Fetcher` instead')
log.warning(
"This import is deprecated now and it will be removed with v0.3. Use `from scrapling.fetchers import Fetcher` instead"
)
return cls
elif name == 'AsyncFetcher':
elif name == "AsyncFetcher":
from scrapling.fetchers import AsyncFetcher as cls
log.warning('This import is deprecated now and it will be removed with v0.3. Use `from scrapling.fetchers import AsyncFetcher` instead')
log.warning(
"This import is deprecated now and it will be removed with v0.3. Use `from scrapling.fetchers import AsyncFetcher` instead"
)
return cls
elif name == 'StealthyFetcher':
elif name == "StealthyFetcher":
from scrapling.fetchers import StealthyFetcher as cls
log.warning('This import is deprecated now and it will be removed with v0.3. Use `from scrapling.fetchers import StealthyFetcher` instead')
log.warning(
"This import is deprecated now and it will be removed with v0.3. Use `from scrapling.fetchers import StealthyFetcher` instead"
)
return cls
elif name == 'PlayWrightFetcher':
elif name == "PlayWrightFetcher":
from scrapling.fetchers import PlayWrightFetcher as cls
log.warning('This import is deprecated now and it will be removed with v0.3. Use `from scrapling.fetchers import PlayWrightFetcher` instead')
log.warning(
"This import is deprecated now and it will be removed with v0.3. Use `from scrapling.fetchers import PlayWrightFetcher` instead"
)
return cls
else:
raise AttributeError(f"module 'scrapling' has no attribute '{name}'")