Path 1: 1273 calls (0.89)

ClassDef (1273)

False (1273)

1def _is_exempt_from_public_methods(node: astroid.ClassDef) -> bool:
2    """Check if a class is exempt from too-few-public-methods."""
3
4    # If it's a typing.Namedtuple, typing.TypedDict or an Enum
5    for ancestor in node.ancestors():
6        if is_enum(ancestor):
7            return True
8        if ancestor.qname() in (TYPING_NAMEDTUPLE, TYPING_TYPEDDICT):
9            return True
10
11    # Or if it's a dataclass
12    if not node.decorators:
13        return False
14
15    root_locals = set(node.root().locals)
16    for decorator in node.decorators.nodes:
17        if isinstance(decorator, astroid.Call):
18            decorator = decorator.func
19        if not isinstance(decorator, (astroid.Name, astroid.Attribute)):
20            continue
21        if isinstance(decorator, astroid.Name):
22            name = decorator.name
23        else:
24            name = decorator.attrname
25        if name in DATACLASSES_DECORATORS and (
26            root_locals.intersection(DATACLASSES_DECORATORS)
27            or DATACLASS_IMPORT in root_locals
28        ):
29            return True
30    return False
            

Path 2: 39 calls (0.03)

ClassDef (39)

True (39)

1def _is_exempt_from_public_methods(node: astroid.ClassDef) -> bool:
2    """Check if a class is exempt from too-few-public-methods."""
3
4    # If it's a typing.Namedtuple, typing.TypedDict or an Enum
5    for ancestor in node.ancestors():
6        if is_enum(ancestor):
7            return True
8        if ancestor.qname() in (TYPING_NAMEDTUPLE, TYPING_TYPEDDICT):
9            return True
10
11    # Or if it's a dataclass
12    if not node.decorators:
13        return False
14
15    root_locals = set(node.root().locals)
16    for decorator in node.decorators.nodes:
17        if isinstance(decorator, astroid.Call):
18            decorator = decorator.func
19        if not isinstance(decorator, (astroid.Name, astroid.Attribute)):
20            continue
21        if isinstance(decorator, astroid.Name):
22            name = decorator.name
23        else:
24            name = decorator.attrname
25        if name in DATACLASSES_DECORATORS and (
26            root_locals.intersection(DATACLASSES_DECORATORS)
27            or DATACLASS_IMPORT in root_locals
28        ):
29            return True
30    return False
            

Path 3: 33 calls (0.02)

ClassDef (33)

True (33)

1def _is_exempt_from_public_methods(node: astroid.ClassDef) -> bool:
2    """Check if a class is exempt from too-few-public-methods."""
3
4    # If it's a typing.Namedtuple, typing.TypedDict or an Enum
5    for ancestor in node.ancestors():
6        if is_enum(ancestor):
7            return True
8        if ancestor.qname() in (TYPING_NAMEDTUPLE, TYPING_TYPEDDICT):
9            return True
10
11    # Or if it's a dataclass
12    if not node.decorators:
13        return False
14
15    root_locals = set(node.root().locals)
16    for decorator in node.decorators.nodes:
17        if isinstance(decorator, astroid.Call):
18            decorator = decorator.func
19        if not isinstance(decorator, (astroid.Name, astroid.Attribute)):
20            continue
21        if isinstance(decorator, astroid.Name):
22            name = decorator.name
23        else:
24            name = decorator.attrname
25        if name in DATACLASSES_DECORATORS and (
26            root_locals.intersection(DATACLASSES_DECORATORS)
27            or DATACLASS_IMPORT in root_locals
28        ):
29            return True
30    return False
            

Path 4: 23 calls (0.02)

ClassDef (23)

False (23)

1def _is_exempt_from_public_methods(node: astroid.ClassDef) -> bool:
2    """Check if a class is exempt from too-few-public-methods."""
3
4    # If it's a typing.Namedtuple, typing.TypedDict or an Enum
5    for ancestor in node.ancestors():
6        if is_enum(ancestor):
7            return True
8        if ancestor.qname() in (TYPING_NAMEDTUPLE, TYPING_TYPEDDICT):
9            return True
10
11    # Or if it's a dataclass
12    if not node.decorators:
13        return False
14
15    root_locals = set(node.root().locals)
16    for decorator in node.decorators.nodes:
17        if isinstance(decorator, astroid.Call):
18            decorator = decorator.func
19        if not isinstance(decorator, (astroid.Name, astroid.Attribute)):
20            continue
21        if isinstance(decorator, astroid.Name):
22            name = decorator.name
23        else:
24            name = decorator.attrname
25        if name in DATACLASSES_DECORATORS and (
26            root_locals.intersection(DATACLASSES_DECORATORS)
27            or DATACLASS_IMPORT in root_locals
28        ):
29            return True
30    return False
            

Path 5: 22 calls (0.02)

ClassDef (22)

True (22)

1def _is_exempt_from_public_methods(node: astroid.ClassDef) -> bool:
2    """Check if a class is exempt from too-few-public-methods."""
3
4    # If it's a typing.Namedtuple, typing.TypedDict or an Enum
5    for ancestor in node.ancestors():
6        if is_enum(ancestor):
7            return True
8        if ancestor.qname() in (TYPING_NAMEDTUPLE, TYPING_TYPEDDICT):
9            return True
10
11    # Or if it's a dataclass
12    if not node.decorators:
13        return False
14
15    root_locals = set(node.root().locals)
16    for decorator in node.decorators.nodes:
17        if isinstance(decorator, astroid.Call):
18            decorator = decorator.func
19        if not isinstance(decorator, (astroid.Name, astroid.Attribute)):
20            continue
21        if isinstance(decorator, astroid.Name):
22            name = decorator.name
23        else:
24            name = decorator.attrname
25        if name in DATACLASSES_DECORATORS and (
26            root_locals.intersection(DATACLASSES_DECORATORS)
27            or DATACLASS_IMPORT in root_locals
28        ):
29            return True
30    return False
            

Path 6: 19 calls (0.01)

ClassDef (19)

False (19)

1def _is_exempt_from_public_methods(node: astroid.ClassDef) -> bool:
2    """Check if a class is exempt from too-few-public-methods."""
3
4    # If it's a typing.Namedtuple, typing.TypedDict or an Enum
5    for ancestor in node.ancestors():
6        if is_enum(ancestor):
7            return True
8        if ancestor.qname() in (TYPING_NAMEDTUPLE, TYPING_TYPEDDICT):
9            return True
10
11    # Or if it's a dataclass
12    if not node.decorators:
13        return False
14
15    root_locals = set(node.root().locals)
16    for decorator in node.decorators.nodes:
17        if isinstance(decorator, astroid.Call):
18            decorator = decorator.func
19        if not isinstance(decorator, (astroid.Name, astroid.Attribute)):
20            continue
21        if isinstance(decorator, astroid.Name):
22            name = decorator.name
23        else:
24            name = decorator.attrname
25        if name in DATACLASSES_DECORATORS and (
26            root_locals.intersection(DATACLASSES_DECORATORS)
27            or DATACLASS_IMPORT in root_locals
28        ):
29            return True
30    return False
            

Path 7: 9 calls (0.01)

ClassDef (9)

True (9)

1def _is_exempt_from_public_methods(node: astroid.ClassDef) -> bool:
2    """Check if a class is exempt from too-few-public-methods."""
3
4    # If it's a typing.Namedtuple, typing.TypedDict or an Enum
5    for ancestor in node.ancestors():
6        if is_enum(ancestor):
7            return True
8        if ancestor.qname() in (TYPING_NAMEDTUPLE, TYPING_TYPEDDICT):
9            return True
10
11    # Or if it's a dataclass
12    if not node.decorators:
13        return False
14
15    root_locals = set(node.root().locals)
16    for decorator in node.decorators.nodes:
17        if isinstance(decorator, astroid.Call):
18            decorator = decorator.func
19        if not isinstance(decorator, (astroid.Name, astroid.Attribute)):
20            continue
21        if isinstance(decorator, astroid.Name):
22            name = decorator.name
23        else:
24            name = decorator.attrname
25        if name in DATACLASSES_DECORATORS and (
26            root_locals.intersection(DATACLASSES_DECORATORS)
27            or DATACLASS_IMPORT in root_locals
28        ):
29            return True
30    return False
            

Path 8: 6 calls (0.0)

ClassDef (6)

True (6)

1def _is_exempt_from_public_methods(node: astroid.ClassDef) -> bool:
2    """Check if a class is exempt from too-few-public-methods."""
3
4    # If it's a typing.Namedtuple, typing.TypedDict or an Enum
5    for ancestor in node.ancestors():
6        if is_enum(ancestor):
7            return True
8        if ancestor.qname() in (TYPING_NAMEDTUPLE, TYPING_TYPEDDICT):
9            return True
10
11    # Or if it's a dataclass
12    if not node.decorators:
13        return False
14
15    root_locals = set(node.root().locals)
16    for decorator in node.decorators.nodes:
17        if isinstance(decorator, astroid.Call):
18            decorator = decorator.func
19        if not isinstance(decorator, (astroid.Name, astroid.Attribute)):
20            continue
21        if isinstance(decorator, astroid.Name):
22            name = decorator.name
23        else:
24            name = decorator.attrname
25        if name in DATACLASSES_DECORATORS and (
26            root_locals.intersection(DATACLASSES_DECORATORS)
27            or DATACLASS_IMPORT in root_locals
28        ):
29            return True
30    return False
            

Path 9: 3 calls (0.0)

ClassDef (3)

True (3)

1def _is_exempt_from_public_methods(node: astroid.ClassDef) -> bool:
2    """Check if a class is exempt from too-few-public-methods."""
3
4    # If it's a typing.Namedtuple, typing.TypedDict or an Enum
5    for ancestor in node.ancestors():
6        if is_enum(ancestor):
7            return True
8        if ancestor.qname() in (TYPING_NAMEDTUPLE, TYPING_TYPEDDICT):
9            return True
10
11    # Or if it's a dataclass
12    if not node.decorators:
13        return False
14
15    root_locals = set(node.root().locals)
16    for decorator in node.decorators.nodes:
17        if isinstance(decorator, astroid.Call):
18            decorator = decorator.func
19        if not isinstance(decorator, (astroid.Name, astroid.Attribute)):
20            continue
21        if isinstance(decorator, astroid.Name):
22            name = decorator.name
23        else:
24            name = decorator.attrname
25        if name in DATACLASSES_DECORATORS and (
26            root_locals.intersection(DATACLASSES_DECORATORS)
27            or DATACLASS_IMPORT in root_locals
28        ):
29            return True
30    return False
            

Path 10: 3 calls (0.0)

ClassDef (3)

False (3)

1def _is_exempt_from_public_methods(node: astroid.ClassDef) -> bool:
2    """Check if a class is exempt from too-few-public-methods."""
3
4    # If it's a typing.Namedtuple, typing.TypedDict or an Enum
5    for ancestor in node.ancestors():
6        if is_enum(ancestor):
7            return True
8        if ancestor.qname() in (TYPING_NAMEDTUPLE, TYPING_TYPEDDICT):
9            return True
10
11    # Or if it's a dataclass
12    if not node.decorators:
13        return False
14
15    root_locals = set(node.root().locals)
16    for decorator in node.decorators.nodes:
17        if isinstance(decorator, astroid.Call):
18            decorator = decorator.func
19        if not isinstance(decorator, (astroid.Name, astroid.Attribute)):
20            continue
21        if isinstance(decorator, astroid.Name):
22            name = decorator.name
23        else:
24            name = decorator.attrname
25        if name in DATACLASSES_DECORATORS and (
26            root_locals.intersection(DATACLASSES_DECORATORS)
27            or DATACLASS_IMPORT in root_locals
28        ):
29            return True
30    return False
            

Path 11: 3 calls (0.0)

ClassDef (3)

False (3)

1def _is_exempt_from_public_methods(node: astroid.ClassDef) -> bool:
2    """Check if a class is exempt from too-few-public-methods."""
3
4    # If it's a typing.Namedtuple, typing.TypedDict or an Enum
5    for ancestor in node.ancestors():
6        if is_enum(ancestor):
7            return True
8        if ancestor.qname() in (TYPING_NAMEDTUPLE, TYPING_TYPEDDICT):
9            return True
10
11    # Or if it's a dataclass
12    if not node.decorators:
13        return False
14
15    root_locals = set(node.root().locals)
16    for decorator in node.decorators.nodes:
17        if isinstance(decorator, astroid.Call):
18            decorator = decorator.func
19        if not isinstance(decorator, (astroid.Name, astroid.Attribute)):
20            continue
21        if isinstance(decorator, astroid.Name):
22            name = decorator.name
23        else:
24            name = decorator.attrname
25        if name in DATACLASSES_DECORATORS and (
26            root_locals.intersection(DATACLASSES_DECORATORS)
27            or DATACLASS_IMPORT in root_locals
28        ):
29            return True
30    return False
            

Path 12: 2 calls (0.0)

ClassDef (2)

True (2)

1def _is_exempt_from_public_methods(node: astroid.ClassDef) -> bool:
2    """Check if a class is exempt from too-few-public-methods."""
3
4    # If it's a typing.Namedtuple, typing.TypedDict or an Enum
5    for ancestor in node.ancestors():
6        if is_enum(ancestor):
7            return True
8        if ancestor.qname() in (TYPING_NAMEDTUPLE, TYPING_TYPEDDICT):
9            return True
10
11    # Or if it's a dataclass
12    if not node.decorators:
13        return False
14
15    root_locals = set(node.root().locals)
16    for decorator in node.decorators.nodes:
17        if isinstance(decorator, astroid.Call):
18            decorator = decorator.func
19        if not isinstance(decorator, (astroid.Name, astroid.Attribute)):
20            continue
21        if isinstance(decorator, astroid.Name):
22            name = decorator.name
23        else:
24            name = decorator.attrname
25        if name in DATACLASSES_DECORATORS and (
26            root_locals.intersection(DATACLASSES_DECORATORS)
27            or DATACLASS_IMPORT in root_locals
28        ):
29            return True
30    return False
            

Path 13: 2 calls (0.0)

ClassDef (2)

False (2)

1def _is_exempt_from_public_methods(node: astroid.ClassDef) -> bool:
2    """Check if a class is exempt from too-few-public-methods."""
3
4    # If it's a typing.Namedtuple, typing.TypedDict or an Enum
5    for ancestor in node.ancestors():
6        if is_enum(ancestor):
7            return True
8        if ancestor.qname() in (TYPING_NAMEDTUPLE, TYPING_TYPEDDICT):
9            return True
10
11    # Or if it's a dataclass
12    if not node.decorators:
13        return False
14
15    root_locals = set(node.root().locals)
16    for decorator in node.decorators.nodes:
17        if isinstance(decorator, astroid.Call):
18            decorator = decorator.func
19        if not isinstance(decorator, (astroid.Name, astroid.Attribute)):
20            continue
21        if isinstance(decorator, astroid.Name):
22            name = decorator.name
23        else:
24            name = decorator.attrname
25        if name in DATACLASSES_DECORATORS and (
26            root_locals.intersection(DATACLASSES_DECORATORS)
27            or DATACLASS_IMPORT in root_locals
28        ):
29            return True
30    return False
            

Path 14: 1 calls (0.0)

ClassDef (1)

True (1)

1def _is_exempt_from_public_methods(node: astroid.ClassDef) -> bool:
2    """Check if a class is exempt from too-few-public-methods."""
3
4    # If it's a typing.Namedtuple, typing.TypedDict or an Enum
5    for ancestor in node.ancestors():
6        if is_enum(ancestor):
7            return True
8        if ancestor.qname() in (TYPING_NAMEDTUPLE, TYPING_TYPEDDICT):
9            return True
10
11    # Or if it's a dataclass
12    if not node.decorators:
13        return False
14
15    root_locals = set(node.root().locals)
16    for decorator in node.decorators.nodes:
17        if isinstance(decorator, astroid.Call):
18            decorator = decorator.func
19        if not isinstance(decorator, (astroid.Name, astroid.Attribute)):
20            continue
21        if isinstance(decorator, astroid.Name):
22            name = decorator.name
23        else:
24            name = decorator.attrname
25        if name in DATACLASSES_DECORATORS and (
26            root_locals.intersection(DATACLASSES_DECORATORS)
27            or DATACLASS_IMPORT in root_locals
28        ):
29            return True
30    return False