Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Dependency" needs to be imported outside TYPE_CHECKING only section #134

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions poetry/core/packages/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
from poetry.core.version.markers import AnyMarker
from poetry.core.version.markers import parse_marker

# Do not move to the TYPE_CHECKING only section, because Dependency get's imported
# by poetry/packages/locker.py from here
from .dependency import Dependency
from .specification import PackageSpecification
from .utils.utils import create_nested_marker

Expand All @@ -24,7 +27,6 @@
from poetry.core.semver import VersionTypes # noqa
from poetry.core.version.markers import BaseMarker # noqa

from .dependency import Dependency
from .directory_dependency import DirectoryDependency
from .file_dependency import FileDependency
from .url_dependency import URLDependency
Expand Down Expand Up @@ -188,7 +190,7 @@ def maintainer_email(self): # type: () -> str
@property
def all_requires(
self,
): # type: () -> List[Union["DirectoryDependency", "FileDependency", "URLDependency", "VCSDependency", "Dependency"]]
): # type: () -> List[Union["DirectoryDependency", "FileDependency", "URLDependency", "VCSDependency", Dependency]]
return self.requires + self.dev_requires

def _get_author(self): # type: () -> dict
Expand Down Expand Up @@ -310,7 +312,7 @@ def is_root(self): # type: () -> bool

def add_dependency(
self, dependency,
): # type: ("Dependency") -> "Dependency"
): # type: (Dependency) -> Dependency
if dependency.category == "dev":
self.dev_requires.append(dependency)
else:
Expand All @@ -320,7 +322,7 @@ def add_dependency(

def to_dependency(
self,
): # type: () -> Union["Dependency", "DirectoryDependency", "FileDependency", "URLDependency", "VCSDependency"]
): # type: () -> Union[Dependency, "DirectoryDependency", "FileDependency", "URLDependency", "VCSDependency"]
from poetry.core.utils._compat import Path

from .dependency import Dependency
Expand Down