Karim shoair commited on
Commit
a7cc20d
·
1 Parent(s): d391239

fix: remove forgotten unused code

Browse files
scrapling/core/translator.py CHANGED
@@ -130,5 +130,5 @@ translator = HTMLTranslator()
130
 
131
  @lru_cache(maxsize=256)
132
  def css_to_xpath(query: str) -> str:
133
- """Return translated XPath version of a given CSS query"""
134
  return translator.css_to_xpath(query)
 
130
 
131
  @lru_cache(maxsize=256)
132
  def css_to_xpath(query: str) -> str:
133
+ """Return the translated XPath version of a given CSS query"""
134
  return translator.css_to_xpath(query)
scrapling/engines/_browsers/_config_tools.py CHANGED
@@ -1,11 +1,5 @@
1
  from functools import lru_cache
2
 
3
- from scrapling.core._types import Tuple
4
- from scrapling.engines.constants import (
5
- DEFAULT_STEALTH_FLAGS,
6
- HARMFUL_DEFAULT_ARGS,
7
- DEFAULT_FLAGS,
8
- )
9
  from scrapling.engines.toolbelt.navigation import js_bypass_path
10
  from scrapling.engines.toolbelt.fingerprints import generate_headers
11
 
@@ -42,19 +36,3 @@ def _compiled_stealth_scripts():
42
  with open(script_path, "r") as f:
43
  scripts.append(f.read())
44
  return tuple(scripts)
45
-
46
-
47
- @lru_cache(2, typed=True)
48
- def _set_flags(hide_canvas, disable_webgl): # pragma: no cover
49
- """Returns the flags that will be used while launching the browser if stealth mode is enabled"""
50
- flags = DEFAULT_STEALTH_FLAGS
51
- if hide_canvas:
52
- flags += ("--fingerprinting-canvas-image-data-noise",)
53
- if disable_webgl:
54
- flags += (
55
- "--disable-webgl",
56
- "--disable-webgl-image-chromium",
57
- "--disable-webgl2",
58
- )
59
-
60
- return flags
 
1
  from functools import lru_cache
2
 
 
 
 
 
 
 
3
  from scrapling.engines.toolbelt.navigation import js_bypass_path
4
  from scrapling.engines.toolbelt.fingerprints import generate_headers
5
 
 
36
  with open(script_path, "r") as f:
37
  scripts.append(f.read())
38
  return tuple(scripts)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
scrapling/engines/_browsers/_validators.py CHANGED
@@ -13,7 +13,6 @@ from scrapling.core._types import (
13
  Tuple,
14
  Optional,
15
  Callable,
16
- Iterable,
17
  Sequence,
18
  overload,
19
  SetCookieParam,
@@ -37,15 +36,6 @@ def _is_invalid_file_path(value: str) -> bool | str: # pragma: no cover
37
  return False
38
 
39
 
40
- def _validate_addon_path(value: str) -> None: # pragma: no cover
41
- """Fast addon path validation"""
42
- path = Path(value)
43
- if not path.exists():
44
- raise FileNotFoundError(f"Addon path not found: {value}")
45
- if not path.is_dir():
46
- raise ValueError(f"Addon path must be a directory of the extracted addon: {value}")
47
-
48
-
49
  @lru_cache(2)
50
  def _is_invalid_cdp_url(cdp_url: str) -> bool | str:
51
  """Fast CDP URL validation"""
 
13
  Tuple,
14
  Optional,
15
  Callable,
 
16
  Sequence,
17
  overload,
18
  SetCookieParam,
 
36
  return False
37
 
38
 
 
 
 
 
 
 
 
 
 
39
  @lru_cache(2)
40
  def _is_invalid_cdp_url(cdp_url: str) -> bool | str:
41
  """Fast CDP URL validation"""
scrapling/engines/toolbelt/navigation.py CHANGED
@@ -11,7 +11,7 @@ from msgspec import Struct, structs, convert, ValidationError
11
  from playwright.sync_api import Route
12
 
13
  from scrapling.core.utils import log
14
- from scrapling.core._types import Dict, Tuple, overload, Literal
15
  from scrapling.engines.constants import DEFAULT_DISABLED_RESOURCES
16
 
17
  __BYPASSES_DIR__ = Path(__file__).parent / "bypasses"
 
11
  from playwright.sync_api import Route
12
 
13
  from scrapling.core.utils import log
14
+ from scrapling.core._types import Dict, Tuple
15
  from scrapling.engines.constants import DEFAULT_DISABLED_RESOURCES
16
 
17
  __BYPASSES_DIR__ = Path(__file__).parent / "bypasses"