Path 1: 149359 calls (0.88)

'ignore-paths' (1488) 'persistent' (1488) 'load-plugins' (1488) 'evaluation' (1488) 'fail-under' (1488) 'fail-on' (1488) 'confidence' (1488) 'msg-temp...

dict (61874) {'default': True, 'type': 'yn', 'metavar': '', 'help': 'Pickle collected data for later comparisons.'} (1488) {'type': 'string', ...

_StoreArgument (149359)

1def _convert_option_to_argument(
2    opt: str, optdict: dict[str, Any]
3) -> (
4    _StoreArgument
5    | _StoreTrueArgument
6    | _CallableArgument
7    | _StoreOldNamesArgument
8    | _StoreNewNamesArgument
9    | _ExtendArgument
10):
11    """Convert an optdict to an Argument class instance."""
12    if "level" in optdict and "hide" not in optdict:
13        warnings.warn(
14            "The 'level' key in optdicts has been deprecated. "
15            "Use 'hide' with a boolean to hide an option from the help message. "
16            f"optdict={optdict}",
17            DeprecationWarning,
18        )
19
20    # Get the long and short flags
21    flags = [f"--{opt}"]
22    if "short" in optdict:
23        flags += [f"-{optdict['short']}"]
24
25    # Get the action type
26    action = optdict.get("action", "store")
27
28    if action == "store_true":
29        return _StoreTrueArgument(
30            flags=flags,
31            action=action,
32            default=optdict.get("default", True),
33            arg_help=optdict.get("help", ""),
34            hide_help=optdict.get("hide", False),
35            section=optdict.get("group", None),
36        )
37    if not isinstance(action, str) and issubclass(action, _CallbackAction):
38        return _CallableArgument(
39            flags=flags,
40            action=action,
41            arg_help=optdict.get("help", ""),
42            kwargs=optdict.get("kwargs", {}),
43            hide_help=optdict.get("hide", False),
44            section=optdict.get("group", None),
45            metavar=optdict.get("metavar", None),
46        )
47    try:
48        default = optdict["default"]
49    except KeyError:
50        warnings.warn(
51            "An option dictionary should have a 'default' key to specify "
52            "the option's default value. This key will be required in pylint "
53            "3.0. It is not required for 'store_true' and callable actions. "
54            f"optdict={optdict}",
55            DeprecationWarning,
56        )
57        default = None
58    if action == "extend":
59        return _ExtendArgument(
60            flags=flags,
61            action=action,
62            default=[] if default is None else default,
63            arg_type=optdict["type"],
64            choices=optdict.get("choices", None),
65            arg_help=optdict.get("help", ""),
66            metavar=optdict.get("metavar", ""),
67            hide_help=optdict.get("hide", False),
68            section=optdict.get("group", None),
69            dest=optdict.get("dest", None),
70        )
71    if "kwargs" in optdict:
72        if "old_names" in optdict["kwargs"]:
73            return _StoreOldNamesArgument(
74                flags=flags,
75                default=default,
76                arg_type=optdict["type"],
77                choices=optdict.get("choices", None),
78                arg_help=optdict.get("help", ""),
79                metavar=optdict.get("metavar", ""),
80                hide_help=optdict.get("hide", False),
81                kwargs=optdict.get("kwargs", {}),
82                section=optdict.get("group", None),
83            )
84        if "new_names" in optdict["kwargs"]:
85            return _StoreNewNamesArgument(
86                flags=flags,
87                default=default,
88                arg_type=optdict["type"],
89                choices=optdict.get("choices", None),
90                arg_help=optdict.get("help", ""),
91                metavar=optdict.get("metavar", ""),
92                hide_help=optdict.get("hide", False),
93                kwargs=optdict.get("kwargs", {}),
94                section=optdict.get("group", None),
95            )
96    if "dest" in optdict:
97        return _StoreOldNamesArgument(
98            flags=flags,
99            default=default,
100            arg_type=optdict["type"],
101            choices=optdict.get("choices", None),
102            arg_help=optdict.get("help", ""),
103            metavar=optdict.get("metavar", ""),
104            hide_help=optdict.get("hide", False),
105            kwargs={"old_names": [optdict["dest"]]},
106            section=optdict.get("group", None),
107        )
108    return _StoreArgument(
109        flags=flags,
110        action=action,
111        default=default,
112        arg_type=optdict["type"],
113        choices=optdict.get("choices", None),
114        arg_help=optdict.get("help", ""),
115        metavar=optdict.get("metavar", ""),
116        hide_help=optdict.get("hide", False),
117        section=optdict.get("group", None),
118    )
            

Path 2: 4982 calls (0.03)

'output-format' (1488) 'enable' (1488) 'disable' (1488) 'errors-only' (259) 'verbose' (259)

dict (4982)

_CallableArgument (4982)

1def _convert_option_to_argument(
2    opt: str, optdict: dict[str, Any]
3) -> (
4    _StoreArgument
5    | _StoreTrueArgument
6    | _CallableArgument
7    | _StoreOldNamesArgument
8    | _StoreNewNamesArgument
9    | _ExtendArgument
10):
11    """Convert an optdict to an Argument class instance."""
12    if "level" in optdict and "hide" not in optdict:
13        warnings.warn(
14            "The 'level' key in optdicts has been deprecated. "
15            "Use 'hide' with a boolean to hide an option from the help message. "
16            f"optdict={optdict}",
17            DeprecationWarning,
18        )
19
20    # Get the long and short flags
21    flags = [f"--{opt}"]
22    if "short" in optdict:
23        flags += [f"-{optdict['short']}"]
24
25    # Get the action type
26    action = optdict.get("action", "store")
27
28    if action == "store_true":
29        return _StoreTrueArgument(
30            flags=flags,
31            action=action,
32            default=optdict.get("default", True),
33            arg_help=optdict.get("help", ""),
34            hide_help=optdict.get("hide", False),
35            section=optdict.get("group", None),
36        )
37    if not isinstance(action, str) and issubclass(action, _CallbackAction):
38        return _CallableArgument(
39            flags=flags,
40            action=action,
41            arg_help=optdict.get("help", ""),
42            kwargs=optdict.get("kwargs", {}),
43            hide_help=optdict.get("hide", False),
44            section=optdict.get("group", None),
45            metavar=optdict.get("metavar", None),
46        )
47    try:
48        default = optdict["default"]
49    except KeyError:
50        warnings.warn(
51            "An option dictionary should have a 'default' key to specify "
52            "the option's default value. This key will be required in pylint "
53            "3.0. It is not required for 'store_true' and callable actions. "
54            f"optdict={optdict}",
55            DeprecationWarning,
56        )
57        default = None
58    if action == "extend":
59        return _ExtendArgument(
60            flags=flags,
61            action=action,
62            default=[] if default is None else default,
63            arg_type=optdict["type"],
64            choices=optdict.get("choices", None),
65            arg_help=optdict.get("help", ""),
66            metavar=optdict.get("metavar", ""),
67            hide_help=optdict.get("hide", False),
68            section=optdict.get("group", None),
69            dest=optdict.get("dest", None),
70        )
71    if "kwargs" in optdict:
72        if "old_names" in optdict["kwargs"]:
73            return _StoreOldNamesArgument(
74                flags=flags,
75                default=default,
76                arg_type=optdict["type"],
77                choices=optdict.get("choices", None),
78                arg_help=optdict.get("help", ""),
79                metavar=optdict.get("metavar", ""),
80                hide_help=optdict.get("hide", False),
81                kwargs=optdict.get("kwargs", {}),
82                section=optdict.get("group", None),
83            )
84        if "new_names" in optdict["kwargs"]:
85            return _StoreNewNamesArgument(
86                flags=flags,
87                default=default,
88                arg_type=optdict["type"],
89                choices=optdict.get("choices", None),
90                arg_help=optdict.get("help", ""),
91                metavar=optdict.get("metavar", ""),
92                hide_help=optdict.get("hide", False),
93                kwargs=optdict.get("kwargs", {}),
94                section=optdict.get("group", None),
95            )
96    if "dest" in optdict:
97        return _StoreOldNamesArgument(
98            flags=flags,
99            default=default,
100            arg_type=optdict["type"],
101            choices=optdict.get("choices", None),
102            arg_help=optdict.get("help", ""),
103            metavar=optdict.get("metavar", ""),
104            hide_help=optdict.get("hide", False),
105            kwargs={"old_names": [optdict["dest"]]},
106            section=optdict.get("group", None),
107        )
108    return _StoreArgument(
109        flags=flags,
110        action=action,
111        default=default,
112        arg_type=optdict["type"],
113        choices=optdict.get("choices", None),
114        arg_help=optdict.get("help", ""),
115        metavar=optdict.get("metavar", ""),
116        hide_help=optdict.get("hide", False),
117        section=optdict.get("group", None),
118    )
            

Path 3: 4614 calls (0.03)

'reports' (1488) 'score' (1488) 'jobs' (1488) 'show-ancestors' (30) 'show-associated' (30) 'module-names' (30) 'project' (30) 'output-directory' (30) ...

{'default': False, 'type': 'yn', 'metavar': '', 'short': 'r', 'group': 'Reports', 'help': 'Tells whether to display a full report or only the ...

_StoreArgument (4614)

1def _convert_option_to_argument(
2    opt: str, optdict: dict[str, Any]
3) -> (
4    _StoreArgument
5    | _StoreTrueArgument
6    | _CallableArgument
7    | _StoreOldNamesArgument
8    | _StoreNewNamesArgument
9    | _ExtendArgument
10):
11    """Convert an optdict to an Argument class instance."""
12    if "level" in optdict and "hide" not in optdict:
13        warnings.warn(
14            "The 'level' key in optdicts has been deprecated. "
15            "Use 'hide' with a boolean to hide an option from the help message. "
16            f"optdict={optdict}",
17            DeprecationWarning,
18        )
19
20    # Get the long and short flags
21    flags = [f"--{opt}"]
22    if "short" in optdict:
23        flags += [f"-{optdict['short']}"]
24
25    # Get the action type
26    action = optdict.get("action", "store")
27
28    if action == "store_true":
29        return _StoreTrueArgument(
30            flags=flags,
31            action=action,
32            default=optdict.get("default", True),
33            arg_help=optdict.get("help", ""),
34            hide_help=optdict.get("hide", False),
35            section=optdict.get("group", None),
36        )
37    if not isinstance(action, str) and issubclass(action, _CallbackAction):
38        return _CallableArgument(
39            flags=flags,
40            action=action,
41            arg_help=optdict.get("help", ""),
42            kwargs=optdict.get("kwargs", {}),
43            hide_help=optdict.get("hide", False),
44            section=optdict.get("group", None),
45            metavar=optdict.get("metavar", None),
46        )
47    try:
48        default = optdict["default"]
49    except KeyError:
50        warnings.warn(
51            "An option dictionary should have a 'default' key to specify "
52            "the option's default value. This key will be required in pylint "
53            "3.0. It is not required for 'store_true' and callable actions. "
54            f"optdict={optdict}",
55            DeprecationWarning,
56        )
57        default = None
58    if action == "extend":
59        return _ExtendArgument(
60            flags=flags,
61            action=action,
62            default=[] if default is None else default,
63            arg_type=optdict["type"],
64            choices=optdict.get("choices", None),
65            arg_help=optdict.get("help", ""),
66            metavar=optdict.get("metavar", ""),
67            hide_help=optdict.get("hide", False),
68            section=optdict.get("group", None),
69            dest=optdict.get("dest", None),
70        )
71    if "kwargs" in optdict:
72        if "old_names" in optdict["kwargs"]:
73            return _StoreOldNamesArgument(
74                flags=flags,
75                default=default,
76                arg_type=optdict["type"],
77                choices=optdict.get("choices", None),
78                arg_help=optdict.get("help", ""),
79                metavar=optdict.get("metavar", ""),
80                hide_help=optdict.get("hide", False),
81                kwargs=optdict.get("kwargs", {}),
82                section=optdict.get("group", None),
83            )
84        if "new_names" in optdict["kwargs"]:
85            return _StoreNewNamesArgument(
86                flags=flags,
87                default=default,
88                arg_type=optdict["type"],
89                choices=optdict.get("choices", None),
90                arg_help=optdict.get("help", ""),
91                metavar=optdict.get("metavar", ""),
92                hide_help=optdict.get("hide", False),
93                kwargs=optdict.get("kwargs", {}),
94                section=optdict.get("group", None),
95            )
96    if "dest" in optdict:
97        return _StoreOldNamesArgument(
98            flags=flags,
99            default=default,
100            arg_type=optdict["type"],
101            choices=optdict.get("choices", None),
102            arg_help=optdict.get("help", ""),
103            metavar=optdict.get("metavar", ""),
104            hide_help=optdict.get("hide", False),
105            kwargs={"old_names": [optdict["dest"]]},
106            section=optdict.get("group", None),
107        )
108    return _StoreArgument(
109        flags=flags,
110        action=action,
111        default=default,
112        arg_type=optdict["type"],
113        choices=optdict.get("choices", None),
114        arg_help=optdict.get("help", ""),
115        metavar=optdict.get("metavar", ""),
116        hide_help=optdict.get("hide", False),
117        section=optdict.get("group", None),
118    )
            

Path 4: 3626 calls (0.02)

'rcfile' (259) 'output' (259) 'init-hook' (259) 'help-msg' (259) 'list-msgs' (259) 'list-msgs-enabled' (259) 'list-groups' (259) 'list-conf-levels' (2...

dict (3626)

_CallableArgument (3626)

1def _convert_option_to_argument(
2    opt: str, optdict: dict[str, Any]
3) -> (
4    _StoreArgument
5    | _StoreTrueArgument
6    | _CallableArgument
7    | _StoreOldNamesArgument
8    | _StoreNewNamesArgument
9    | _ExtendArgument
10):
11    """Convert an optdict to an Argument class instance."""
12    if "level" in optdict and "hide" not in optdict:
13        warnings.warn(
14            "The 'level' key in optdicts has been deprecated. "
15            "Use 'hide' with a boolean to hide an option from the help message. "
16            f"optdict={optdict}",
17            DeprecationWarning,
18        )
19
20    # Get the long and short flags
21    flags = [f"--{opt}"]
22    if "short" in optdict:
23        flags += [f"-{optdict['short']}"]
24
25    # Get the action type
26    action = optdict.get("action", "store")
27
28    if action == "store_true":
29        return _StoreTrueArgument(
30            flags=flags,
31            action=action,
32            default=optdict.get("default", True),
33            arg_help=optdict.get("help", ""),
34            hide_help=optdict.get("hide", False),
35            section=optdict.get("group", None),
36        )
37    if not isinstance(action, str) and issubclass(action, _CallbackAction):
38        return _CallableArgument(
39            flags=flags,
40            action=action,
41            arg_help=optdict.get("help", ""),
42            kwargs=optdict.get("kwargs", {}),
43            hide_help=optdict.get("hide", False),
44            section=optdict.get("group", None),
45            metavar=optdict.get("metavar", None),
46        )
47    try:
48        default = optdict["default"]
49    except KeyError:
50        warnings.warn(
51            "An option dictionary should have a 'default' key to specify "
52            "the option's default value. This key will be required in pylint "
53            "3.0. It is not required for 'store_true' and callable actions. "
54            f"optdict={optdict}",
55            DeprecationWarning,
56        )
57        default = None
58    if action == "extend":
59        return _ExtendArgument(
60            flags=flags,
61            action=action,
62            default=[] if default is None else default,
63            arg_type=optdict["type"],
64            choices=optdict.get("choices", None),
65            arg_help=optdict.get("help", ""),
66            metavar=optdict.get("metavar", ""),
67            hide_help=optdict.get("hide", False),
68            section=optdict.get("group", None),
69            dest=optdict.get("dest", None),
70        )
71    if "kwargs" in optdict:
72        if "old_names" in optdict["kwargs"]:
73            return _StoreOldNamesArgument(
74                flags=flags,
75                default=default,
76                arg_type=optdict["type"],
77                choices=optdict.get("choices", None),
78                arg_help=optdict.get("help", ""),
79                metavar=optdict.get("metavar", ""),
80                hide_help=optdict.get("hide", False),
81                kwargs=optdict.get("kwargs", {}),
82                section=optdict.get("group", None),
83            )
84        if "new_names" in optdict["kwargs"]:
85            return _StoreNewNamesArgument(
86                flags=flags,
87                default=default,
88                arg_type=optdict["type"],
89                choices=optdict.get("choices", None),
90                arg_help=optdict.get("help", ""),
91                metavar=optdict.get("metavar", ""),
92                hide_help=optdict.get("hide", False),
93                kwargs=optdict.get("kwargs", {}),
94                section=optdict.get("group", None),
95            )
96    if "dest" in optdict:
97        return _StoreOldNamesArgument(
98            flags=flags,
99            default=default,
100            arg_type=optdict["type"],
101            choices=optdict.get("choices", None),
102            arg_help=optdict.get("help", ""),
103            metavar=optdict.get("metavar", ""),
104            hide_help=optdict.get("hide", False),
105            kwargs={"old_names": [optdict["dest"]]},
106            section=optdict.get("group", None),
107        )
108    return _StoreArgument(
109        flags=flags,
110        action=action,
111        default=default,
112        arg_type=optdict["type"],
113        choices=optdict.get("choices", None),
114        arg_help=optdict.get("help", ""),
115        metavar=optdict.get("metavar", ""),
116        hide_help=optdict.get("hide", False),
117        section=optdict.get("group", None),
118    )
            

Path 5: 3015 calls (0.02)

'exit-zero' (1488) 'from-stdin' (1488) 'colorized' (30) 'test-opt' (9)

{'action': 'store_true', 'default': False, 'metavar': '', 'help': 'Always return a 0 (non-error) status code, even if lint errors are found. Thi...

_StoreTrueArgument (3015)

1def _convert_option_to_argument(
2    opt: str, optdict: dict[str, Any]
3) -> (
4    _StoreArgument
5    | _StoreTrueArgument
6    | _CallableArgument
7    | _StoreOldNamesArgument
8    | _StoreNewNamesArgument
9    | _ExtendArgument
10):
11    """Convert an optdict to an Argument class instance."""
12    if "level" in optdict and "hide" not in optdict:
13        warnings.warn(
14            "The 'level' key in optdicts has been deprecated. "
15            "Use 'hide' with a boolean to hide an option from the help message. "
16            f"optdict={optdict}",
17            DeprecationWarning,
18        )
19
20    # Get the long and short flags
21    flags = [f"--{opt}"]
22    if "short" in optdict:
23        flags += [f"-{optdict['short']}"]
24
25    # Get the action type
26    action = optdict.get("action", "store")
27
28    if action == "store_true":
29        return _StoreTrueArgument(
30            flags=flags,
31            action=action,
32            default=optdict.get("default", True),
33            arg_help=optdict.get("help", ""),
34            hide_help=optdict.get("hide", False),
35            section=optdict.get("group", None),
36        )
37    if not isinstance(action, str) and issubclass(action, _CallbackAction):
38        return _CallableArgument(
39            flags=flags,
40            action=action,
41            arg_help=optdict.get("help", ""),
42            kwargs=optdict.get("kwargs", {}),
43            hide_help=optdict.get("hide", False),
44            section=optdict.get("group", None),
45            metavar=optdict.get("metavar", None),
46        )
47    try:
48        default = optdict["default"]
49    except KeyError:
50        warnings.warn(
51            "An option dictionary should have a 'default' key to specify "
52            "the option's default value. This key will be required in pylint "
53            "3.0. It is not required for 'store_true' and callable actions. "
54            f"optdict={optdict}",
55            DeprecationWarning,
56        )
57        default = None
58    if action == "extend":
59        return _ExtendArgument(
60            flags=flags,
61            action=action,
62            default=[] if default is None else default,
63            arg_type=optdict["type"],
64            choices=optdict.get("choices", None),
65            arg_help=optdict.get("help", ""),
66            metavar=optdict.get("metavar", ""),
67            hide_help=optdict.get("hide", False),
68            section=optdict.get("group", None),
69            dest=optdict.get("dest", None),
70        )
71    if "kwargs" in optdict:
72        if "old_names" in optdict["kwargs"]:
73            return _StoreOldNamesArgument(
74                flags=flags,
75                default=default,
76                arg_type=optdict["type"],
77                choices=optdict.get("choices", None),
78                arg_help=optdict.get("help", ""),
79                metavar=optdict.get("metavar", ""),
80                hide_help=optdict.get("hide", False),
81                kwargs=optdict.get("kwargs", {}),
82                section=optdict.get("group", None),
83            )
84        if "new_names" in optdict["kwargs"]:
85            return _StoreNewNamesArgument(
86                flags=flags,
87                default=default,
88                arg_type=optdict["type"],
89                choices=optdict.get("choices", None),
90                arg_help=optdict.get("help", ""),
91                metavar=optdict.get("metavar", ""),
92                hide_help=optdict.get("hide", False),
93                kwargs=optdict.get("kwargs", {}),
94                section=optdict.get("group", None),
95            )
96    if "dest" in optdict:
97        return _StoreOldNamesArgument(
98            flags=flags,
99            default=default,
100            arg_type=optdict["type"],
101            choices=optdict.get("choices", None),
102            arg_help=optdict.get("help", ""),
103            metavar=optdict.get("metavar", ""),
104            hide_help=optdict.get("hide", False),
105            kwargs={"old_names": [optdict["dest"]]},
106            section=optdict.get("group", None),
107        )
108    return _StoreArgument(
109        flags=flags,
110        action=action,
111        default=default,
112        arg_type=optdict["type"],
113        choices=optdict.get("choices", None),
114        arg_help=optdict.get("help", ""),
115        metavar=optdict.get("metavar", ""),
116        hide_help=optdict.get("hide", False),
117        section=optdict.get("group", None),
118    )
            

Path 6: 1548 calls (0.01)

'ignore-patterns' (1488) 'max-color-depth' (30) 'ignore' (30)

dict (1518) {'dest': 'max_color_depth', 'action': 'store', 'default': 2, 'metavar': '', 'type': 'int', 'help': 'Use separate colors up to packa...

_StoreOldNamesArgument (1548)

1def _convert_option_to_argument(
2    opt: str, optdict: dict[str, Any]
3) -> (
4    _StoreArgument
5    | _StoreTrueArgument
6    | _CallableArgument
7    | _StoreOldNamesArgument
8    | _StoreNewNamesArgument
9    | _ExtendArgument
10):
11    """Convert an optdict to an Argument class instance."""
12    if "level" in optdict and "hide" not in optdict:
13        warnings.warn(
14            "The 'level' key in optdicts has been deprecated. "
15            "Use 'hide' with a boolean to hide an option from the help message. "
16            f"optdict={optdict}",
17            DeprecationWarning,
18        )
19
20    # Get the long and short flags
21    flags = [f"--{opt}"]
22    if "short" in optdict:
23        flags += [f"-{optdict['short']}"]
24
25    # Get the action type
26    action = optdict.get("action", "store")
27
28    if action == "store_true":
29        return _StoreTrueArgument(
30            flags=flags,
31            action=action,
32            default=optdict.get("default", True),
33            arg_help=optdict.get("help", ""),
34            hide_help=optdict.get("hide", False),
35            section=optdict.get("group", None),
36        )
37    if not isinstance(action, str) and issubclass(action, _CallbackAction):
38        return _CallableArgument(
39            flags=flags,
40            action=action,
41            arg_help=optdict.get("help", ""),
42            kwargs=optdict.get("kwargs", {}),
43            hide_help=optdict.get("hide", False),
44            section=optdict.get("group", None),
45            metavar=optdict.get("metavar", None),
46        )
47    try:
48        default = optdict["default"]
49    except KeyError:
50        warnings.warn(
51            "An option dictionary should have a 'default' key to specify "
52            "the option's default value. This key will be required in pylint "
53            "3.0. It is not required for 'store_true' and callable actions. "
54            f"optdict={optdict}",
55            DeprecationWarning,
56        )
57        default = None
58    if action == "extend":
59        return _ExtendArgument(
60            flags=flags,
61            action=action,
62            default=[] if default is None else default,
63            arg_type=optdict["type"],
64            choices=optdict.get("choices", None),
65            arg_help=optdict.get("help", ""),
66            metavar=optdict.get("metavar", ""),
67            hide_help=optdict.get("hide", False),
68            section=optdict.get("group", None),
69            dest=optdict.get("dest", None),
70        )
71    if "kwargs" in optdict:
72        if "old_names" in optdict["kwargs"]:
73            return _StoreOldNamesArgument(
74                flags=flags,
75                default=default,
76                arg_type=optdict["type"],
77                choices=optdict.get("choices", None),
78                arg_help=optdict.get("help", ""),
79                metavar=optdict.get("metavar", ""),
80                hide_help=optdict.get("hide", False),
81                kwargs=optdict.get("kwargs", {}),
82                section=optdict.get("group", None),
83            )
84        if "new_names" in optdict["kwargs"]:
85            return _StoreNewNamesArgument(
86                flags=flags,
87                default=default,
88                arg_type=optdict["type"],
89                choices=optdict.get("choices", None),
90                arg_help=optdict.get("help", ""),
91                metavar=optdict.get("metavar", ""),
92                hide_help=optdict.get("hide", False),
93                kwargs=optdict.get("kwargs", {}),
94                section=optdict.get("group", None),
95            )
96    if "dest" in optdict:
97        return _StoreOldNamesArgument(
98            flags=flags,
99            default=default,
100            arg_type=optdict["type"],
101            choices=optdict.get("choices", None),
102            arg_help=optdict.get("help", ""),
103            metavar=optdict.get("metavar", ""),
104            hide_help=optdict.get("hide", False),
105            kwargs={"old_names": [optdict["dest"]]},
106            section=optdict.get("group", None),
107        )
108    return _StoreArgument(
109        flags=flags,
110        action=action,
111        default=default,
112        arg_type=optdict["type"],
113        choices=optdict.get("choices", None),
114        arg_help=optdict.get("help", ""),
115        metavar=optdict.get("metavar", ""),
116        hide_help=optdict.get("hide", False),
117        section=optdict.get("group", None),
118    )
            

Path 7: 1488 calls (0.01)

'ignore' (1488)

dict (1488)

_StoreOldNamesArgument (1488)

1def _convert_option_to_argument(
2    opt: str, optdict: dict[str, Any]
3) -> (
4    _StoreArgument
5    | _StoreTrueArgument
6    | _CallableArgument
7    | _StoreOldNamesArgument
8    | _StoreNewNamesArgument
9    | _ExtendArgument
10):
11    """Convert an optdict to an Argument class instance."""
12    if "level" in optdict and "hide" not in optdict:
13        warnings.warn(
14            "The 'level' key in optdicts has been deprecated. "
15            "Use 'hide' with a boolean to hide an option from the help message. "
16            f"optdict={optdict}",
17            DeprecationWarning,
18        )
19
20    # Get the long and short flags
21    flags = [f"--{opt}"]
22    if "short" in optdict:
23        flags += [f"-{optdict['short']}"]
24
25    # Get the action type
26    action = optdict.get("action", "store")
27
28    if action == "store_true":
29        return _StoreTrueArgument(
30            flags=flags,
31            action=action,
32            default=optdict.get("default", True),
33            arg_help=optdict.get("help", ""),
34            hide_help=optdict.get("hide", False),
35            section=optdict.get("group", None),
36        )
37    if not isinstance(action, str) and issubclass(action, _CallbackAction):
38        return _CallableArgument(
39            flags=flags,
40            action=action,
41            arg_help=optdict.get("help", ""),
42            kwargs=optdict.get("kwargs", {}),
43            hide_help=optdict.get("hide", False),
44            section=optdict.get("group", None),
45            metavar=optdict.get("metavar", None),
46        )
47    try:
48        default = optdict["default"]
49    except KeyError:
50        warnings.warn(
51            "An option dictionary should have a 'default' key to specify "
52            "the option's default value. This key will be required in pylint "
53            "3.0. It is not required for 'store_true' and callable actions. "
54            f"optdict={optdict}",
55            DeprecationWarning,
56        )
57        default = None
58    if action == "extend":
59        return _ExtendArgument(
60            flags=flags,
61            action=action,
62            default=[] if default is None else default,
63            arg_type=optdict["type"],
64            choices=optdict.get("choices", None),
65            arg_help=optdict.get("help", ""),
66            metavar=optdict.get("metavar", ""),
67            hide_help=optdict.get("hide", False),
68            section=optdict.get("group", None),
69            dest=optdict.get("dest", None),
70        )
71    if "kwargs" in optdict:
72        if "old_names" in optdict["kwargs"]:
73            return _StoreOldNamesArgument(
74                flags=flags,
75                default=default,
76                arg_type=optdict["type"],
77                choices=optdict.get("choices", None),
78                arg_help=optdict.get("help", ""),
79                metavar=optdict.get("metavar", ""),
80                hide_help=optdict.get("hide", False),
81                kwargs=optdict.get("kwargs", {}),
82                section=optdict.get("group", None),
83            )
84        if "new_names" in optdict["kwargs"]:
85            return _StoreNewNamesArgument(
86                flags=flags,
87                default=default,
88                arg_type=optdict["type"],
89                choices=optdict.get("choices", None),
90                arg_help=optdict.get("help", ""),
91                metavar=optdict.get("metavar", ""),
92                hide_help=optdict.get("hide", False),
93                kwargs=optdict.get("kwargs", {}),
94                section=optdict.get("group", None),
95            )
96    if "dest" in optdict:
97        return _StoreOldNamesArgument(
98            flags=flags,
99            default=default,
100            arg_type=optdict["type"],
101            choices=optdict.get("choices", None),
102            arg_help=optdict.get("help", ""),
103            metavar=optdict.get("metavar", ""),
104            hide_help=optdict.get("hide", False),
105            kwargs={"old_names": [optdict["dest"]]},
106            section=optdict.get("group", None),
107        )
108    return _StoreArgument(
109        flags=flags,
110        action=action,
111        default=default,
112        arg_type=optdict["type"],
113        choices=optdict.get("choices", None),
114        arg_help=optdict.get("help", ""),
115        metavar=optdict.get("metavar", ""),
116        hide_help=optdict.get("hide", False),
117        section=optdict.get("group", None),
118    )
            

Path 8: 1141 calls (0.01)

'ignore-mixin-members' (1141)

dict (1141)

_StoreNewNamesArgument (1141)

1def _convert_option_to_argument(
2    opt: str, optdict: dict[str, Any]
3) -> (
4    _StoreArgument
5    | _StoreTrueArgument
6    | _CallableArgument
7    | _StoreOldNamesArgument
8    | _StoreNewNamesArgument
9    | _ExtendArgument
10):
11    """Convert an optdict to an Argument class instance."""
12    if "level" in optdict and "hide" not in optdict:
13        warnings.warn(
14            "The 'level' key in optdicts has been deprecated. "
15            "Use 'hide' with a boolean to hide an option from the help message. "
16            f"optdict={optdict}",
17            DeprecationWarning,
18        )
19
20    # Get the long and short flags
21    flags = [f"--{opt}"]
22    if "short" in optdict:
23        flags += [f"-{optdict['short']}"]
24
25    # Get the action type
26    action = optdict.get("action", "store")
27
28    if action == "store_true":
29        return _StoreTrueArgument(
30            flags=flags,
31            action=action,
32            default=optdict.get("default", True),
33            arg_help=optdict.get("help", ""),
34            hide_help=optdict.get("hide", False),
35            section=optdict.get("group", None),
36        )
37    if not isinstance(action, str) and issubclass(action, _CallbackAction):
38        return _CallableArgument(
39            flags=flags,
40            action=action,
41            arg_help=optdict.get("help", ""),
42            kwargs=optdict.get("kwargs", {}),
43            hide_help=optdict.get("hide", False),
44            section=optdict.get("group", None),
45            metavar=optdict.get("metavar", None),
46        )
47    try:
48        default = optdict["default"]
49    except KeyError:
50        warnings.warn(
51            "An option dictionary should have a 'default' key to specify "
52            "the option's default value. This key will be required in pylint "
53            "3.0. It is not required for 'store_true' and callable actions. "
54            f"optdict={optdict}",
55            DeprecationWarning,
56        )
57        default = None
58    if action == "extend":
59        return _ExtendArgument(
60            flags=flags,
61            action=action,
62            default=[] if default is None else default,
63            arg_type=optdict["type"],
64            choices=optdict.get("choices", None),
65            arg_help=optdict.get("help", ""),
66            metavar=optdict.get("metavar", ""),
67            hide_help=optdict.get("hide", False),
68            section=optdict.get("group", None),
69            dest=optdict.get("dest", None),
70        )
71    if "kwargs" in optdict:
72        if "old_names" in optdict["kwargs"]:
73            return _StoreOldNamesArgument(
74                flags=flags,
75                default=default,
76                arg_type=optdict["type"],
77                choices=optdict.get("choices", None),
78                arg_help=optdict.get("help", ""),
79                metavar=optdict.get("metavar", ""),
80                hide_help=optdict.get("hide", False),
81                kwargs=optdict.get("kwargs", {}),
82                section=optdict.get("group", None),
83            )
84        if "new_names" in optdict["kwargs"]:
85            return _StoreNewNamesArgument(
86                flags=flags,
87                default=default,
88                arg_type=optdict["type"],
89                choices=optdict.get("choices", None),
90                arg_help=optdict.get("help", ""),
91                metavar=optdict.get("metavar", ""),
92                hide_help=optdict.get("hide", False),
93                kwargs=optdict.get("kwargs", {}),
94                section=optdict.get("group", None),
95            )
96    if "dest" in optdict:
97        return _StoreOldNamesArgument(
98            flags=flags,
99            default=default,
100            arg_type=optdict["type"],
101            choices=optdict.get("choices", None),
102            arg_help=optdict.get("help", ""),
103            metavar=optdict.get("metavar", ""),
104            hide_help=optdict.get("hide", False),
105            kwargs={"old_names": [optdict["dest"]]},
106            section=optdict.get("group", None),
107        )
108    return _StoreArgument(
109        flags=flags,
110        action=action,
111        default=default,
112        arg_type=optdict["type"],
113        choices=optdict.get("choices", None),
114        arg_help=optdict.get("help", ""),
115        metavar=optdict.get("metavar", ""),
116        hide_help=optdict.get("hide", False),
117        section=optdict.get("group", None),
118    )
            

Path 9: 120 calls (0.0)

'all-ancestors' (30) 'all-associated' (30) 'show-builtin' (30) 'only-classnames' (30)

{'short': 'A', 'default': None, 'action': 'store_true', 'help': 'show all ancestors off all classes in '} (30) {'short': 'S', 'default': Non...

_StoreTrueArgument (120)

1def _convert_option_to_argument(
2    opt: str, optdict: dict[str, Any]
3) -> (
4    _StoreArgument
5    | _StoreTrueArgument
6    | _CallableArgument
7    | _StoreOldNamesArgument
8    | _StoreNewNamesArgument
9    | _ExtendArgument
10):
11    """Convert an optdict to an Argument class instance."""
12    if "level" in optdict and "hide" not in optdict:
13        warnings.warn(
14            "The 'level' key in optdicts has been deprecated. "
15            "Use 'hide' with a boolean to hide an option from the help message. "
16            f"optdict={optdict}",
17            DeprecationWarning,
18        )
19
20    # Get the long and short flags
21    flags = [f"--{opt}"]
22    if "short" in optdict:
23        flags += [f"-{optdict['short']}"]
24
25    # Get the action type
26    action = optdict.get("action", "store")
27
28    if action == "store_true":
29        return _StoreTrueArgument(
30            flags=flags,
31            action=action,
32            default=optdict.get("default", True),
33            arg_help=optdict.get("help", ""),
34            hide_help=optdict.get("hide", False),
35            section=optdict.get("group", None),
36        )
37    if not isinstance(action, str) and issubclass(action, _CallbackAction):
38        return _CallableArgument(
39            flags=flags,
40            action=action,
41            arg_help=optdict.get("help", ""),
42            kwargs=optdict.get("kwargs", {}),
43            hide_help=optdict.get("hide", False),
44            section=optdict.get("group", None),
45            metavar=optdict.get("metavar", None),
46        )
47    try:
48        default = optdict["default"]
49    except KeyError:
50        warnings.warn(
51            "An option dictionary should have a 'default' key to specify "
52            "the option's default value. This key will be required in pylint "
53            "3.0. It is not required for 'store_true' and callable actions. "
54            f"optdict={optdict}",
55            DeprecationWarning,
56        )
57        default = None
58    if action == "extend":
59        return _ExtendArgument(
60            flags=flags,
61            action=action,
62            default=[] if default is None else default,
63            arg_type=optdict["type"],
64            choices=optdict.get("choices", None),
65            arg_help=optdict.get("help", ""),
66            metavar=optdict.get("metavar", ""),
67            hide_help=optdict.get("hide", False),
68            section=optdict.get("group", None),
69            dest=optdict.get("dest", None),
70        )
71    if "kwargs" in optdict:
72        if "old_names" in optdict["kwargs"]:
73            return _StoreOldNamesArgument(
74                flags=flags,
75                default=default,
76                arg_type=optdict["type"],
77                choices=optdict.get("choices", None),
78                arg_help=optdict.get("help", ""),
79                metavar=optdict.get("metavar", ""),
80                hide_help=optdict.get("hide", False),
81                kwargs=optdict.get("kwargs", {}),
82                section=optdict.get("group", None),
83            )
84        if "new_names" in optdict["kwargs"]:
85            return _StoreNewNamesArgument(
86                flags=flags,
87                default=default,
88                arg_type=optdict["type"],
89                choices=optdict.get("choices", None),
90                arg_help=optdict.get("help", ""),
91                metavar=optdict.get("metavar", ""),
92                hide_help=optdict.get("hide", False),
93                kwargs=optdict.get("kwargs", {}),
94                section=optdict.get("group", None),
95            )
96    if "dest" in optdict:
97        return _StoreOldNamesArgument(
98            flags=flags,
99            default=default,
100            arg_type=optdict["type"],
101            choices=optdict.get("choices", None),
102            arg_help=optdict.get("help", ""),
103            metavar=optdict.get("metavar", ""),
104            hide_help=optdict.get("hide", False),
105            kwargs={"old_names": [optdict["dest"]]},
106            section=optdict.get("group", None),
107        )
108    return _StoreArgument(
109        flags=flags,
110        action=action,
111        default=default,
112        arg_type=optdict["type"],
113        choices=optdict.get("choices", None),
114        arg_help=optdict.get("help", ""),
115        metavar=optdict.get("metavar", ""),
116        hide_help=optdict.get("hide", False),
117        section=optdict.get("group", None),
118    )
            

Path 10: 60 calls (0.0)

'filter-mode' (30) 'output' (30)

{'short': 'f', 'default': 'PUB_ONLY', 'dest': 'mode', 'type': 'string', 'action': 'store', 'metavar': '', 'help': "filter attributes and functio...

_StoreOldNamesArgument (60)

1def _convert_option_to_argument(
2    opt: str, optdict: dict[str, Any]
3) -> (
4    _StoreArgument
5    | _StoreTrueArgument
6    | _CallableArgument
7    | _StoreOldNamesArgument
8    | _StoreNewNamesArgument
9    | _ExtendArgument
10):
11    """Convert an optdict to an Argument class instance."""
12    if "level" in optdict and "hide" not in optdict:
13        warnings.warn(
14            "The 'level' key in optdicts has been deprecated. "
15            "Use 'hide' with a boolean to hide an option from the help message. "
16            f"optdict={optdict}",
17            DeprecationWarning,
18        )
19
20    # Get the long and short flags
21    flags = [f"--{opt}"]
22    if "short" in optdict:
23        flags += [f"-{optdict['short']}"]
24
25    # Get the action type
26    action = optdict.get("action", "store")
27
28    if action == "store_true":
29        return _StoreTrueArgument(
30            flags=flags,
31            action=action,
32            default=optdict.get("default", True),
33            arg_help=optdict.get("help", ""),
34            hide_help=optdict.get("hide", False),
35            section=optdict.get("group", None),
36        )
37    if not isinstance(action, str) and issubclass(action, _CallbackAction):
38        return _CallableArgument(
39            flags=flags,
40            action=action,
41            arg_help=optdict.get("help", ""),
42            kwargs=optdict.get("kwargs", {}),
43            hide_help=optdict.get("hide", False),
44            section=optdict.get("group", None),
45            metavar=optdict.get("metavar", None),
46        )
47    try:
48        default = optdict["default"]
49    except KeyError:
50        warnings.warn(
51            "An option dictionary should have a 'default' key to specify "
52            "the option's default value. This key will be required in pylint "
53            "3.0. It is not required for 'store_true' and callable actions. "
54            f"optdict={optdict}",
55            DeprecationWarning,
56        )
57        default = None
58    if action == "extend":
59        return _ExtendArgument(
60            flags=flags,
61            action=action,
62            default=[] if default is None else default,
63            arg_type=optdict["type"],
64            choices=optdict.get("choices", None),
65            arg_help=optdict.get("help", ""),
66            metavar=optdict.get("metavar", ""),
67            hide_help=optdict.get("hide", False),
68            section=optdict.get("group", None),
69            dest=optdict.get("dest", None),
70        )
71    if "kwargs" in optdict:
72        if "old_names" in optdict["kwargs"]:
73            return _StoreOldNamesArgument(
74                flags=flags,
75                default=default,
76                arg_type=optdict["type"],
77                choices=optdict.get("choices", None),
78                arg_help=optdict.get("help", ""),
79                metavar=optdict.get("metavar", ""),
80                hide_help=optdict.get("hide", False),
81                kwargs=optdict.get("kwargs", {}),
82                section=optdict.get("group", None),
83            )
84        if "new_names" in optdict["kwargs"]:
85            return _StoreNewNamesArgument(
86                flags=flags,
87                default=default,
88                arg_type=optdict["type"],
89                choices=optdict.get("choices", None),
90                arg_help=optdict.get("help", ""),
91                metavar=optdict.get("metavar", ""),
92                hide_help=optdict.get("hide", False),
93                kwargs=optdict.get("kwargs", {}),
94                section=optdict.get("group", None),
95            )
96    if "dest" in optdict:
97        return _StoreOldNamesArgument(
98            flags=flags,
99            default=default,
100            arg_type=optdict["type"],
101            choices=optdict.get("choices", None),
102            arg_help=optdict.get("help", ""),
103            metavar=optdict.get("metavar", ""),
104            hide_help=optdict.get("hide", False),
105            kwargs={"old_names": [optdict["dest"]]},
106            section=optdict.get("group", None),
107        )
108    return _StoreArgument(
109        flags=flags,
110        action=action,
111        default=default,
112        arg_type=optdict["type"],
113        choices=optdict.get("choices", None),
114        arg_help=optdict.get("help", ""),
115        metavar=optdict.get("metavar", ""),
116        hide_help=optdict.get("hide", False),
117        section=optdict.get("group", None),
118    )
            

Path 11: 30 calls (0.0)

'class' (30)

{'short': 'c', 'action': 'extend', 'metavar': '', 'type': 'csv', 'dest': 'classes', 'default': None, 'help': 'create a class diagram with all c...

_ExtendArgument (30)

1def _convert_option_to_argument(
2    opt: str, optdict: dict[str, Any]
3) -> (
4    _StoreArgument
5    | _StoreTrueArgument
6    | _CallableArgument
7    | _StoreOldNamesArgument
8    | _StoreNewNamesArgument
9    | _ExtendArgument
10):
11    """Convert an optdict to an Argument class instance."""
12    if "level" in optdict and "hide" not in optdict:
13        warnings.warn(
14            "The 'level' key in optdicts has been deprecated. "
15            "Use 'hide' with a boolean to hide an option from the help message. "
16            f"optdict={optdict}",
17            DeprecationWarning,
18        )
19
20    # Get the long and short flags
21    flags = [f"--{opt}"]
22    if "short" in optdict:
23        flags += [f"-{optdict['short']}"]
24
25    # Get the action type
26    action = optdict.get("action", "store")
27
28    if action == "store_true":
29        return _StoreTrueArgument(
30            flags=flags,
31            action=action,
32            default=optdict.get("default", True),
33            arg_help=optdict.get("help", ""),
34            hide_help=optdict.get("hide", False),
35            section=optdict.get("group", None),
36        )
37    if not isinstance(action, str) and issubclass(action, _CallbackAction):
38        return _CallableArgument(
39            flags=flags,
40            action=action,
41            arg_help=optdict.get("help", ""),
42            kwargs=optdict.get("kwargs", {}),
43            hide_help=optdict.get("hide", False),
44            section=optdict.get("group", None),
45            metavar=optdict.get("metavar", None),
46        )
47    try:
48        default = optdict["default"]
49    except KeyError:
50        warnings.warn(
51            "An option dictionary should have a 'default' key to specify "
52            "the option's default value. This key will be required in pylint "
53            "3.0. It is not required for 'store_true' and callable actions. "
54            f"optdict={optdict}",
55            DeprecationWarning,
56        )
57        default = None
58    if action == "extend":
59        return _ExtendArgument(
60            flags=flags,
61            action=action,
62            default=[] if default is None else default,
63            arg_type=optdict["type"],
64            choices=optdict.get("choices", None),
65            arg_help=optdict.get("help", ""),
66            metavar=optdict.get("metavar", ""),
67            hide_help=optdict.get("hide", False),
68            section=optdict.get("group", None),
69            dest=optdict.get("dest", None),
70        )
71    if "kwargs" in optdict:
72        if "old_names" in optdict["kwargs"]:
73            return _StoreOldNamesArgument(
74                flags=flags,
75                default=default,
76                arg_type=optdict["type"],
77                choices=optdict.get("choices", None),
78                arg_help=optdict.get("help", ""),
79                metavar=optdict.get("metavar", ""),
80                hide_help=optdict.get("hide", False),
81                kwargs=optdict.get("kwargs", {}),
82                section=optdict.get("group", None),
83            )
84        if "new_names" in optdict["kwargs"]:
85            return _StoreNewNamesArgument(
86                flags=flags,
87                default=default,
88                arg_type=optdict["type"],
89                choices=optdict.get("choices", None),
90                arg_help=optdict.get("help", ""),
91                metavar=optdict.get("metavar", ""),
92                hide_help=optdict.get("hide", False),
93                kwargs=optdict.get("kwargs", {}),
94                section=optdict.get("group", None),
95            )
96    if "dest" in optdict:
97        return _StoreOldNamesArgument(
98            flags=flags,
99            default=default,
100            arg_type=optdict["type"],
101            choices=optdict.get("choices", None),
102            arg_help=optdict.get("help", ""),
103            metavar=optdict.get("metavar", ""),
104            hide_help=optdict.get("hide", False),
105            kwargs={"old_names": [optdict["dest"]]},
106            section=optdict.get("group", None),
107        )
108    return _StoreArgument(
109        flags=flags,
110        action=action,
111        default=default,
112        arg_type=optdict["type"],
113        choices=optdict.get("choices", None),
114        arg_help=optdict.get("help", ""),
115        metavar=optdict.get("metavar", ""),
116        hide_help=optdict.get("hide", False),
117        section=optdict.get("group", None),
118    )
            

Path 12: 1 calls (0.0)

'test-opt-two' (1)

{'action': 'store', 'type': 'string', 'help': 'help message'} (1)

_StoreArgument (1)

KeyError (1)

1def _convert_option_to_argument(
2    opt: str, optdict: dict[str, Any]
3) -> (
4    _StoreArgument
5    | _StoreTrueArgument
6    | _CallableArgument
7    | _StoreOldNamesArgument
8    | _StoreNewNamesArgument
9    | _ExtendArgument
10):
11    """Convert an optdict to an Argument class instance."""
12    if "level" in optdict and "hide" not in optdict:
13        warnings.warn(
14            "The 'level' key in optdicts has been deprecated. "
15            "Use 'hide' with a boolean to hide an option from the help message. "
16            f"optdict={optdict}",
17            DeprecationWarning,
18        )
19
20    # Get the long and short flags
21    flags = [f"--{opt}"]
22    if "short" in optdict:
23        flags += [f"-{optdict['short']}"]
24
25    # Get the action type
26    action = optdict.get("action", "store")
27
28    if action == "store_true":
29        return _StoreTrueArgument(
30            flags=flags,
31            action=action,
32            default=optdict.get("default", True),
33            arg_help=optdict.get("help", ""),
34            hide_help=optdict.get("hide", False),
35            section=optdict.get("group", None),
36        )
37    if not isinstance(action, str) and issubclass(action, _CallbackAction):
38        return _CallableArgument(
39            flags=flags,
40            action=action,
41            arg_help=optdict.get("help", ""),
42            kwargs=optdict.get("kwargs", {}),
43            hide_help=optdict.get("hide", False),
44            section=optdict.get("group", None),
45            metavar=optdict.get("metavar", None),
46        )
47    try:
48        default = optdict["default"]
49    except KeyError:
50        warnings.warn(
51            "An option dictionary should have a 'default' key to specify "
52            "the option's default value. This key will be required in pylint "
53            "3.0. It is not required for 'store_true' and callable actions. "
54            f"optdict={optdict}",
55            DeprecationWarning,
56        )
57        default = None
58    if action == "extend":
59        return _ExtendArgument(
60            flags=flags,
61            action=action,
62            default=[] if default is None else default,
63            arg_type=optdict["type"],
64            choices=optdict.get("choices", None),
65            arg_help=optdict.get("help", ""),
66            metavar=optdict.get("metavar", ""),
67            hide_help=optdict.get("hide", False),
68            section=optdict.get("group", None),
69            dest=optdict.get("dest", None),
70        )
71    if "kwargs" in optdict:
72        if "old_names" in optdict["kwargs"]:
73            return _StoreOldNamesArgument(
74                flags=flags,
75                default=default,
76                arg_type=optdict["type"],
77                choices=optdict.get("choices", None),
78                arg_help=optdict.get("help", ""),
79                metavar=optdict.get("metavar", ""),
80                hide_help=optdict.get("hide", False),
81                kwargs=optdict.get("kwargs", {}),
82                section=optdict.get("group", None),
83            )
84        if "new_names" in optdict["kwargs"]:
85            return _StoreNewNamesArgument(
86                flags=flags,
87                default=default,
88                arg_type=optdict["type"],
89                choices=optdict.get("choices", None),
90                arg_help=optdict.get("help", ""),
91                metavar=optdict.get("metavar", ""),
92                hide_help=optdict.get("hide", False),
93                kwargs=optdict.get("kwargs", {}),
94                section=optdict.get("group", None),
95            )
96    if "dest" in optdict:
97        return _StoreOldNamesArgument(
98            flags=flags,
99            default=default,
100            arg_type=optdict["type"],
101            choices=optdict.get("choices", None),
102            arg_help=optdict.get("help", ""),
103            metavar=optdict.get("metavar", ""),
104            hide_help=optdict.get("hide", False),
105            kwargs={"old_names": [optdict["dest"]]},
106            section=optdict.get("group", None),
107        )
108    return _StoreArgument(
109        flags=flags,
110        action=action,
111        default=default,
112        arg_type=optdict["type"],
113        choices=optdict.get("choices", None),
114        arg_help=optdict.get("help", ""),
115        metavar=optdict.get("metavar", ""),
116        hide_help=optdict.get("hide", False),
117        section=optdict.get("group", None),
118    )
            

Path 13: 1 calls (0.0)

'test-opt-three' (1)

{'action': 'store_true', 'level': 1, 'help': 'help message'} (1)

_StoreTrueArgument (1)

1def _convert_option_to_argument(
2    opt: str, optdict: dict[str, Any]
3) -> (
4    _StoreArgument
5    | _StoreTrueArgument
6    | _CallableArgument
7    | _StoreOldNamesArgument
8    | _StoreNewNamesArgument
9    | _ExtendArgument
10):
11    """Convert an optdict to an Argument class instance."""
12    if "level" in optdict and "hide" not in optdict:
13        warnings.warn(
14            "The 'level' key in optdicts has been deprecated. "
15            "Use 'hide' with a boolean to hide an option from the help message. "
16            f"optdict={optdict}",
17            DeprecationWarning,
18        )
19
20    # Get the long and short flags
21    flags = [f"--{opt}"]
22    if "short" in optdict:
23        flags += [f"-{optdict['short']}"]
24
25    # Get the action type
26    action = optdict.get("action", "store")
27
28    if action == "store_true":
29        return _StoreTrueArgument(
30            flags=flags,
31            action=action,
32            default=optdict.get("default", True),
33            arg_help=optdict.get("help", ""),
34            hide_help=optdict.get("hide", False),
35            section=optdict.get("group", None),
36        )
37    if not isinstance(action, str) and issubclass(action, _CallbackAction):
38        return _CallableArgument(
39            flags=flags,
40            action=action,
41            arg_help=optdict.get("help", ""),
42            kwargs=optdict.get("kwargs", {}),
43            hide_help=optdict.get("hide", False),
44            section=optdict.get("group", None),
45            metavar=optdict.get("metavar", None),
46        )
47    try:
48        default = optdict["default"]
49    except KeyError:
50        warnings.warn(
51            "An option dictionary should have a 'default' key to specify "
52            "the option's default value. This key will be required in pylint "
53            "3.0. It is not required for 'store_true' and callable actions. "
54            f"optdict={optdict}",
55            DeprecationWarning,
56        )
57        default = None
58    if action == "extend":
59        return _ExtendArgument(
60            flags=flags,
61            action=action,
62            default=[] if default is None else default,
63            arg_type=optdict["type"],
64            choices=optdict.get("choices", None),
65            arg_help=optdict.get("help", ""),
66            metavar=optdict.get("metavar", ""),
67            hide_help=optdict.get("hide", False),
68            section=optdict.get("group", None),
69            dest=optdict.get("dest", None),
70        )
71    if "kwargs" in optdict:
72        if "old_names" in optdict["kwargs"]:
73            return _StoreOldNamesArgument(
74                flags=flags,
75                default=default,
76                arg_type=optdict["type"],
77                choices=optdict.get("choices", None),
78                arg_help=optdict.get("help", ""),
79                metavar=optdict.get("metavar", ""),
80                hide_help=optdict.get("hide", False),
81                kwargs=optdict.get("kwargs", {}),
82                section=optdict.get("group", None),
83            )
84        if "new_names" in optdict["kwargs"]:
85            return _StoreNewNamesArgument(
86                flags=flags,
87                default=default,
88                arg_type=optdict["type"],
89                choices=optdict.get("choices", None),
90                arg_help=optdict.get("help", ""),
91                metavar=optdict.get("metavar", ""),
92                hide_help=optdict.get("hide", False),
93                kwargs=optdict.get("kwargs", {}),
94                section=optdict.get("group", None),
95            )
96    if "dest" in optdict:
97        return _StoreOldNamesArgument(
98            flags=flags,
99            default=default,
100            arg_type=optdict["type"],
101            choices=optdict.get("choices", None),
102            arg_help=optdict.get("help", ""),
103            metavar=optdict.get("metavar", ""),
104            hide_help=optdict.get("hide", False),
105            kwargs={"old_names": [optdict["dest"]]},
106            section=optdict.get("group", None),
107        )
108    return _StoreArgument(
109        flags=flags,
110        action=action,
111        default=default,
112        arg_type=optdict["type"],
113        choices=optdict.get("choices", None),
114        arg_help=optdict.get("help", ""),
115        metavar=optdict.get("metavar", ""),
116        hide_help=optdict.get("hide", False),
117        section=optdict.get("group", None),
118    )