Decorators¶
- class astroid.nodes.Decorators(lineno: int | None, col_offset: int | None, parent: NodeNG | None, *, end_lineno: int | None, end_col_offset: int | None)[source]¶
Bases:
NodeNGA node representing a list of decorators.
A
Decoratorsis the decorators that are applied to a method or function.>>> import astroid >>> node = astroid.extract_node(''' ... @property ... def my_property(self): ... return 3 ... ''') >>> node <FunctionDef.my_property l.3 at 0x...> >>> list(node.get_children())[0] <Decorators l.2 at 0x...>
- scope() LocalsDictNodeNG[source]¶
The first parent node defining a new scope. These can be Module, FunctionDef, ClassDef, Lambda, or GeneratorExp nodes.
- Returns:
The first parent scope node.