The function type for this node.

        Possible values are: method, function, staticmethod, classmethod.

        :type: str
495327
def type(self):
        
        builtin_descriptors = {"classmethod", "staticmethod"}

        for decorator in self.extra_decorators:
            if decorator.func.name in builtin_descriptors:
                return decorator.func.name

        frame = self.parent.frame()
        type_name = "function"
        if isinstance(frame, ClassDef):
            if self.name == "__new__":
                return "classmethod"
            if sys.version_info >= (3, 6) and self.name == "__init_subclass__":
                return "classmethod"

            type_name = "method"

        if not self.decorators:
            return type_name

        for node in self.decorators.nodes:
            if isinstance(node, node_classes.Name):
                if node.name in builtin_descriptors:
                    return node.name

            if isinstance(node, node_classes.Call):
                # Handle the following case:
                # @some_decorator(arg1, arg2)
                # def func(...)
                #
                try:
                    current = next(node.func.infer())
                except exceptions.InferenceError:
                    continue
                _type = _infer_decorator_callchain(current)
                if _type is not None:
                    return _type

            try:
                for inferred in node.infer():
                    # Check to see if this returns a static or a class method.
                    _type = _infer_decorator_callchain(inferred)
                    if _type is not None:
                        return _type

                    if not isinstance(inferred, ClassDef):
                        continue
                    for ancestor in inferred.ancestors():
                        if not isinstance(ancestor, ClassDef):
                            continue
                        if ancestor.is_subtype_of("%s.classmethod" % BUILTINS):
                            return "classmethod"
                        if ancestor.is_subtype_of("%s.staticmethod" % BUILTINS):
                            return "staticmethod"
            except exceptions.InferenceError:
                pass
        return type_name
1046214
def get_node_type(tree):
    
    node_type = tree[0].label()
    assert node_type in NODE_TYPES, "node_type: {}".format(node_type)
    return node_type
753014
private static boolean isPrototypeMethodDefinition(Node node) {
    Node parent = node.getParent();
    Node grandparent = node.getGrandparent();
    if (parent == null || grandparent == null) {
      return false;
    }

    switch (node.getToken()) {
      case MEMBER_FUNCTION_DEF:
        if (NodeUtil.isEs6ConstructorMemberFunctionDef(node)) {
          return false; // Constructors aren't methods.
        }

        return true;

      case GETPROP:
        {
          // Case: `Foo.prototype.bar = function() { };
          if (parent.getFirstChild() != node) {
            return false;
          }

          if (!NodeUtil.isExprAssign(grandparent)) {
            return false;
          }

          Node functionNode = parent.getLastChild();
          if ((functionNode == null) || !functionNode.isFunction()) {
            return false;
          }

          Node nameNode = node.getFirstChild();
          return nameNode.isGetProp() && nameNode.getLastChild().getString().equals("prototype");
        }

      case STRING_KEY:
        {
          // Case: `Foo.prototype = {
          //          bar: function() { },
          //        }`
          checkArgument(parent.isObjectLit(), parent);

          if (!grandparent.isAssign()) {
            return false;
          }

          if (grandparent.getLastChild() != parent) {
            return false;
          }

          Node greatgrandparent = grandparent.getParent();
          if (greatgrandparent == null || !greatgrandparent.isExprResult()) {
            return false;
          }

          Node functionNode = node.getFirstChild();
          if ((functionNode == null) || !functionNode.isFunction()) {
            return false;
          }

          Node target = grandparent.getFirstChild();
          return target.isGetProp() && target.getLastChild().getString().equals("prototype");
        }

      default:
        return false;
    }
  }
171492
def get_class_that_defined_method(fun):
    
    if inspect.ismethod(fun):
        for cls in inspect.getmro(fun.__self__.__class__):
            if cls.__dict__.get(fun.__name__) is fun:
                return cls
        fun = fun.__func__  # fallback to __qualname__ parsing
    if inspect.isfunction(fun):
        cls = getattr(inspect.getmodule(fun),
                      fun.__qualname__.split('.<locals>', 1)[0].rsplit('.', 1)[0], None)
        if isinstance(cls, type):
            return cls
    return getattr(fun, '__objclass__', None)
621008
private static boolean implementsMethod(ClassNode classNode, String methodName, Class[] argTypes) {
        List methods = classNode.getMethods();
        if (argTypes == null || argTypes.length ==0) {
            for (Iterator i = methods.iterator(); i.hasNext();) {
                MethodNode mn = (MethodNode) i.next();
                boolean methodMatch = mn.getName().equals(methodName);
                if(methodMatch)return true;
                // TODO Implement further parameter analysis
            }
        }
        return false;
    }
625164
def _get_function_type(self, function_name):
        
        if (function_name.startswith("Fn::") and
                function_name[4:] in self.inspect_functions):
            return self.inspect_functions[function_name[4:]]
        return (self.inspect_functions['Ref'] if function_name == "Ref"
                else None)
