mirror of
https://github.com/PyCQA/flake8.git
synced 2026-04-04 12:16:53 +00:00
clean up version_info references
This commit is contained in:
parent
018dbcd69a
commit
5d43462c9d
3 changed files with 12 additions and 28 deletions
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue