Path 1: 14 calls (0.58)

'_' (5) 'missing' (3) 'answer' (1) 'test' (1) '_bar' (1) 'teta' (1) '__reader' (1) '__writer' (1)

ClassDef (14)

False (14)

AttributeInferenceError (14)

1def _is_attribute_property(name: str, klass: nodes.ClassDef) -> bool:
2    """Check if the given attribute *name* is a property in the given *klass*.
3
4    It will look for `property` calls or for functions
5    with the given name, decorated by `property` or `property`
6    subclasses.
7    Returns ``True`` if the name is a property in the given klass,
8    ``False`` otherwise.
9    """
10
11    try:
12        attributes = klass.getattr(name)
13    except astroid.NotFoundError:
14        return False
15    property_name = "builtins.property"
16    for attr in attributes:
17        if attr is astroid.Uninferable:
18            continue
19        try:
20            inferred = next(attr.infer())
21        except astroid.InferenceError:
22            continue
23        if isinstance(inferred, nodes.FunctionDef) and decorated_with_property(
24            inferred
25        ):
26            return True
27        if inferred.pytype() != property_name:
28            continue
29
30        cls = node_frame_class(inferred)
31        if cls == klass.declared_metaclass():
32            continue
33        return True
34    return False
            

Path 2: 5 calls (0.21)

'__class__' (2) 'data_descriptor' (1) 'non_data_descriptor' (1) 'attr2' (1)

ClassDef (5)

False (5)

1def _is_attribute_property(name: str, klass: nodes.ClassDef) -> bool:
2    """Check if the given attribute *name* is a property in the given *klass*.
3
4    It will look for `property` calls or for functions
5    with the given name, decorated by `property` or `property`
6    subclasses.
7    Returns ``True`` if the name is a property in the given klass,
8    ``False`` otherwise.
9    """
10
11    try:
12        attributes = klass.getattr(name)
13    except astroid.NotFoundError:
14        return False
15    property_name = "builtins.property"
16    for attr in attributes:
17        if attr is astroid.Uninferable:
18            continue
19        try:
20            inferred = next(attr.infer())
21        except astroid.InferenceError:
22            continue
23        if isinstance(inferred, nodes.FunctionDef) and decorated_with_property(
24            inferred
25        ):
26            return True
27        if inferred.pytype() != property_name:
28            continue
29
30        cls = node_frame_class(inferred)
31        if cls == klass.declared_metaclass():
32            continue
33        return True
34    return False
            

Path 3: 4 calls (0.17)

'test' (2) 'prop' (1) 'other' (1)

ClassDef (4)

1def _is_attribute_property(name: str, klass: nodes.ClassDef) -> bool:
2    """Check if the given attribute *name* is a property in the given *klass*.
3
4    It will look for `property` calls or for functions
5    with the given name, decorated by `property` or `property`
6    subclasses.
7    Returns ``True`` if the name is a property in the given klass,
8    ``False`` otherwise.
9    """
10
11    try:
12        attributes = klass.getattr(name)
13    except astroid.NotFoundError:
14        return False
15    property_name = "builtins.property"
16    for attr in attributes:
17        if attr is astroid.Uninferable:
18            continue
19        try:
20            inferred = next(attr.infer())
21        except astroid.InferenceError:
22            continue
23        if isinstance(inferred, nodes.FunctionDef) and decorated_with_property(
24            inferred
25        ):
26            return True
27        if inferred.pytype() != property_name:
28            continue
29
30        cls = node_frame_class(inferred)
31        if cls == klass.declared_metaclass():
32            continue
33        return True
34    return False
            

Path 4: 1 calls (0.04)

'nargs' (1)

ClassDef (1)

False (1)

1def _is_attribute_property(name: str, klass: nodes.ClassDef) -> bool:
2    """Check if the given attribute *name* is a property in the given *klass*.
3
4    It will look for `property` calls or for functions
5    with the given name, decorated by `property` or `property`
6    subclasses.
7    Returns ``True`` if the name is a property in the given klass,
8    ``False`` otherwise.
9    """
10
11    try:
12        attributes = klass.getattr(name)
13    except astroid.NotFoundError:
14        return False
15    property_name = "builtins.property"
16    for attr in attributes:
17        if attr is astroid.Uninferable:
18            continue
19        try:
20            inferred = next(attr.infer())
21        except astroid.InferenceError:
22            continue
23        if isinstance(inferred, nodes.FunctionDef) and decorated_with_property(
24            inferred
25        ):
26            return True
27        if inferred.pytype() != property_name:
28            continue
29
30        cls = node_frame_class(inferred)
31        if cls == klass.declared_metaclass():
32            continue
33        return True
34    return False