Esempio n. 1
0
    def _init_function(self, name):
        from astroid.node_classes import Arguments
        from astroid.scoped_nodes import FunctionDef

        args = Arguments()
        args.postinit(
            args=[],
            defaults=[],
            kwonlyargs=[],
            kw_defaults=[],
            annotations=[],
            posonlyargs=[],
            posonlyargs_annotations=[],
            kwonlyargs_annotations=[],
        )

        function = FunctionDef(name=name, parent=self._instance)

        function.postinit(args=args, body=[])
        return function
Esempio n. 2
0
    def attr_getter(self):
        from astroid.scoped_nodes import FunctionDef

        return FunctionDef(name="getter", parent=self._instance)