diff --git a/hypothesis-python/src/hypothesis/extra/codemods.py b/hypothesis-python/src/hypothesis/extra/codemods.py index b5dcae72bb..b5ddfc0116 100644 --- a/hypothesis-python/src/hypothesis/extra/codemods.py +++ b/hypothesis-python/src/hypothesis/extra/codemods.py @@ -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) diff --git a/hypothesis-python/src/hypothesis/extra/django/_fields.py b/hypothesis-python/src/hypothesis/extra/django/_fields.py index 2118cd406a..1e4a46f551 100644 --- a/hypothesis-python/src/hypothesis/extra/django/_fields.py +++ b/hypothesis-python/src/hypothesis/extra/django/_fields.py @@ -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) diff --git a/hypothesis-python/src/hypothesis/internal/conjecture/utils.py b/hypothesis-python/src/hypothesis/internal/conjecture/utils.py index 84589edc4e..a951879899 100644 --- a/hypothesis-python/src/hypothesis/internal/conjecture/utils.py +++ b/hypothesis-python/src/hypothesis/internal/conjecture/utils.py @@ -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) diff --git a/hypothesis-python/src/hypothesis/internal/entropy.py b/hypothesis-python/src/hypothesis/internal/entropy.py index fb0ca2b27e..f3e91d36a7 100644 --- a/hypothesis-python/src/hypothesis/internal/entropy.py +++ b/hypothesis-python/src/hypothesis/internal/entropy.py @@ -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 diff --git a/hypothesis-python/src/hypothesis/stateful.py b/hypothesis-python/src/hypothesis/stateful.py index d169bb8308..f20a6b33db 100644 --- a/hypothesis-python/src/hypothesis/stateful.py +++ b/hypothesis-python/src/hypothesis/stateful.py @@ -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)) diff --git a/hypothesis-python/src/hypothesis/strategies/_internal/core.py b/hypothesis-python/src/hypothesis/strategies/_internal/core.py index ba85416f66..7206b4f112 100644 --- a/hypothesis-python/src/hypothesis/strategies/_internal/core.py +++ b/hypothesis-python/src/hypothesis/strategies/_internal/core.py @@ -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 diff --git a/hypothesis-python/tests/cover/test_asyncio.py b/hypothesis-python/tests/cover/test_asyncio.py index 294063b74c..1fd92e4488 100644 --- a/hypothesis-python/tests/cover/test_asyncio.py +++ b/hypothesis-python/tests/cover/test_asyncio.py @@ -9,7 +9,6 @@ # obtain one at https://mozilla.org/MPL/2.0/. import asyncio -import sys import warnings from unittest import TestCase @@ -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): diff --git a/hypothesis-python/tests/typing_extensions/test_backported_types.py b/hypothesis-python/tests/typing_extensions/test_backported_types.py index a6f3512de0..138d89f00f 100644 --- a/hypothesis-python/tests/typing_extensions/test_backported_types.py +++ b/hypothesis-python/tests/typing_extensions/test_backported_types.py @@ -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, diff --git a/pyproject.toml b/pyproject.toml index 426ac6734f..a1d9483d01 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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"]