diff options
| author | Anthony Sottile <asottile@umich.edu> | 2021-03-29 18:24:10 -0700 |
|---|---|---|
| committer | Anthony Sottile <asottile@umich.edu> | 2021-03-30 17:37:13 -0700 |
| commit | 5d43462c9d788e5e5ee98d37de7552c549805046 (patch) | |
| tree | d0959d399469107effd53b22a060e341837ea5e4 | |
| parent | 018dbcd69a45b8686cbe63f5e8ce1ba13198f9d7 (diff) | |
| download | flake8-5d43462c9d788e5e5ee98d37de7552c549805046.tar.gz | |
clean up version_info references
| -rw-r--r-- | src/flake8/checker.py | 14 | ||||
| -rw-r--r-- | src/flake8/utils.py | 25 | ||||
| -rw-r--r-- | tests/unit/test_utils.py | 1 |
3 files changed, 12 insertions, 28 deletions
diff --git a/src/flake8/checker.py b/src/flake8/checker.py index a9abd21..15ca9bc 100644 --- a/src/flake8/checker.py +++ b/src/flake8/checker.py @@ -4,7 +4,6 @@ import errno import itertools import logging import signal -import sys import tokenize from typing import Dict from typing import List @@ -41,14 +40,11 @@ SERIAL_RETRY_ERRNOS = { def _multiprocessing_is_fork(): # type () -> bool """Class state is only preserved when using the `fork` strategy.""" - if sys.version_info >= (3, 4): - return ( - multiprocessing - # https://github.com/python/typeshed/pull/3415 - and multiprocessing.get_start_method() == "fork" # type: ignore - ) - else: - return multiprocessing and not utils.is_windows() + return ( + multiprocessing + # https://github.com/python/typeshed/pull/3415 + and multiprocessing.get_start_method() == "fork" # type: ignore + ) class Manager: diff --git a/src/flake8/utils.py b/src/flake8/utils.py index 5db1d22..f127688 100644 --- a/src/flake8/utils.py +++ b/src/flake8/utils.py @@ -401,24 +401,13 @@ def parameters_for(plugin): if is_class: # The plugin is a class func = plugin.plugin.__init__ - if sys.version_info < (3, 3): - argspec = inspect.getargspec(func) - start_of_optional_args = len(argspec[0]) - len(argspec[-1] or []) - parameter_names = argspec[0] - parameters = collections.OrderedDict( - [ - (name, position < start_of_optional_args) - for position, name in enumerate(parameter_names) - ] - ) - else: - parameters = collections.OrderedDict( - [ - (parameter.name, parameter.default is parameter.empty) - for parameter in inspect.signature(func).parameters.values() - if parameter.kind == parameter.POSITIONAL_OR_KEYWORD - ] - ) + parameters = collections.OrderedDict( + [ + (parameter.name, parameter.default is parameter.empty) + for parameter in inspect.signature(func).parameters.values() + if parameter.kind == parameter.POSITIONAL_OR_KEYWORD + ] + ) if is_class: parameters.pop("self", None) diff --git a/tests/unit/test_utils.py b/tests/unit/test_utils.py index 1befa8f..c0cf237 100644 --- a/tests/unit/test_utils.py +++ b/tests/unit/test_utils.py @@ -308,7 +308,6 @@ def test_matches_filename_for_excluding_dotfiles(): assert not utils.matches_filename('..', ('.*',), '', logger) -@pytest.mark.xfail(sys.version_info < (3,), reason='py3+ only behaviour') def test_stdin_get_value_crlf(): """Ensure that stdin is normalized from crlf to lf.""" stdin = io.TextIOWrapper(io.BytesIO(b'1\r\n2\r\n'), 'UTF-8') |
