Format: application/octet-stream
⬇ Download File (1.5 KB)
   1  from typing import Callable, Dict, Generator, List, Optional, Pattern, Tuple, TypeVar, Union
   2  from xml.etree.ElementTree import Element
   3  
   4  xpath_tokenizer_re: Pattern[str]
   5  
   6  _token = Tuple[str, str]
   7  _next = Callable[[], _token]
   8  _callback = Callable[[_SelectorContext, List[Element]], Generator[Element, None, None]]
   9  
  10  def xpath_tokenizer(pattern: str, namespaces: Optional[Dict[str, str]] = ...) -> Generator[_token, None, None]: ...
  11  def get_parent_map(context: _SelectorContext) -> Dict[Element, Element]: ...
  12  def prepare_child(next: _next, token: _token) -> _callback: ...
  13  def prepare_star(next: _next, token: _token) -> _callback: ...
  14  def prepare_self(next: _next, token: _token) -> _callback: ...
  15  def prepare_descendant(next: _next, token: _token) -> _callback: ...
  16  def prepare_parent(next: _next, token: _token) -> _callback: ...
  17  def prepare_predicate(next: _next, token: _token) -> _callback: ...
  18  
  19  ops: Dict[str, Callable[[_next, _token], _callback]]
  20  
  21  class _SelectorContext:
  22      parent_map: Dict[Element, Element]
  23      root: Element
  24      def __init__(self, root: Element) -> None: ...
  25  
  26  _T = TypeVar("_T")
  27  
  28  def iterfind(elem: Element, path: str, namespaces: Optional[Dict[str, str]] = ...) -> List[Element]: ...
  29  def find(elem: Element, path: str, namespaces: Optional[Dict[str, str]] = ...) -> Optional[Element]: ...
  30  def findall(elem: Element, path: str, namespaces: Optional[Dict[str, str]] = ...) -> List[Element]: ...
  31  def findtext(
  32      elem: Element, path: str, default: Optional[_T] = ..., namespaces: Optional[Dict[str, str]] = ...
  33  ) -> Union[_T, str]: ...
  34