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)
def __init__(self, path, exists=None): Target.__init__(self, exists=exists) luigi.target.FileSystemTarget.__init__(self, path)
def _repr_pairs(self, color=True): return Target._repr_pairs(self) + [("path", self.path)]
def __init__(self, path, **kwargs): Target.__init__(self, **kwargs) luigi.target.FileSystemTarget.__init__(self, path)
def __init__(self, path, fs=None, **kwargs): if fs: self.fs = fs Target.__init__(self, **kwargs) luigi.target.FileSystemTarget.__init__(self, path)
def _repr_pairs(self): return Target._repr_pairs(self) + [("len", len(self)), ("threshold", self.threshold)]
def _repr_pairs(self): return Target._repr_pairs(self) + [("path", self.path)]
def _copy_kwargs(self): kwargs = Target._copy_kwargs(self) kwargs["threshold"] = self.threshold return kwargs