Skip to content

Commit 7bf6b89

Browse files
committed
Refactor direct url editable test
1 parent 4c82baf commit 7bf6b89

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/pip/_internal/metadata/base.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
DIRECT_URL_METADATA_NAME,
2424
DirectUrl,
2525
DirectUrlValidationError,
26-
DirInfo,
2726
)
2827
from pip._internal.utils.compat import stdlib_pkgs # TODO: Move definition here.
2928
from pip._internal.utils.egg_link import egg_link_path_from_sys_path
@@ -86,7 +85,7 @@ def editable_project_location(self) -> Optional[str]:
8685
# TODO: this property is relatively costly to compute, memoize it ?
8786
direct_url = self.direct_url
8887
if direct_url:
89-
if isinstance(direct_url.info, DirInfo) and direct_url.info.editable:
88+
if direct_url.is_local_editable():
9089
return url_to_path(direct_url.url)
9190
else:
9291
# Search for an .egg-link file by walking sys.path, as it was

src/pip/_internal/models/direct_url.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,3 +215,6 @@ def from_json(cls, s: str) -> "DirectUrl":
215215

216216
def to_json(self) -> str:
217217
return json.dumps(self.to_dict(), sort_keys=True)
218+
219+
def is_local_editable(self) -> bool:
220+
return isinstance(self.info, DirInfo) and self.info.editable

0 commit comments

Comments
 (0)