Example #1
0
 def decorators(self) -> list[str]:
     """A list of all decorators the function is decorated with."""
     decorators = []
     # noinspection PyTypeChecker
     obj: types.FunctionType = self.obj  # type: ignore
     for t in doc_ast.parse(obj).decorator_list:
         decorators.append(f"@{doc_ast.unparse(t)}")
     return decorators
Example #2
0
 def decorators(self) -> list[str]:
     """A list of all decorators the class is decorated with."""
     decorators = []
     for t in doc_ast.parse(self.obj).decorator_list:
         decorators.append(f"@{doc_ast.unparse(t)}")
     return decorators