fix: remove forgotten unused code
This commit is contained in:
@@ -130,5 +130,5 @@ translator = HTMLTranslator()
|
||||
|
||||
@lru_cache(maxsize=256)
|
||||
def css_to_xpath(query: str) -> str:
|
||||
"""Return translated XPath version of a given CSS query"""
|
||||
"""Return the translated XPath version of a given CSS query"""
|
||||
return translator.css_to_xpath(query)
|
||||
|
||||
@@ -1,11 +1,5 @@
|
||||
from functools import lru_cache
|
||||
|
||||
from scrapling.core._types import Tuple
|
||||
from scrapling.engines.constants import (
|
||||
DEFAULT_STEALTH_FLAGS,
|
||||
HARMFUL_DEFAULT_ARGS,
|
||||
DEFAULT_FLAGS,
|
||||
)
|
||||
from scrapling.engines.toolbelt.navigation import js_bypass_path
|
||||
from scrapling.engines.toolbelt.fingerprints import generate_headers
|
||||
|
||||
@@ -42,19 +36,3 @@ def _compiled_stealth_scripts():
|
||||
with open(script_path, "r") as f:
|
||||
scripts.append(f.read())
|
||||
return tuple(scripts)
|
||||
|
||||
|
||||
@lru_cache(2, typed=True)
|
||||
def _set_flags(hide_canvas, disable_webgl): # pragma: no cover
|
||||
"""Returns the flags that will be used while launching the browser if stealth mode is enabled"""
|
||||
flags = DEFAULT_STEALTH_FLAGS
|
||||
if hide_canvas:
|
||||
flags += ("--fingerprinting-canvas-image-data-noise",)
|
||||
if disable_webgl:
|
||||
flags += (
|
||||
"--disable-webgl",
|
||||
"--disable-webgl-image-chromium",
|
||||
"--disable-webgl2",
|
||||
)
|
||||
|
||||
return flags
|
||||
|
||||
@@ -13,7 +13,6 @@ from scrapling.core._types import (
|
||||
Tuple,
|
||||
Optional,
|
||||
Callable,
|
||||
Iterable,
|
||||
Sequence,
|
||||
overload,
|
||||
SetCookieParam,
|
||||
@@ -37,15 +36,6 @@ def _is_invalid_file_path(value: str) -> bool | str: # pragma: no cover
|
||||
return False
|
||||
|
||||
|
||||
def _validate_addon_path(value: str) -> None: # pragma: no cover
|
||||
"""Fast addon path validation"""
|
||||
path = Path(value)
|
||||
if not path.exists():
|
||||
raise FileNotFoundError(f"Addon path not found: {value}")
|
||||
if not path.is_dir():
|
||||
raise ValueError(f"Addon path must be a directory of the extracted addon: {value}")
|
||||
|
||||
|
||||
@lru_cache(2)
|
||||
def _is_invalid_cdp_url(cdp_url: str) -> bool | str:
|
||||
"""Fast CDP URL validation"""
|
||||
|
||||
@@ -11,7 +11,7 @@ from msgspec import Struct, structs, convert, ValidationError
|
||||
from playwright.sync_api import Route
|
||||
|
||||
from scrapling.core.utils import log
|
||||
from scrapling.core._types import Dict, Tuple, overload, Literal
|
||||
from scrapling.core._types import Dict, Tuple
|
||||
from scrapling.engines.constants import DEFAULT_DISABLED_RESOURCES
|
||||
|
||||
__BYPASSES_DIR__ = Path(__file__).parent / "bypasses"
|
||||
|
||||
Reference in New Issue
Block a user