예제 #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)
예제 #2
0
 def __init__(self, path, exists=None):
     Target.__init__(self, exists=exists)
     luigi.target.FileSystemTarget.__init__(self, path)
예제 #3
0
 def _repr_pairs(self, color=True):
     return Target._repr_pairs(self) + [("path", self.path)]
예제 #4
0
 def __init__(self, path, **kwargs):
     Target.__init__(self, **kwargs)
     luigi.target.FileSystemTarget.__init__(self, path)
예제 #5
0
    def __init__(self, path, fs=None, **kwargs):
        if fs:
            self.fs = fs

        Target.__init__(self, **kwargs)
        luigi.target.FileSystemTarget.__init__(self, path)
예제 #6
0
 def _repr_pairs(self):
     return Target._repr_pairs(self) + [("len", len(self)), ("threshold", self.threshold)]
예제 #7
0
파일: file.py 프로젝트: demmerichs/law
 def _repr_pairs(self):
     return Target._repr_pairs(self) + [("path", self.path)]
예제 #8
0
파일: collection.py 프로젝트: bfis/law
 def _copy_kwargs(self):
     kwargs = Target._copy_kwargs(self)
     kwargs["threshold"] = self.threshold
     return kwargs