Merge pull request #1453 from asottile/dead

remove dead code
This commit is contained in:
Anthony Sottile 2021-11-14 11:43:25 -05:00 committed by GitHub
commit 799c71eeb6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 0 additions and 64 deletions

View file

@ -54,11 +54,6 @@ normalized path.
This function retrieves and caches the value provided on ``sys.stdin``. This
allows plugins to use this to retrieve ``stdin`` if necessary.
.. autofunction:: flake8.utils.is_windows
This provides a convenient and explicitly named function that checks if we are
currently running on a Windows (or ``nt``) operating system.
.. autofunction:: flake8.utils.is_using_stdin
Another helpful function that is named only to be explicit given it is a very

View file

@ -18,8 +18,6 @@ SELECT = ("E", "F", "W", "C90")
MAX_LINE_LENGTH = 79
INDENT_SIZE = 4
TRUTHY_VALUES = {"true", "1", "t"}
# Other constants
WHITESPACE = frozenset(" \t")

View file

@ -17,14 +17,10 @@ from typing import Sequence
from typing import Set
from typing import Tuple
from typing import Type
from typing import TYPE_CHECKING
from typing import Union
from flake8 import utils
if TYPE_CHECKING:
from typing import NoReturn
LOG = logging.getLogger(__name__)
# represent a singleton of "not passed arguments".
@ -310,34 +306,10 @@ class Option:
return value
def normalize_from_setuptools(
self, value: str
) -> Union[int, float, complex, bool, str]:
"""Normalize the value received from setuptools."""
value = self.normalize(value)
if self.type is int or self.action == "count":
return int(value)
elif self.type is float:
return float(value)
elif self.type is complex:
return complex(value)
if self.action in ("store_true", "store_false"):
value = str(value).upper()
if value in ("1", "T", "TRUE", "ON"):
return True
if value in ("0", "F", "FALSE", "OFF"):
return False
return value
def to_argparse(self) -> Tuple[List[str], Dict[str, Any]]:
"""Convert a Flake8 Option to argparse ``add_argument`` arguments."""
return self.option_args, self.filtered_option_kwargs
@property
def to_optparse(self) -> "NoReturn":
"""No longer functional."""
raise AttributeError("to_optparse: flake8 now uses argparse")
PluginVersion = collections.namedtuple(
"PluginVersion", ["name", "version", "local"]

View file

@ -16,7 +16,6 @@ from flake8 import defaults
from flake8 import utils
LOG = logging.getLogger(__name__)
PyCF_ONLY_AST = 1024
NEWLINE = frozenset([tokenize.NL, tokenize.NEWLINE])
SKIP_TOKENS = frozenset(

View file

@ -281,17 +281,6 @@ def parse_unified_diff(diff: Optional[str] = None) -> Dict[str, Set[int]]:
return parsed_paths
def is_windows() -> bool:
"""Determine if we're running on Windows.
:returns:
True if running on Windows, otherwise False
:rtype:
bool
"""
return os.name == "nt"
def is_using_stdin(paths: List[str]) -> bool:
"""Determine if we're going to read from stdin.

View file

@ -25,14 +25,6 @@ def test_to_argparse():
assert isinstance(kwargs["type"], functools.partial)
def test_to_optparse():
"""Test that .to_optparse() produces a useful error message."""
with pytest.raises(AttributeError) as excinfo:
manager.Option("--foo").to_optparse
(msg,) = excinfo.value.args
assert msg == "to_optparse: flake8 now uses argparse"
def test_to_argparse_creates_an_option_as_we_expect():
"""Show that we pass all keyword args to argparse."""
opt = manager.Option("-t", "--test", action="count")

View file

@ -160,15 +160,6 @@ def test_normalize_paths(value, expected):
assert utils.normalize_paths(value) == expected
def test_is_windows_checks_for_nt():
"""Verify that we correctly detect Windows."""
with mock.patch.object(os, "name", "nt"):
assert utils.is_windows() is True
with mock.patch.object(os, "name", "posix"):
assert utils.is_windows() is False
@pytest.mark.parametrize(
"filename,patterns,expected",
[