Skip to content

Commit

Permalink
shed --py38-plus
Browse files Browse the repository at this point in the history
  • Loading branch information
Zac-HD committed Jun 27, 2023
1 parent 3f0a136 commit f6e50ab
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 20 deletions.
2 changes: 1 addition & 1 deletion hypothesis-python/src/hypothesis/extra/codemods.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ def leave_Arg(self, original_node, updated_node):
return updated_node


@functools.lru_cache()
@functools.lru_cache
def get_fn(import_path):
mod, fn = import_path.rsplit(".", 1)
return getattr(importlib.import_module(mod), fn)
Expand Down
2 changes: 1 addition & 1 deletion hypothesis-python/src/hypothesis/extra/django/_fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def inner(field):
return inner


@lru_cache()
@lru_cache
def timezones():
# From Django 4.0, the default is to use zoneinfo instead of pytz.
assert getattr(django.conf.settings, "USE_TZ", False)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ def reject(self, why: Optional[str] = None) -> None:
SMALLEST_POSITIVE_FLOAT: float = next_up(0.0) or sys.float_info.min


@lru_cache()
@lru_cache
def _calc_p_continue(desired_avg: float, max_size: int) -> float:
"""Return the p_continue which will generate the desired average size."""
assert desired_avg <= max_size, (desired_avg, max_size)
Expand Down
5 changes: 1 addition & 4 deletions hypothesis-python/src/hypothesis/internal/entropy.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,7 @@
from hypothesis.internal.compat import GRAALPY, PYPY

if TYPE_CHECKING:
if sys.version_info >= (3, 8):
from typing import Protocol
else:
from typing_extensions import Protocol
from typing import Protocol

# we can't use this at runtime until from_type supports
# protocols -- breaks ghostwriter tests
Expand Down
2 changes: 1 addition & 1 deletion hypothesis-python/src/hypothesis/stateful.py
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ def teardown(self):
TestCase = TestCaseProperty()

@classmethod
@lru_cache()
@lru_cache
def _to_test_case(cls):
class StateMachineTestCase(TestCase):
settings = Settings(deadline=None, suppress_health_check=list(HealthCheck))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@
if sys.version_info >= (3, 8):
from typing import Protocol
elif TYPE_CHECKING:
from typing_extensions import Protocol
from typing import Protocol
else: # pragma: no cover
Protocol = object

Expand Down
12 changes: 4 additions & 8 deletions hypothesis-python/tests/cover/test_asyncio.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
# obtain one at https://mozilla.org/MPL/2.0/.

import asyncio
import sys
import warnings
from unittest import TestCase

Expand All @@ -18,14 +17,11 @@
from hypothesis import assume, given, strategies as st
from hypothesis.internal.compat import PYPY

if sys.version_info < (3, 8):
coro_decorator = asyncio.coroutine
else:

def coro_decorator(f):
with warnings.catch_warnings():
warnings.simplefilter(action="ignore", category=DeprecationWarning)
return asyncio.coroutine(f)
def coro_decorator(f):
with warnings.catch_warnings():
warnings.simplefilter(action="ignore", category=DeprecationWarning)
return asyncio.coroutine(f)


class TestAsyncio(TestCase):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,12 @@

import collections
import sys
from typing import Callable, DefaultDict, Dict, List, NewType, Type, Union
from typing import Callable, DefaultDict, Dict, List, Literal, NewType, Type, Union

import pytest
from typing_extensions import (
Annotated,
Concatenate,
Literal,
NotRequired,
ParamSpec,
Required,
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ select = [
]
ignore = ["C408", "E731", "E741", "S101", "UP031"]
line-length = 125
target-version = "py37"
target-version = "py38"

[tool.ruff.per-file-ignores]
"hypothesis-python/src/hypothesis/internal/compat.py" = ["F401"]
Expand Down

0 comments on commit f6e50ab

Please sign in to comment.