diff options
Diffstat (limited to 'pylint/utils/docs.py')
-rw-r--r-- | pylint/utils/docs.py | 41 |
1 files changed, 17 insertions, 24 deletions
diff --git a/pylint/utils/docs.py b/pylint/utils/docs.py index ebd7cc8c3..ba592c4a4 100644 --- a/pylint/utils/docs.py +++ b/pylint/utils/docs.py @@ -1,13 +1,12 @@ # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html -# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE -# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt +# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE +# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt """Various helper functions to create the docs of a linter object.""" from __future__ import annotations import sys -import warnings from typing import TYPE_CHECKING, Any, TextIO from pylint.constants import MAIN_CHECKER_NAME @@ -25,20 +24,16 @@ def _get_checkers_infos(linter: PyLinter) -> dict[str, dict[str, Any]]: if name != MAIN_CHECKER_NAME: try: by_checker[name]["checker"] = checker - with warnings.catch_warnings(): - warnings.filterwarnings("ignore", category=DeprecationWarning) - by_checker[name]["options"] += checker.options_and_values() + by_checker[name]["options"] += checker._options_and_values() by_checker[name]["msgs"].update(checker.msgs) by_checker[name]["reports"] += checker.reports except KeyError: - with warnings.catch_warnings(): - warnings.filterwarnings("ignore", category=DeprecationWarning) - by_checker[name] = { - "checker": checker, - "options": list(checker.options_and_values()), - "msgs": dict(checker.msgs), - "reports": list(checker.reports), - } + by_checker[name] = { + "checker": checker, + "options": list(checker._options_and_values()), + "msgs": dict(checker.msgs), + "reports": list(checker.reports), + } return by_checker @@ -51,16 +46,14 @@ Pylint provides global options and switches. """ for checker in linter.get_checkers(): if checker.name == MAIN_CHECKER_NAME and checker.options: - with warnings.catch_warnings(): - warnings.filterwarnings("ignore", category=DeprecationWarning) - for section, options in checker.options_by_section(): - if section is None: - title = "General options" - else: - title = f"{section.capitalize()} options" - result += get_rst_title(title, "~") - assert isinstance(options, list) - result += f"{get_rst_section(None, options)}\n" + for section, options in checker._options_by_section(): + if section is None: + title = "General options" + else: + title = f"{section.capitalize()} options" + result += get_rst_title(title, "~") + assert isinstance(options, list) + result += f"{get_rst_section(None, options)}\n" return result |