style: Adjustments to the translator

This commit is contained in:
Karim shoair
2025-07-30 03:28:16 +03:00
parent 5bb1266fa5
commit 32cb76604c
2 changed files with 10 additions and 15 deletions
+3 -3
View File
@@ -36,7 +36,7 @@ from scrapling.core.storage import (
StorageSystemMixin,
_StorageTools,
)
from scrapling.core.translator import translator_instance
from scrapling.core.translator import translator as _translator
from scrapling.core.utils import clean_spaces, flatten, html_forbidden, is_jsonable, log
__DEFAULT_DB_FILE__ = str(Path(__file__).parent / "elements_storage.db")
@@ -600,7 +600,7 @@ class Selector(SelectorsGeneration):
try:
if not self.__adaptive_enabled or "," not in selector:
# No need to split selectors in this case, let's save some CPU cycles :)
xpath_selector = translator_instance.css_to_xpath(selector)
xpath_selector = _translator.css_to_xpath(selector)
return self.xpath(
xpath_selector,
identifier or selector,
@@ -614,7 +614,7 @@ class Selector(SelectorsGeneration):
for single_selector in split_selectors(selector):
# I'm doing this only so the `save` function saves data correctly for combined selectors
# Like using the ',' to combine two different selectors that point to different elements.
xpath_selector = translator_instance.css_to_xpath(
xpath_selector = _translator.css_to_xpath(
single_selector.canonical()
)
results += self.xpath(