Coverage for C:\Repos\ekr-pylint\pylint\config\__init__.py: 71%
21 statements
« prev ^ index » next coverage.py v6.4, created at 2022-05-24 10:21 -0500
« prev ^ index » next coverage.py v6.4, created at 2022-05-24 10:21 -0500
1# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
2# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
3# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
5from __future__ import annotations
7__all__ = [
8 "ConfigurationMixIn", # Deprecated
9 "find_default_config_files",
10 "find_pylintrc", # Deprecated
11 "Option", # Deprecated
12 "OptionsManagerMixIn", # Deprecated
13 "OptionParser", # Deprecated
14 "OptionsProviderMixIn", # Deprecated
15 "UnsupportedAction", # Deprecated
16 "PYLINTRC",
17 "USER_HOME", # Compatibility with the old API
18 "PYLINT_HOME", # Compatibility with the old API
19 "save_results", # Compatibility with the old API # Deprecated
20 "load_results", # Compatibility with the old API # Deprecated
21]
23import warnings
25from pylint.config.arguments_provider import UnsupportedAction
26from pylint.config.configuration_mixin import ConfigurationMixIn
27from pylint.config.environment_variable import PYLINTRC
28from pylint.config.find_default_config_files import (
29 find_default_config_files,
30 find_pylintrc,
31)
32from pylint.config.option import Option
33from pylint.config.option_manager_mixin import OptionsManagerMixIn
34from pylint.config.option_parser import OptionParser
35from pylint.config.options_provider_mixin import OptionsProviderMixIn
36from pylint.constants import PYLINT_HOME, USER_HOME
37from pylint.utils import LinterStats
40def load_results(base: str) -> LinterStats | None:
41 # TODO: 3.0: Remove deprecated function
42 # pylint: disable=import-outside-toplevel
43 from pylint.lint.caching import load_results as _real_load_results
45 warnings.warn(
46 "'pylint.config.load_results' is deprecated, please use "
47 "'pylint.lint.load_results' instead. This will be removed in 3.0.",
48 DeprecationWarning,
49 )
50 return _real_load_results(base, PYLINT_HOME)
53def save_results(results: LinterStats, base: str) -> None:
54 # TODO: 3.0: Remove deprecated function
55 # pylint: disable=import-outside-toplevel
56 from pylint.lint.caching import save_results as _real_save_results
58 warnings.warn(
59 "'pylint.config.save_results' is deprecated, please use "
60 "'pylint.lint.save_results' instead. This will be removed in 3.0.",
61 DeprecationWarning,
62 )
63 return _real_save_results(results, base, PYLINT_HOME)