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 c04ca12
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions poetry/core/packages/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,15 @@
from .specification import PackageSpecification
from .utils.utils import create_nested_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


if TYPE_CHECKING:
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 +191,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 +313,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 +323,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 c04ca12

Please sign in to comment.