Skip to content
This repository was archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
sage_bootstrap.expand_class: Use .append, .extend instead of += for l…
Browse files Browse the repository at this point in the history
…ists
  • Loading branch information
Matthias Koeppe committed Nov 22, 2020
1 parent 4be654b commit b762c3d
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions build/sage_bootstrap/expand_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,23 +48,23 @@ def included_in_filter(pkg):
raise ValueError('Package name cannot start with ":", got %s', package_name_or_class)
if package_name_or_class.endswith(':'):
raise ValueError('Package name cannot end with ":", got %s', package_name_or_class)
self.names += [package_name_or_class]
self.names.append(package_name_or_class)

def _init_all(self, predicate):
self.names += [pkg.name for pkg in Package.all() if predicate(pkg)]
self.names.extend(pkg.name for pkg in Package.all() if predicate(pkg))

def _init_standard(self, predicate):
self.names += [pkg.name for pkg in Package.all() if pkg.type == 'standard' and predicate(pkg)]
self.names.extend(pkg.name for pkg in Package.all() if pkg.type == 'standard' and predicate(pkg))

def _init_optional(self, predicate):
self.names += [pkg.name for pkg in Package.all() if pkg.type == 'optional' and predicate(pkg)]
self.names.extend(pkg.name for pkg in Package.all() if pkg.type == 'optional' and predicate(pkg))

def _init_experimental(self, predicate):
self.names += [pkg.name for pkg in Package.all() if pkg.type == 'experimental' and predicate(pkg)]
self.names.extend(pkg.name for pkg in Package.all() if pkg.type == 'experimental' and predicate(pkg))

def _init_huge(self, predicate):
self.names += [pkg.name for pkg in Package.all() if pkg.type == 'huge' and predicate(pkg)]
self.names.extend(pkg.name for pkg in Package.all() if pkg.type == 'huge' and predicate(pkg))

def apply(self, function, *args, **kwds):
for package_name in self.names:
function(package_name, *args, **kwds)

0 comments on commit b762c3d

Please sign in to comment.