447454
def CLASSDEF(self, node):
        
        for deco in node.decorator_list:
            self.handleNode(deco, node)
        for baseNode in node.bases:
            self.handleNode(baseNode, node)
        if not PY2:
            for keywordNode in node.keywords:
                self.handleNode(keywordNode, node)
        self.pushScope(ClassScope)
        # doctest does not process doctest within a doctest
        # classes within classes are processed.
        if (self.withDoctest and
                not self._in_doctest() and
                not isinstance(self.scope, FunctionScope)):
            self.deferFunction(lambda: self.handleDoctests(node))
        for stmt in node.body:
            self.handleNode(stmt, node)
        self.popScope()
        self.addBinding(node, ClassDefinition(node.name, node))
204374
def methods(self):
        
        def is_method(comment):
            return isinstance(comment, FunctionDoc) and comment.member
        return self._filtered_iter(is_method)
259524
def get_methods(self):
        
        l = []
        for i in self.classes.class_def:
            for j in i.get_methods():
                l.append(j)
        return l
851595
def type(self):
        ""
        if self._type is None and len(self):
            self._type = self.values()[0].__class__
        return self._type
85538
def is_model_view_subclass_method_shouldnt_be_function(node):
    """"""
    if node.name not in ('get', 'post'):
        return False

    parent = node.parent
    while parent and not isinstance(parent, ScopedClass):
        parent = parent.parent

    subclass = ('django.views.View',
                'django.views.generic.View',
                'django.views.generic.base.View',)

    return parent is not None and node_is_subclass(parent, *subclass)
173856
def get_docstring(node):
    
    if not isinstance(node, (FunctionDef, ClassDef, Module)):
        raise TypeError("%r can't have docstrings" % node.__class__.__name__)
    if node.body and isinstance(node.body[0], Str):
        return node.body[0].s
847816
def visit_functiondef(self, node):
        
        if not node.is_method():
            # We only check methods.
            return

        name = node.name

        if isTestModule(node.root().name):
            if name.startswith('test'):
                if not name.startswith('test_'):
                    self.add_message('C9303', node=node)
                    return
                else:
                    # Test names start with 'test_NAME' and can be like
                    # test_SOME_NAME or test_render_SomeCondition.
                    return

        if name[0].isupper():
            self.add_message('C9302', node=node)
            return

        if name.startswith('___'):
            self.add_message('C9302', node=node)
            return

        if name.endswith('___'):
            self.add_message('C9302', node=node)
            return

        if name.startswith('__'):
            if name.endswith('___'):
                # To many trailing underscores.
                self.add_message('C9302', node=node)
                return
            if name.endswith('_') and not name.endswith('__'):
                # To few trailing underscored
                self.add_message('C9302', node=node)
                return
            if name.endswith('__'):
                # This is a reserved name and we don't do any checks on it.
                return
            name = name[2:-2]

        if name.startswith('_'):
            name = name[1:]

        if name.endswith('_'):
            self.add_message('C9302', node=node)
            return

        if '_' in name:
            # This has a underscore in the main name.
            prefix = self._getMethodNamePrefix(node)
            if prefix:
                # There are other names with same prefix so this should be
                # a dispatched method.
                return

            self.add_message('C9302', node=node)
            return


        if isTestModule(node.name) and self.moduleContainsTestCase(node):
            self._checkTestMethodName(node)
924044
def log_type(args_kw, ret, func, slf=False, prop_getter=False, clss=None, argspecs=None,
            args_kw_type=None, ret_type = None):
    
    if args_kw_type is None:
        args_kw_type = deep_type(args_kw)
    if ret_type is None:
        ret_type = deep_type(ret)
    if argspecs is None:
        argspecs = getargspecs(func)
    node = _register_logged_func(func, slf, prop_getter, clss, argspecs)
    node.add_observation(args_kw_type, ret_type)
    
    md = util.getmodule_for_member(func, prop_getter)
    if not md.__name__ in _module_file_map:
        _module_file_map[md.__name__] = md.__file__

    if clss is None:
        try:
            clss = util.get_class_that_defined_method(func)
        except ValueError:
            pass
    if not clss is None and not clss in _member_line_map:
        _member_line_map[clss] = findsource(clss)[1]
129947
def all_methods(cls):
        
        def name(fn):
            return fn.__get__(cls).__name__.replace("_", "-")
        return sorted(name(f) for f in cls.__dict__.values()
                      if isinstance(f, staticmethod))
457788
def enum_type(self):
        
        if not hasattr(self, '_enum_type'):
            assert self.kind == CursorKind.ENUM_DECL
            self._enum_type = conf.lib.clang_getEnumDeclIntegerType(self)

        return self._enum_type
1154070
def function_info(self, functionKey):
        """"""
        node_type = 'function'
        filename, line_number, function_name = functionKey
        if function_name == '<module>':
            modulePath, moduleName = osp.split(filename)
            node_type = 'module'
            if moduleName == '__init__.py':
                modulePath, moduleName = osp.split(modulePath)
            function_name = '<' + moduleName + '>'
        if not filename or filename == '~':
            file_and_line = '(built-in)'
            node_type = 'builtin'
        else:
            if function_name == '__init__':
                node_type = 'constructor'                
            file_and_line = '%s : %d' % (filename, line_number)
        return filename, line_number, function_name, file_and_line, node_type