Skip to content

Commit

Permalink
"Dependency" needs to be imported outside TYPE_CHECKING only section
Browse files Browse the repository at this point in the history
  • Loading branch information
finswimmer committed Feb 5, 2021
1 parent a8fc290 commit 0d60634
Showing 1 changed file with 6 additions and 4 deletions.
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

0 comments on commit 0d60634

Please sign in to comment.