MCPcopy Index your code
hub / github.com/python/cpython / logger_wrapper

Function logger_wrapper

Tools/peg_generator/pegen/parser.py:24–34  ·  view source on GitHub ↗
(self: "Parser", *args: object)

Source from the content-addressed store, hash-verified

22 method_name = method.__name__
23
24 def logger_wrapper(self: "Parser", *args: object) -> Any:
25 if not self._verbose:
26 return method(self, *args)
27 argsr = ",".join(repr(arg) for arg in args)
28 fill = " " * self._level
29 print(f"{fill}{method_name}({argsr}) .... (looking at {self.showpeek()})")
30 self._level += 1
31 tree = method(self, *args)
32 self._level -= 1
33 print(f"{fill}... {method_name}({argsr}) --> {tree!s:.200}")
34 return tree
35
36 logger_wrapper.__wrapped__ = method # type: ignore[attr-defined]
37 return cast(F, logger_wrapper)

Callers

nothing calls this directly

Calls 3

methodFunction · 0.85
showpeekMethod · 0.80
joinMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…