Method: pylint.lint.pylinter.PyLinter.load_plugin_configuration
Calls: 1062, Exceptions: 0, Paths: 4Back
Path 1: 939 calls (0.88)
1def load_plugin_configuration(self) -> None:
2 """Call the configuration hook for plugins.
3
4 This walks through the list of plugins, grabs the "load_configuration"
5 hook, if exposed, and calls it to allow plugins to configure specific
6 settings.
7
8 The result of attempting to load the plugin of the given name
9 is stored in the dynamic plugins dictionary in ``load_plugin_modules`` above.
10
11 ..note::
12 This function previously always tried to load modules again, which
13 led to some confusion and silent failure conditions as described
14 in GitHub issue #7264. Making it use the stored result is more efficient, and
15 means that we avoid the ``init-hook`` problems from before.
16 """
17 for modname, module_or_error in self._dynamic_plugins.items():
18 if isinstance(module_or_error, ModuleNotFoundError):
19 self.add_message(
20 "bad-plugin-value", args=(modname, module_or_error), line=0
21 )
22 elif hasattr(module_or_error, "load_configuration"):
23 module_or_error.load_configuration(self)
24
25 # We re-set all the dictionary values to True here to make sure the dict
26 # is pickle-able. This is only a problem in multiprocessing/parallel mode.
27 # (e.g. invoking pylint -j 2)
28 self._dynamic_plugins = {
29 modname: not isinstance(val, ModuleNotFoundError)
30 for modname, val in self._dynamic_plugins.items()
31 }
Path 2: 116 calls (0.11)
1def load_plugin_configuration(self) -> None:
2 """Call the configuration hook for plugins.
3
4 This walks through the list of plugins, grabs the "load_configuration"
5 hook, if exposed, and calls it to allow plugins to configure specific
6 settings.
7
8 The result of attempting to load the plugin of the given name
9 is stored in the dynamic plugins dictionary in ``load_plugin_modules`` above.
10
11 ..note::
12 This function previously always tried to load modules again, which
13 led to some confusion and silent failure conditions as described
14 in GitHub issue #7264. Making it use the stored result is more efficient, and
15 means that we avoid the ``init-hook`` problems from before.
16 """
17 for modname, module_or_error in self._dynamic_plugins.items():
18 if isinstance(module_or_error, ModuleNotFoundError):
19 self.add_message(
20 "bad-plugin-value", args=(modname, module_or_error), line=0
21 )
22 elif hasattr(module_or_error, "load_configuration"):
23 module_or_error.load_configuration(self)
24
25 # We re-set all the dictionary values to True here to make sure the dict
26 # is pickle-able. This is only a problem in multiprocessing/parallel mode.
27 # (e.g. invoking pylint -j 2)
28 self._dynamic_plugins = {
29 modname: not isinstance(val, ModuleNotFoundError)
30 for modname, val in self._dynamic_plugins.items()
31 }
Path 3: 6 calls (0.01)
1def load_plugin_configuration(self) -> None:
2 """Call the configuration hook for plugins.
3
4 This walks through the list of plugins, grabs the "load_configuration"
5 hook, if exposed, and calls it to allow plugins to configure specific
6 settings.
7
8 The result of attempting to load the plugin of the given name
9 is stored in the dynamic plugins dictionary in ``load_plugin_modules`` above.
10
11 ..note::
12 This function previously always tried to load modules again, which
13 led to some confusion and silent failure conditions as described
14 in GitHub issue #7264. Making it use the stored result is more efficient, and
15 means that we avoid the ``init-hook`` problems from before.
16 """
17 for modname, module_or_error in self._dynamic_plugins.items():
18 if isinstance(module_or_error, ModuleNotFoundError):
19 self.add_message(
20 "bad-plugin-value", args=(modname, module_or_error), line=0
21 )
22 elif hasattr(module_or_error, "load_configuration"):
23 module_or_error.load_configuration(self)
24
25 # We re-set all the dictionary values to True here to make sure the dict
26 # is pickle-able. This is only a problem in multiprocessing/parallel mode.
27 # (e.g. invoking pylint -j 2)
28 self._dynamic_plugins = {
29 modname: not isinstance(val, ModuleNotFoundError)
30 for modname, val in self._dynamic_plugins.items()
31 }
Path 4: 1 calls (0.0)
1def load_plugin_configuration(self) -> None:
2 """Call the configuration hook for plugins.
3
4 This walks through the list of plugins, grabs the "load_configuration"
5 hook, if exposed, and calls it to allow plugins to configure specific
6 settings.
7
8 The result of attempting to load the plugin of the given name
9 is stored in the dynamic plugins dictionary in ``load_plugin_modules`` above.
10
11 ..note::
12 This function previously always tried to load modules again, which
13 led to some confusion and silent failure conditions as described
14 in GitHub issue #7264. Making it use the stored result is more efficient, and
15 means that we avoid the ``init-hook`` problems from before.
16 """
17 for modname, module_or_error in self._dynamic_plugins.items():
18 if isinstance(module_or_error, ModuleNotFoundError):
19 self.add_message(
20 "bad-plugin-value", args=(modname, module_or_error), line=0
21 )
22 elif hasattr(module_or_error, "load_configuration"):
23 module_or_error.load_configuration(self)
24
25 # We re-set all the dictionary values to True here to make sure the dict
26 # is pickle-able. This is only a problem in multiprocessing/parallel mode.
27 # (e.g. invoking pylint -j 2)
28 self._dynamic_plugins = {
29 modname: not isinstance(val, ModuleNotFoundError)
30 for modname, val in self._dynamic_plugins.items()
31 }