libb.find_decorators
- find_decorators(target)[source]
Find decorators applied to functions in a target module/class.
- Parameters:
target – Module or class to inspect.
- Returns:
Dictionary mapping function names to decorator AST representations.
- Return type:
Example:
>>> class Example: ... @staticmethod ... def static_method(): ... pass >>> decorators = find_decorators(Example) >>> 'static_method' in decorators True
Note
Algorithm from https://stackoverflow.com/a/9580006