def __call__(self, *args): """ Create a Sequence using a sequential ExecutionEngine. If args has more than one argument then the argument list becomes the sequence. If args[0] is primitive, a sequence wrapping it is created. If args[0] is a list, tuple, iterable, or Sequence it is wrapped as a Sequence. :param args: Sequence to wrap :return: Wrapped sequence """ # pylint: disable=no-self-use engine = ExecutionEngine() if len(args) == 0: raise TypeError( "seq() takes at least 1 argument ({0} given)".format( len(args))) elif len(args) > 1: return Sequence(list(args), engine=engine) elif is_primitive(args[0]): return Sequence([args[0]], engine=engine) else: return Sequence(args[0], engine=engine)
def __init__(self, prior_lineage=None, engine=None): """ Construct an empty lineage if prior_lineage is None or if its not use it as the list of current transformations :param prior_lineage: Lineage object to inherit :return: new Lineage object """ self.transformations = [] if prior_lineage is None else list(prior_lineage.transformations) self.engine = ((engine or ExecutionEngine()) if prior_lineage is None else prior_lineage.engine)
def __call__(self, *args, **kwargs): """ Create a Sequence using a sequential ExecutionEngine. If args has more than one argument then the argument list becomes the sequence. If args[0] is primitive, a sequence wrapping it is created. If args[0] is a list, tuple, iterable, or Sequence it is wrapped as a Sequence. :param args: Sequence to wrap :return: Wrapped sequence """ # pylint: disable=no-self-use engine = ExecutionEngine() return self._parse_args(args, engine, "seq() takes at least 1 argument ({0} given)")