From e20882af5d8f09064cee2c212f08b36f30cdad99 Mon Sep 17 00:00:00 2001 From: Karim shoair Date: Sat, 8 Nov 2025 20:08:23 +0200 Subject: [PATCH] style: removing dead code from the parser --- scrapling/parser.py | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/scrapling/parser.py b/scrapling/parser.py index 6a4934c..ac97b7d 100644 --- a/scrapling/parser.py +++ b/scrapling/parser.py @@ -220,16 +220,6 @@ class Selector(SelectorsGeneration): # Faster than checking `element.is_attribute or element.is_text or element.is_tail` return issubclass(type(element), _ElementUnicodeResult) - @staticmethod - def __content_convertor( - element: HtmlElement | _ElementUnicodeResult, - ) -> TextHandler: - """Used internally to convert a single element's text content to TextHandler directly without checks - - This single line has been isolated like this, so when it's used with `map` we get that slight performance boost vs. list comprehension - """ - return TextHandler(element) - def __element_convertor(self, element: HtmlElement) -> "Selector": """Used internally to convert a single HtmlElement to Selector directly without checks""" db_instance = self._storage if (hasattr(self, "_storage") and self._storage) else None @@ -248,18 +238,6 @@ class Selector(SelectorsGeneration): def __elements_convertor(self, elements: List[HtmlElement]) -> "Selectors": return Selectors(map(self.__element_convertor, elements)) - def __handle_element( - self, element: Optional[HtmlElement | _ElementUnicodeResult] - ) -> Optional[Union[TextHandler, "Selector"]]: - """Used internally in all functions to convert a single element to type (Selector|TextHandler) when possible""" - if element is None: - return None - elif self._is_text_node(element): - # `_ElementUnicodeResult` basically inherit from `str` so it's fine - return self.__content_convertor(element) - else: - return self.__element_convertor(element) - def __handle_elements( self, result: List[HtmlElement | _ElementUnicodeResult] ) -> Union["Selectors", "TextHandlers"]: