pylint/checkers/base.py
def _determine_function_name_type(node, config=None):
    """Determine the name type whose regex the a function's name should match.

    :param node: A function node.
    :type node: astroid.node_classes.NodeNG
    :param config: Configuration from which to pull additional property classes.
    :type config: :class:`optparse.Values`

    :returns: One of ('function', 'method', 'attr')
    :rtype: str
    """
    property_classes, property_names = _get_properties(config)
    if not node.is_method():
        return "function"
    if node.decorators:
        decorators = node.decorators.nodes
    else:
        decorators = []
    for decorator in decorators:
        # If the function is a property (decorated with @property
        # or @abc.abstractproperty), the name type is 'attr'.
        if isinstance(decorator, astroid.Name) or (
            isinstance(decorator, astroid.Attribute)
            and decorator.attrname in property_names
        ):
            infered = utils.safe_infer(decorator)
            if infered and infered.qname() in property_classes:
                return "attr"
        # If the function is decorated using the prop_method.{setter,getter}
        # form, treat it like an attribute as well.
        elif isinstance(decorator, astroid.Attribute) and decorator.attrname in (
            "setter",
            "deleter",
        ):
            return "attr"
    return "method"
def _determine_function_name_type(node, config=None):
    property_classes, property_names = _get_properties(config)
    if not node.is_method():
        return "function"
    if node.decorators:
        decorators = node.decorators.nodes
    else:
        decorators = []
    for decorator in decorators:
        # If the function is a property (decorated with @property
        # or @abc.abstractproperty), the name type is 'attr'.
        if isinstance(decorator, astroid.Name) or (
            isinstance(decorator, astroid.Attribute)
            and decorator.attrname in property_names
        ):
            infered = utils.safe_infer(decorator)
            if infered and infered.qname() in property_classes:
                return "attr"
        # If the function is decorated using the prop_method.{setter,getter}
        # form, treat it like an attribute as well.
        elif isinstance(decorator, astroid.Attribute) and decorator.attrname in (
            "setter",
            "deleter",
        ):
            return "attr"
    return "method"
def _determine_function_name_type ( node , config = None ) : property_classes , property_names = _get_properties ( config ) if not node . is_method ( ) : return "function" if node . decorators : decorators = node . decorators . nodes else : decorators = [ ] for decorator in decorators : # If the function is a property (decorated with @property # or @abc.abstractproperty), the name type is 'attr'. if isinstance ( decorator , astroid . Name ) or ( isinstance ( decorator , astroid . Attribute ) and decorator . attrname in property_names ) : infered = utils . safe_infer ( decorator ) if infered and infered . qname ( ) in property_classes : return "attr" # If the function is decorated using the prop_method.{setter,getter} # form, treat it like an attribute as well. elif isinstance ( decorator , astroid . Attribute ) and decorator . attrname in ( "setter" , "deleter" , ) : return "attr" return "method"
Determine the name type whose regex the a function's name should match.

    :param node: A function node.
    :type node: astroid.node_classes.NodeNG
    :param config: Configuration from which to pull additional property classes.
    :type config: :class:`optparse.Values`

    :returns: One of ('function', 'method', 'attr')
    :rtype: str
Determine the name type whose regex the a function s name should match .