clean up version_info references

This commit is contained in:
Anthony Sottile 2021-03-29 18:24:10 -07:00
parent 018dbcd69a
commit 5d43462c9d
3 changed files with 12 additions and 28 deletions

View file

@ -4,7 +4,6 @@ import errno
import itertools import itertools
import logging import logging
import signal import signal
import sys
import tokenize import tokenize
from typing import Dict from typing import Dict
from typing import List from typing import List
@ -41,14 +40,11 @@ SERIAL_RETRY_ERRNOS = {
def _multiprocessing_is_fork(): # type () -> bool def _multiprocessing_is_fork(): # type () -> bool
"""Class state is only preserved when using the `fork` strategy.""" """Class state is only preserved when using the `fork` strategy."""
if sys.version_info >= (3, 4): return (
return ( multiprocessing
multiprocessing # https://github.com/python/typeshed/pull/3415
# https://github.com/python/typeshed/pull/3415 and multiprocessing.get_start_method() == "fork" # type: ignore
and multiprocessing.get_start_method() == "fork" # type: ignore )
)
else:
return multiprocessing and not utils.is_windows()
class Manager: class Manager:

View file

@ -401,24 +401,13 @@ def parameters_for(plugin):
if is_class: # The plugin is a class if is_class: # The plugin is a class
func = plugin.plugin.__init__ func = plugin.plugin.__init__
if sys.version_info < (3, 3): parameters = collections.OrderedDict(
argspec = inspect.getargspec(func) [
start_of_optional_args = len(argspec[0]) - len(argspec[-1] or []) (parameter.name, parameter.default is parameter.empty)
parameter_names = argspec[0] for parameter in inspect.signature(func).parameters.values()
parameters = collections.OrderedDict( if parameter.kind == parameter.POSITIONAL_OR_KEYWORD
[ ]
(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
]
)
if is_class: if is_class:
parameters.pop("self", None) parameters.pop("self", None)

View file

@ -308,7 +308,6 @@ def test_matches_filename_for_excluding_dotfiles():
assert not utils.matches_filename('..', ('.*',), '', logger) assert not utils.matches_filename('..', ('.*',), '', logger)
@pytest.mark.xfail(sys.version_info < (3,), reason='py3+ only behaviour')
def test_stdin_get_value_crlf(): def test_stdin_get_value_crlf():
"""Ensure that stdin is normalized from crlf to lf.""" """Ensure that stdin is normalized from crlf to lf."""
stdin = io.TextIOWrapper(io.BytesIO(b'1\r\n2\r\n'), 'UTF-8') stdin = io.TextIOWrapper(io.BytesIO(b'1\r\n2\r\n'), 'UTF-8')