Comment on page
Filtering a Package
quilt3provides a handful of functions for operating on the contents of a package in an entry-by-entry manner. These are helpful for performing more complicated parsing operations on the package:
# create a package
p = (quilt3.Package()
# element-wise transform entries, outputting a list
# here "lk" is shorthand for "logical_key"
# and "entry" is the package entry
p.map(lambda lk, entry: entry)
# filter out entries not meeting certain criteria
p.filter(lambda lk, entry: 'cool' not in lk)
Notice that these functions operate over
(logical_key, entry)tuples. Each
logical_keyis a string. Each
PackageEntryobject, as would be returned if you slice to a leaf node of the package (e.g.