summaryrefslogtreecommitdiff
path: root/pylint/utils/utils.py
diff options
context:
space:
mode:
authorDaniƫl van Noord <13665637+DanielNoord@users.noreply.github.com>2022-04-07 16:14:11 +0200
committerGitHub <noreply@github.com>2022-04-07 16:14:11 +0200
commit3690134ea670b12fa6d729c1ad06d87dba9567ed (patch)
treebadcb093019ada2f28b4d55298e1f36215e2c74d /pylint/utils/utils.py
parentb8d369b91b49020ae6febc3c7ccc6280c625458c (diff)
downloadpylint-git-3690134ea670b12fa6d729c1ad06d87dba9567ed.tar.gz
Deprecate ``generate_config`` (#6222)
Diffstat (limited to 'pylint/utils/utils.py')
-rw-r--r--pylint/utils/utils.py18
1 files changed, 16 insertions, 2 deletions
diff --git a/pylint/utils/utils.py b/pylint/utils/utils.py
index d7222b42f..b1ec3cf3d 100644
--- a/pylint/utils/utils.py
+++ b/pylint/utils/utils.py
@@ -18,6 +18,7 @@ import re
import sys
import textwrap
import tokenize
+import warnings
from io import BufferedReader, BytesIO
from typing import (
TYPE_CHECKING,
@@ -329,7 +330,10 @@ def _comment(string: str) -> str:
def _format_option_value(optdict, value):
- """Return the user input's value from a 'compiled' value."""
+ """Return the user input's value from a 'compiled' value.
+
+ TODO: Remove in pylint 3.0.
+ """
if optdict.get("type", None) == "py_version":
value = ".".join(str(item) for item in value)
elif isinstance(value, (list, tuple)):
@@ -350,14 +354,24 @@ def format_section(
stream: TextIO, section: str, options: List[Tuple], doc: Optional[str] = None
) -> None:
"""Format an option's section using the INI format."""
+ warnings.warn(
+ "format_section has been deprecated. It will be removed in pylint 3.0.",
+ DeprecationWarning,
+ )
if doc:
print(_comment(doc), file=stream)
print(f"[{section}]", file=stream)
- _ini_format(stream, options)
+ with warnings.catch_warnings():
+ warnings.filterwarnings("ignore", category=DeprecationWarning)
+ _ini_format(stream, options)
def _ini_format(stream: TextIO, options: List[Tuple]) -> None:
"""Format options using the INI format."""
+ warnings.warn(
+ "_ini_format has been deprecated. It will be removed in pylint 3.0.",
+ DeprecationWarning,
+ )
for optname, optdict, value in options:
value = _format_option_value(optdict, value)
help_opt = optdict.get("help")