diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 1d33cf34..4adb593d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -42,16 +42,11 @@ repos: - id: blacken-docs additional_dependencies: - black==23.1.0 -- repo: https://github.com/asottile/reorder-python-imports - rev: v3.12.0 +- repo: https://github.com/pycqa/isort + rev: 5.13.2 hooks: - - id: reorder-python-imports - args: - - --py38-plus - - --application-directories - - .:example:src - - --add-import - - 'from __future__ import annotations' + - id: isort + name: isort (python) - repo: https://github.com/PyCQA/flake8 rev: 7.0.0 hooks: diff --git a/pyproject.toml b/pyproject.toml index afe2be67..fb63224b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -50,6 +50,13 @@ time_machine = "time_machine" [tool.black] target-version = ['py38'] +[tool.isort] +add_imports = [ + "from __future__ import annotations" +] +force_single_line = true +profile = "black" + [tool.pytest.ini_options] addopts = """\ --strict-config diff --git a/setup.py b/setup.py index e14cb9b9..caadb025 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,6 @@ from setuptools import Extension from setuptools import setup - if hasattr(sys, "pypy_version_info"): raise RuntimeError( "PyPy is not currently supported by time-machine, see " diff --git a/src/time_machine/__init__.py b/src/time_machine/__init__.py index 4fa2142e..b39427dc 100644 --- a/src/time_machine/__init__.py +++ b/src/time_machine/__init__.py @@ -13,15 +13,15 @@ from typing import Any from typing import Awaitable from typing import Callable -from typing import cast from typing import Generator as TypingGenerator -from typing import overload from typing import Tuple from typing import Type from typing import TypeVar from typing import Union -from unittest import mock +from typing import cast +from typing import overload from unittest import TestCase +from unittest import mock import _time_machine from dateutil.parser import parse as parse_datetime diff --git a/tests/test_time_machine.py b/tests/test_time_machine.py index 163ec2b5..b014d130 100644 --- a/tests/test_time_machine.py +++ b/tests/test_time_machine.py @@ -10,9 +10,9 @@ from contextlib import contextmanager from importlib.util import module_from_spec from importlib.util import spec_from_file_location -from unittest import mock from unittest import SkipTest from unittest import TestCase +from unittest import mock import pytest from dateutil import tz