This repo contains code to mirror other repos. It also contains the code that is getting mirrored.
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

99 lignes
1.7 KiB

  1. # -*- coding: utf-8 -*-
  2. from typing import TypeVar, Tuple, 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. def __mul__(self, other: Transformer[_T]) -> TransformerChain[_T]:
  14. ...
  15. class TransformerChain(Generic[_T]):
  16. transformers: Tuple[Transformer[_T], ...]
  17. def __init__(self, *transformers: Transformer[_T]):
  18. ...
  19. def transform(self, tree: Tree) -> _T:
  20. ...
  21. def __mul__(self, other: Transformer[_T]) -> TransformerChain[_T]:
  22. ...
  23. class Transformer_InPlace(Transformer):
  24. pass
  25. class VisitorBase:
  26. pass
  27. class Visitor(VisitorBase, ABC, Generic[_T]):
  28. def visit(self, tree: Tree) -> Tree:
  29. ...
  30. def visit_topdown(self, tree: Tree) -> Tree:
  31. ...
  32. class Visitor_Recursive(VisitorBase):
  33. def visit(self, tree: Tree) -> Tree:
  34. ...
  35. def visit_topdown(self, tree: Tree) -> Tree:
  36. ...
  37. class Interpreter(ABC, Generic[_T]):
  38. def visit(self, tree: Tree) -> _T:
  39. ...
  40. def visit_children(self, tree: Tree) -> List[_T]:
  41. ...
  42. _InterMethod = Callable[[Type[Interpreter], _T], _R]
  43. def v_args(
  44. inline: bool = False,
  45. meta: bool = False,
  46. tree: bool = False
  47. ) -> Callable[[_FUNC], _FUNC]:
  48. ...
  49. def visit_children_decor(func: _InterMethod) -> _InterMethod:
  50. ...
  51. class Discard(Exception):
  52. pass
  53. # Deprecated
  54. class InlineTransformer:
  55. pass
  56. # Deprecated
  57. def inline_args(obj: _FUNC) -> _FUNC:
  58. ...