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: remove redundant _extras attribute #375

Merged
merged 1 commit into from
May 26, 2022
Merged
Show file tree
Hide file tree
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
9 changes: 4 additions & 5 deletions src/poetry/core/packages/dependency.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ def __init__(
self._transitive_python_versions: str | None = None
self._transitive_python_constraint: VersionConstraint | None = None
self._transitive_marker: BaseMarker | None = None
self._extras = frozenset(extras or [])

self._in_extras: list[str] = []

Expand Down Expand Up @@ -242,7 +241,7 @@ def transitive_python_constraint(self) -> VersionConstraint:

@property
def extras(self) -> frozenset[str]:
return self._extras
return self._features

@property
def in_extras(self) -> list[str]:
Expand Down Expand Up @@ -462,7 +461,7 @@ def with_constraint(self, constraint: str | VersionConstraint) -> Dependency:
optional=self.is_optional(),
groups=list(self._groups),
allows_prereleases=self.allows_prereleases(),
extras=self._extras,
extras=self.extras,
source_type=self._source_type,
source_url=self._source_url,
source_reference=self._source_reference,
Expand Down Expand Up @@ -612,14 +611,14 @@ def __eq__(self, other: Any) -> bool:
return (
self.is_same_package_as(other)
and self._constraint == other.constraint
and self._extras == other.extras
and self.extras == other.extras
)

def __ne__(self, other: Any) -> bool:
return not self.__eq__(other)

def __hash__(self) -> int:
return super().__hash__() ^ hash(self._constraint) ^ hash(self._extras)
return super().__hash__() ^ hash(self._constraint) ^ hash(self.extras)

def __str__(self) -> str:
if self.is_root:
Expand Down
2 changes: 1 addition & 1 deletion src/poetry/core/packages/directory_dependency.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def with_constraint(
optional=self.is_optional(),
groups=list(self._groups),
develop=self._develop,
extras=list(self._extras),
extras=list(self.extras),
)

new.set_constraint(constraint)
Expand Down
2 changes: 1 addition & 1 deletion src/poetry/core/packages/file_dependency.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def with_constraint(self, constraint: str | VersionConstraint) -> FileDependency
base=self.base,
optional=self.is_optional(),
groups=list(self._groups),
extras=list(self._extras),
extras=list(self.extras),
)

new.set_constraint(constraint)
Expand Down
2 changes: 1 addition & 1 deletion src/poetry/core/packages/url_dependency.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def with_constraint(self, constraint: str | VersionConstraint) -> URLDependency:
url=self._url,
optional=self.is_optional(),
groups=list(self._groups),
extras=list(self._extras),
extras=list(self.extras),
)

new.set_constraint(constraint)
Expand Down
2 changes: 1 addition & 1 deletion src/poetry/core/packages/vcs_dependency.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ def with_constraint(self, constraint: str | VersionConstraint) -> VCSDependency:
optional=self.is_optional(),
groups=list(self._groups),
develop=self._develop,
extras=list(self._extras),
extras=list(self.extras),
)

new.set_constraint(constraint)
Expand Down