This repo contains code to mirror other repos. It also contains the code that is getting mirrored.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

83 lines
1.3 KiB

  1. # -*- coding: utf-8 -*-
  2. from typing import TypeVar, List, Callable, Generic, Type
  3. from abc import ABC
  4. from .tree import Tree
  5. _T = TypeVar('_T')
  6. _R = TypeVar('_R')
  7. _FUNC = Callable[..., _T]
  8. class Transformer(ABC, Generic[_T]):
  9. def __init__(self, visit_tokens: bool = True):
  10. ...
  11. def transform(self, tree: Tree) -> _T:
  12. ...
  13. class Transformer_InPlace(Transformer):
  14. pass
  15. class VisitorBase:
  16. pass
  17. class Visitor(VisitorBase, ABC, Generic[_T]):
  18. def visit(self, tree: Tree) -> Tree:
  19. ...
  20. def visit_topdown(self, tree: Tree) -> Tree:
  21. ...
  22. class Visitor_Recursive(VisitorBase):
  23. def visit(self, tree: Tree) -> Tree:
  24. ...
  25. def visit_topdown(self, tree: Tree) -> Tree:
  26. ...
  27. class Interpreter(ABC, Generic[_T]):
  28. def visit(self, tree: Tree) -> _T:
  29. ...
  30. def visit_children(self, tree: Tree) -> List[_T]:
  31. ...
  32. _InterMethod = Callable[[Type[Interpreter], _T], _R]
  33. def v_args(
  34. inline: bool = False,
  35. meta: bool = False,
  36. tree: bool = False
  37. ) -> Callable[[_FUNC], _FUNC]:
  38. ...
  39. def visit_children_decor(func: _InterMethod) -> _InterMethod:
  40. ...
  41. class Discard(Exception):
  42. pass
  43. # Deprecated
  44. class InlineTransformer:
  45. pass
  46. # Deprecated
  47. def inline_args(obj: _FUNC) -> _FUNC:
  48. ...