Commit c880cd74 by Edwin Yllanes Committed by GitHub

PEP 585 (#5643)

parent f3439dad
......@@ -3,7 +3,6 @@ from __future__ import annotations
from contextlib import contextmanager
from typing import TYPE_CHECKING
from typing import Any
from typing import Iterator
from tomlkit import document
from tomlkit import table
......@@ -12,6 +11,8 @@ from poetry.config.config_source import ConfigSource
if TYPE_CHECKING:
from collections.abc import Iterator
from poetry.core.toml.file import TOMLFile
from tomlkit.toml_document import TOMLDocument
......
......@@ -10,8 +10,6 @@ import zipfile
from pathlib import Path
from typing import TYPE_CHECKING
from typing import Any
from typing import ContextManager
from typing import Iterator
from typing import cast
import pkginfo
......@@ -31,6 +29,8 @@ from poetry.utils.setup_reader import SetupReader
if TYPE_CHECKING:
from collections.abc import Callable
from collections.abc import Iterator
from contextlib import AbstractContextManager
from poetry.core.packages.project_package import ProjectPackage
......@@ -281,7 +281,9 @@ class PackageInfo:
# So, we unpack and introspect
suffix = path.suffix
context: Callable[[str], ContextManager[zipfile.ZipFile | tarfile.TarFile]]
context: Callable[
[str], AbstractContextManager[zipfile.ZipFile | tarfile.TarFile]
]
if suffix == ".zip":
context = zipfile.ZipFile
else:
......
from __future__ import annotations
from typing import TYPE_CHECKING
from typing import Iterable
from typing import Sequence
from cleo.io.null_io import NullIO
......@@ -20,6 +18,9 @@ from poetry.utils.helpers import pluralize
if TYPE_CHECKING:
from collections.abc import Iterable
from collections.abc import Sequence
from cleo.io.io import IO
from poetry.core.packages.project_package import ProjectPackage
......
......@@ -3,7 +3,6 @@ from __future__ import annotations
from pathlib import Path
from typing import TYPE_CHECKING
from typing import Any
from typing import Mapping
from tomlkit import dumps
from tomlkit import inline_table
......@@ -16,6 +15,8 @@ from poetry.utils.helpers import module_name
if TYPE_CHECKING:
from typing import Mapping
from poetry.core.pyproject.toml import PyProjectTOML
from tomlkit.items import InlineTable
......
from __future__ import annotations
from typing import TYPE_CHECKING
from typing import Iterator
from poetry.mixology.incompatibility_cause import ConflictCause
from poetry.mixology.incompatibility_cause import DependencyCause
......@@ -14,6 +13,7 @@ from poetry.mixology.incompatibility_cause import RootCause
if TYPE_CHECKING:
from collections.abc import Callable
from collections.abc import Iterator
from poetry.mixology.incompatibility_cause import IncompatibilityCause
from poetry.mixology.term import Term
......
......@@ -10,9 +10,6 @@ from hashlib import sha256
from pathlib import Path
from typing import TYPE_CHECKING
from typing import Any
from typing import Iterable
from typing import Iterator
from typing import Sequence
from typing import cast
from poetry.core.packages.dependency import Dependency
......@@ -40,6 +37,10 @@ from poetry.utils.extras import get_extra_package_names
if TYPE_CHECKING:
from collections.abc import Iterable
from collections.abc import Iterator
from collections.abc import Sequence
from poetry.core.version.markers import BaseMarker
from tomlkit.toml_document import TOMLDocument
......
from __future__ import annotations
from typing import TYPE_CHECKING
from typing import Sequence
from poetry.packages.dependency_package import DependencyPackage
if TYPE_CHECKING:
from collections.abc import Sequence
from poetry.core.packages.dependency import Dependency
from poetry.core.packages.package import Package
......
......@@ -13,8 +13,6 @@ from contextlib import contextmanager
from pathlib import Path
from typing import TYPE_CHECKING
from typing import Any
from typing import Iterable
from typing import Iterator
from typing import cast
from cleo.ui.progress_indicator import ProgressIndicator
......@@ -43,6 +41,8 @@ from poetry.vcs.git import Git
if TYPE_CHECKING:
from collections.abc import Callable
from collections.abc import Iterable
from collections.abc import Iterator
from poetry.core.packages.dependency import Dependency
from poetry.core.packages.package import Package
......
......@@ -6,7 +6,6 @@ from collections import defaultdict
from contextlib import contextmanager
from typing import TYPE_CHECKING
from typing import FrozenSet
from typing import Iterator
from typing import Tuple
from typing import TypeVar
......@@ -25,6 +24,8 @@ from poetry.puzzle.provider import Provider
if TYPE_CHECKING:
from collections.abc import Iterator
from cleo.io.io import IO
from poetry.core.packages.dependency import Dependency
from poetry.core.packages.directory_dependency import DirectoryDependency
......
......@@ -5,7 +5,6 @@ import re
from abc import abstractmethod
from typing import TYPE_CHECKING
from typing import Iterator
from poetry.core.packages.package import Package
from poetry.core.semver.version import Version
......@@ -16,6 +15,8 @@ from poetry.utils.patterns import wheel_file_re
if TYPE_CHECKING:
from collections.abc import Iterator
from poetry.core.packages.utils.link import Link
......
......@@ -4,13 +4,16 @@ import urllib.parse
import warnings
from html import unescape
from typing import Iterator
from typing import TYPE_CHECKING
from poetry.core.packages.utils.link import Link
from poetry.repositories.link_sources.base import LinkSource
if TYPE_CHECKING:
from collections.abc import Iterator
with warnings.catch_warnings():
warnings.simplefilter("ignore")
import html5lib
......
......@@ -18,8 +18,6 @@ from pathlib import Path
from subprocess import CalledProcessError
from typing import TYPE_CHECKING
from typing import Any
from typing import Iterable
from typing import Iterator
from typing import TypeVar
import packaging.tags
......@@ -49,6 +47,9 @@ from poetry.utils.helpers import remove_directory
if TYPE_CHECKING:
from collections.abc import Iterable
from collections.abc import Iterator
from cleo.io.io import IO
from poetry.core.version.markers import BaseMarker
......
from __future__ import annotations
from typing import TYPE_CHECKING
from typing import Iterable
from typing import Iterator
from typing import Mapping
from typing import Sequence
if TYPE_CHECKING:
from collections.abc import Iterable
from collections.abc import Iterator
from collections.abc import Sequence
from typing import Mapping
from poetry.core.packages.package import Package
......
......@@ -6,10 +6,10 @@ import shutil
import stat
import tempfile
from collections.abc import Mapping
from pathlib import Path
from typing import TYPE_CHECKING
from typing import Any
from typing import Mapping
if TYPE_CHECKING:
......
......@@ -4,7 +4,6 @@ import os
import re
from typing import TYPE_CHECKING
from typing import Iterator
import pytest
......@@ -17,6 +16,7 @@ from poetry.config.config import int_normalizer
if TYPE_CHECKING:
from collections.abc import Callable
from collections.abc import Iterator
from pathlib import Path
......
......@@ -11,7 +11,6 @@ from contextlib import suppress
from pathlib import Path
from typing import TYPE_CHECKING
from typing import Any
from typing import Iterator
from typing import TextIO
import httpretty
......@@ -40,6 +39,8 @@ from tests.helpers import mock_download
if TYPE_CHECKING:
from collections.abc import Iterator
from _pytest.config import Config as PyTestConfig
from _pytest.config.argparsing import Parser
from pytest_mock import MockerFixture
......
......@@ -4,7 +4,6 @@ import os
from pathlib import Path
from typing import TYPE_CHECKING
from typing import Iterator
import pytest
......@@ -12,6 +11,8 @@ from poetry.utils.env import EnvManager
if TYPE_CHECKING:
from collections.abc import Iterator
from tests.helpers import PoetryTestApplication
......
......@@ -6,7 +6,6 @@ import sys
from pathlib import Path
from typing import TYPE_CHECKING
from typing import Iterator
import pytest
......@@ -20,6 +19,8 @@ from tests.helpers import get_package
if TYPE_CHECKING:
from collections.abc import Iterator
from _pytest.fixtures import FixtureRequest
from poetry.core.packages.package import Package
from pytest_mock import MockerFixture
......
......@@ -4,7 +4,6 @@ import os
from pathlib import Path
from typing import TYPE_CHECKING
from typing import Iterator
import pytest
......@@ -24,6 +23,8 @@ from tests.helpers import mock_clone
if TYPE_CHECKING:
from collections.abc import Iterator
from pytest_mock import MockerFixture
from poetry.installation.executor import Executor
......
......@@ -10,7 +10,6 @@ import urllib.parse
from pathlib import Path
from typing import TYPE_CHECKING
from typing import Any
from typing import Iterator
from poetry.core.masonry.utils.helpers import escape_name
from poetry.core.masonry.utils.helpers import escape_version
......@@ -29,6 +28,8 @@ from poetry.repositories.exceptions import PackageNotFound
if TYPE_CHECKING:
from collections.abc import Iterator
from poetry.core.packages.dependency import Dependency
from poetry.core.semver.version import Version
from tomlkit.toml_document import TOMLDocument
......
from __future__ import annotations
from typing import TYPE_CHECKING
from typing import Iterable
from unittest.mock import PropertyMock
import pytest
......@@ -14,6 +13,8 @@ from poetry.repositories.link_sources.base import LinkSource
if TYPE_CHECKING:
from collections.abc import Iterable
from pytest_mock import MockerFixture
......
......@@ -7,7 +7,6 @@ import sys
from pathlib import Path
from typing import TYPE_CHECKING
from typing import Any
from typing import Iterator
import pytest
import tomlkit
......@@ -34,6 +33,7 @@ from poetry.utils.helpers import remove_directory
if TYPE_CHECKING:
from collections.abc import Callable
from collections.abc import Iterator
from pytest_mock import MockerFixture
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment