Skip to content

Commit

Permalink
Refactor bundle counting in Canned plugin (#6691)
Browse files Browse the repository at this point in the history
  • Loading branch information
nadove-ucsc committed Nov 14, 2024
1 parent a8a5dc2 commit 7d0f3f1
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions src/azul/plugins/repository/canned/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@
from furl import (
furl,
)
from more_itertools import (
ilen,
)

from azul import (
CatalogName,
Expand Down Expand Up @@ -165,11 +162,11 @@ def staging_area(self, url: str) -> StagingArea:

def count_bundles(self, source: SOURCE_SPEC) -> int:
staging_area = self.staging_area(source.spec.name)
return ilen(
links_id
for links_id in staging_area.links
if source.prefix is None or links_id.startswith(source.prefix.common)
)
if source.prefix is None:
return len(staging_area.links)
else:
prefix = source.prefix.common
return sum(1 for links_id in staging_area.links if links_id.startswith(prefix))

def list_bundles(self,
source: CannedSourceRef,
Expand Down

0 comments on commit 7d0f3f1

Please sign in to comment.