law.target.collection#
Collections that wrap multiple targets.
Class TargetCollection
#
- class TargetCollection(targets, threshold=1.0, **kwargs)[source]#
Bases:
Target
Collection of arbitrary targets.
- complete(**kwargs)[source]#
Returns almost the same state information as
exists()
(called internally), but potentially also includes settings such asoptional
. All kwargs are forwarded toexists()
.This method is mostly useful in conjunction with task implementations whereas the vanilla
exists()
method should be used when relying on the actual existence status.
Class SiblingFileCollection
#
- class SiblingFileCollection(*args, **kwargs)[source]#
Bases:
SiblingFileCollectionBase
Collection of targets that represent files which are all located in the same directory. Specifically, the performance of
exists()
andcount()
can greatly improve with respect to the standardFileCollection
as the directory listing is used internally. This is especially useful for large collections of remote files.
Class NestedSiblingFileCollection
#
- class NestedSiblingFileCollection(*args, **kwargs)[source]#
Bases:
SiblingFileCollectionBase
Collection of targets that represent files which are located across several directories, with files in the same directory being wrapped by a
SiblingFileCollection
to exploit its benefit over the standardFileCollection
(see description above). This is especially useful for large collections of remote files that are located in different (sub) directories.The constructor identifies targets located in the same physical directory (identified by URI), creates one collection for each of them, and stores them in the collections attribute. Key access, iteration, etc., is identical to the standard
FileCollection
.