core: cleanup/sort imports according to ruff check --select I

This commit is contained in:
Dima Gerasimov 2024-08-16 13:25:19 +03:00 committed by karlicoss
parent 7023088d13
commit 7bfce72b7c
45 changed files with 235 additions and 170 deletions

View file

@ -1,10 +1,9 @@
from concurrent.futures import Future, Executor
import sys
from typing import Any, Callable, Optional, TypeVar, TYPE_CHECKING
from concurrent.futures import Executor, Future
from typing import TYPE_CHECKING, Any, Callable, Optional, TypeVar
from ..compat import ParamSpec
_P = ParamSpec('_P')
_T = TypeVar('_T')
@ -15,6 +14,7 @@ class DummyExecutor(Executor):
This is useful if you're already using Executor for parallelising,
but also want to provide an option to run the code serially (e.g. for debugging)
"""
def __init__(self, max_workers: Optional[int] = 1) -> None:
self._shutdown = False
self._max_workers = max_workers

View file

@ -1,9 +1,9 @@
import importlib
import importlib.util
from pathlib import Path
import sys
from typing import Optional
from pathlib import Path
from types import ModuleType
from typing import Optional
from ..common import PathIsh

View file

@ -4,8 +4,10 @@ Various helpers/transforms of iterators
Ideally this should be as small as possible and we should rely on stdlib itertools or more_itertools
"""
import warnings
from collections.abc import Hashable
from typing import (
TYPE_CHECKING,
Callable,
Dict,
Iterable,
@ -13,18 +15,16 @@ from typing import (
List,
Optional,
Sized,
Union,
TypeVar,
Union,
cast,
TYPE_CHECKING,
)
import warnings
import more_itertools
from decorator import decorator
from ..compat import ParamSpec
from decorator import decorator
import more_itertools
T = TypeVar('T')
K = TypeVar('K')
V = TypeVar('V')
@ -268,7 +268,9 @@ def check_if_hashable(iterable: Iterable[_HT]) -> Iterable[_HT]:
def test_check_if_hashable() -> None:
from dataclasses import dataclass
from typing import Set, Tuple
import pytest
from ..compat import assert_type
x1: List[int] = [1, 2]
@ -353,6 +355,7 @@ def unique_everseen(
def test_unique_everseen() -> None:
import pytest
from ..tests.common import tmp_environ_set
def fun_good() -> Iterator[int]: