This repo contains code to mirror other repos. It also contains the code that is getting mirrored.
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

99 行
1.7 KiB

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