From fe5094b574ece79abb58d29d3b7f72aa6c323557 Mon Sep 17 00:00:00 2001 From: Frank Sachsenheim Date: Mon, 13 May 2024 20:19:45 +0200 Subject: [PATCH] Marks utils._sort_nodes_in_document_order as private It's not fully implemented, suffices the internal requirements, and no obvious other real-world use-case comes to mind. --- _delb/utils.py | 4 ++-- _delb/xpath/__init__.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/_delb/utils.py b/_delb/utils.py index 4fcd1ce5..7482380a 100644 --- a/_delb/utils.py +++ b/_delb/utils.py @@ -361,7 +361,7 @@ def _random_unused_prefix(namespaces: etree._NSMap) -> str: ) -def sort_nodes_in_document_order(nodes: Iterable[NodeBase]) -> Iterator[NodeBase]: +def _sort_nodes_in_document_order(nodes: Iterable[NodeBase]) -> Iterator[NodeBase]: node_index_cache: dict[int, int] = {} sorter = _NodesSorter() for node in nodes: @@ -429,5 +429,5 @@ def traverse_df_ltr_ttb(root: NodeBase, *filters: Filter) -> Iterator[NodeBase]: first.__name__, get_traverser.__name__, last.__name__, - sort_nodes_in_document_order.__name__, + _sort_nodes_in_document_order.__name__, ) diff --git a/_delb/xpath/__init__.py b/_delb/xpath/__init__.py index 13acc5b3..51aef443 100644 --- a/_delb/xpath/__init__.py +++ b/_delb/xpath/__init__.py @@ -72,7 +72,7 @@ from cssselect import GenericTranslator from _delb.names import Namespaces -from _delb.utils import sort_nodes_in_document_order +from _delb.utils import _sort_nodes_in_document_order from _delb.xpath.ast import EvaluationContext from _delb.xpath import functions # noqa: F401 from _delb.xpath.parser import parse @@ -141,7 +141,7 @@ def in_document_order(self) -> QueryResults: Returns another :class:`QueryResults` instance where the contained nodes are sorted in document order. """ - return QueryResults(sort_nodes_in_document_order(self)) + return QueryResults(_sort_nodes_in_document_order(self)) @property def last(self) -> Optional[NodeBase]: