Skip to content

Commit

Permalink
locker: remove redundant lock data processing
Browse files Browse the repository at this point in the history
  • Loading branch information
abn committed Oct 14, 2020
1 parent b29450c commit a7d6676
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions poetry/packages/locker.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,15 +185,14 @@ def locked_repository(

return packages

@classmethod
def get_project_dependencies(
self, project_requires, pinned_versions=False, with_nested=False, with_dev=False
): # type: (List[Dependency], bool, bool, bool) -> List[Dependency]
packages = self.locked_repository(with_dev).packages

cls, project_requires, locked_packages, pinned_versions=False, with_nested=False
): # type: (List[Dependency], List[Package], bool, bool) -> List[Dependency]
# group packages entries by name, this is required because requirement might use
# different constraints
packages_by_name = {}
for pkg in packages:
for pkg in locked_packages:
if pkg.name not in packages_by_name:
packages_by_name[pkg.name] = []
packages_by_name[pkg.name].append(pkg)
Expand Down Expand Up @@ -275,8 +274,6 @@ def __walk_level(
# we make a copy to avoid any side-effects
requirement = deepcopy(requirement)

requirement._category = pkg.category

if pinned_versions:
requirement.set_constraint(
__get_locked_package(requirement).to_dependency().constraint
Expand All @@ -285,9 +282,7 @@ def __walk_level(
# dependencies use extra to indicate that it was activated via parent
# package's extras, this is not required for nested exports as we assume
# the resolver already selected this dependency
requirement.marker = requirement.marker.without_extras().intersect(
pkg.marker
)
requirement.marker = requirement.marker.without_extras()

key = (requirement.name, requirement.pretty_constraint)
if key not in nested_dependencies:
Expand Down Expand Up @@ -324,7 +319,9 @@ def get_project_dependency_packages(
)

for dependency in self.get_project_dependencies(
project_requires=project_requires, with_nested=True, with_dev=dev,
project_requires=project_requires,
locked_packages=repository.packages,
with_nested=True,
):
try:
package = repository.find_packages(dependency=dependency)[0]
Expand Down

0 comments on commit a7d6676

Please sign in to comment.