"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "pylint/utils/utils.py" between
pylint-2.17.5.tar.gz and pylint-2.17.6.tar.gz

About: pylint analyzes Python source code looking for bugs and signs of poor quality.

utils.py  (pylint-2.17.5):utils.py  (pylint-2.17.6)
skipping to change at line 25 skipping to change at line 25
HAS_ISORT_5 = False HAS_ISORT_5 = False
import argparse import argparse
import codecs import codecs
import os import os
import re import re
import sys import sys
import textwrap import textwrap
import tokenize import tokenize
import warnings import warnings
from collections.abc import Sequence from collections import deque
from collections.abc import Iterable, Sequence
from io import BufferedReader, BytesIO from io import BufferedReader, BytesIO
from typing import ( from typing import (
TYPE_CHECKING, TYPE_CHECKING,
Any, Any,
List, List,
Pattern, Pattern,
TextIO, TextIO,
Tuple, Tuple,
TypeVar, TypeVar,
Union, Union,
skipping to change at line 312 skipping to change at line 313
string = string[1:] string = string[1:]
if string[-1] in "\"'": if string[-1] in "\"'":
string = string[:-1] string = string[:-1]
return string return string
def _check_csv(value: list[str] | tuple[str] | str) -> Sequence[str]: def _check_csv(value: list[str] | tuple[str] | str) -> Sequence[str]:
if isinstance(value, (list, tuple)): if isinstance(value, (list, tuple)):
return value return value
return _splitstrip(value) return _splitstrip(value)
def _check_regexp_csv(value: list[str] | tuple[str] | str) -> Iterable[str]:
r"""Split a comma-separated list of regexps, taking care to avoid splitting
a regex employing a comma as quantifier, as in `\d{1,2}`."""
if isinstance(value, (list, tuple)):
yield from value
else:
# None is a sentinel value here
regexps: deque[deque[str] | None] = deque([None])
open_braces = False
for char in value:
if char == "{":
open_braces = True
elif char == "}" and open_braces:
open_braces = False
if char == "," and not open_braces:
regexps.append(None)
elif regexps[-1] is None:
regexps.pop()
regexps.append(deque([char]))
else:
regexps[-1].append(char)
yield from ("".join(regexp).strip() for regexp in regexps if regexp is n
ot None)
def _comment(string: str) -> str: def _comment(string: str) -> str:
"""Return string as a comment.""" """Return string as a comment."""
lines = [line.strip() for line in string.splitlines()] lines = [line.strip() for line in string.splitlines()]
sep = "\n" sep = "\n"
return "# " + f"{sep}# ".join(lines) return "# " + f"{sep}# ".join(lines)
def _format_option_value(optdict: OptionDict, value: Any) -> str: def _format_option_value(optdict: OptionDict, value: Any) -> str:
"""Return the user input's value from a 'compiled' value. """Return the user input's value from a 'compiled' value.
TODO: 3.0: Remove deprecated function TODO: 3.0: Remove deprecated function
 End of changes. 2 change blocks. 
1 lines changed or deleted 27 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)