Example #1
0
    def __init__(self, targets, threshold=1.0, **kwargs):
        if isinstance(targets, types.GeneratorType):
            targets = list(targets)
        elif not isinstance(targets, (list, tuple, dict)):
            raise TypeError("invalid targets, must be of type: list, tuple, dict")

        Target.__init__(self, **kwargs)

        # store targets and threshold
        self.targets = targets
        self.threshold = threshold

        # store flat targets per element in the input structure of targets
        if isinstance(targets, (list, tuple)):
            gen = (flatten(v) for v in targets)
        else:  # dict
            gen = ((k, flatten(v)) for k, v in six.iteritems(targets))
        self._flat_targets = targets.__class__(gen)

        # also store an entirely flat list of targets for simplified iterations
        self._flat_target_list = flatten(targets)
Example #2
0
 def __init__(self, path, exists=None):
     Target.__init__(self, exists=exists)
     luigi.target.FileSystemTarget.__init__(self, path)
Example #3
0
 def _repr_pairs(self, color=True):
     return Target._repr_pairs(self) + [("path", self.path)]
Example #4
0
 def __init__(self, path, **kwargs):
     Target.__init__(self, **kwargs)
     luigi.target.FileSystemTarget.__init__(self, path)
Example #5
0
    def __init__(self, path, fs=None, **kwargs):
        if fs:
            self.fs = fs

        Target.__init__(self, **kwargs)
        luigi.target.FileSystemTarget.__init__(self, path)
Example #6
0
 def _repr_pairs(self):
     return Target._repr_pairs(self) + [("len", len(self)), ("threshold", self.threshold)]
Example #7
0
 def _repr_pairs(self):
     return Target._repr_pairs(self) + [("path", self.path)]
Example #8
0
 def _copy_kwargs(self):
     kwargs = Target._copy_kwargs(self)
     kwargs["threshold"] = self.threshold
     return kwargs