Transformation for Sequence.tails
    :param wrap: wrap children values with this
    :return: transformation
554144
def tails_t(wrap):
    
    return Transformation(
        'tails',
        lambda sequence: [wrap(sequence[i:]) for i in range(len(sequence) + 1)],
        {ExecutionStrategies.PRE_COMPUTE}
    )
647059
def wrap(v):
    

    type_ = _get(v, CLASS)

    if type_ is dict:
        m = object.__new__(Data)
        _set(m, SLOT, v)
        return m
    elif type_ is none_type:
        return Null
    elif type_ is list:
        return FlatList(v)
    elif type_ in generator_types:
        return FlatList(list(unwrap(vv) for vv in v))
    else:
        return v
671623
def _process_transform(self, data, transform, step_size):
    '''
    
    '''
    if isinstance(transform, (list,tuple,set)):
      return { t : self._transform(data,t,step_size) for t in transform }
    elif isinstance(transform, dict):
      return { tn : self._transform(data,tf,step_size) for tn,tf in transform.items() }
    return self._transform(data,transform,step_size)
414534
def mutates(f):
    '''
    '''
    @wraps(f)
    def wrapper(self, *args, **kwargs):
        if self.read_only:
            raise ReadOnlyException()
        self.next_generation()
        return f(self, *args, **kwargs)
    return wrapper
1201315
def encode(self, sequence):
		""""""
		
		polymorphisms = []
		defaultSequence = '' 
		binSequence = array.array(self.forma.typecode)
		b = 0
		i = 0
		trueI = 0 #not inc in case if poly
		poly = set()
		while i < len(sequence)-1:
			b = b | self.forma[self.charToBin[sequence[i]]]
			if sequence[i+1] == '/' :
				poly.add(sequence[i])
				i += 2
			else :
				binSequence.append(b)
				if len(poly) > 0 :
					poly.add(sequence[i])
					polymorphisms.append((trueI, poly))
					poly = set()
				
				bb = 0
				while b % 2 != 0 :
					b = b/2
					
				defaultSequence += sequence[i]
				b = 0
				i += 1
				trueI += 1
		
		if i < len(sequence) :
			b = b | self.forma[self.charToBin[sequence[i]]]
			binSequence.append(b)
			if len(poly) > 0 :
				if sequence[i] not in poly :
					poly.add(sequence[i])
				polymorphisms.append((trueI, poly))
			defaultSequence += sequence[i]
		
		return (binSequence, defaultSequence, polymorphisms)
1285052
def fastalite(handle):
    

    Seq = namedtuple('Seq', ['id', 'description', 'seq'])

    header, seq = '', []
    for line in handle:
        if line.startswith('>'):
            if header:
                yield Seq(header.split()[0], header, ''.join(seq))
            header, seq = line[1:].strip(), []
        else:
            seq.append(line.strip())

    if header and seq:
        yield Seq(header.split()[0], header, ''.join(seq))
87275
def flatten(sequence):
    
    for item in sequence:
        if hasattr(item, "__iter__") and not isinstance(item, str) and not isinstance(item, bytes):
            for i in item:
                yield i
        else:
            yield item
1250593
def walk_sequence(fexp, ftree, tree)

      i = fexp.child_ids.first

      ehead = ftree[2].take(i)
      ecurrent = ftree[2][i]
      etail = ftree[2].drop(i + 1)
      head = tree[2].take(i)
      current = tree[2][i]
      tail = tree[2].drop(i + 1)

      if ehead != head
        #
        # if the name and/or attributes of the exp are supposed to change
        # then we have to reapply it
        #
        register(MutationPoint.new(fexp.fei, tree, :re_apply))
        return
      end

      if ecurrent != current
        #
        # if the child currently applied is supposed to change, let's walk
        # it down
        #
        walk(@ps.fexp(fexp.children.first), current)
      end

      #if etail != tail
      #  #
      #  # if elements are added at the end of the sequence, let's register
      #  # a mutation that simply changes the tree (no need to re-apply)
      #  #
      #  register(MutationPoint.new(fexp.fei, tree, :update))
      #end
    end
769586
def _wraps(self, tokens):
        
        def _differ(tokens):
            inner, outer = tokens
            not_same_start = inner.get('start') != outer.get('start')
            not_same_end = inner.get('end') != outer.get('end')
            return not_same_start or not_same_end

        def _in_range(tokens):
            inner, outer = tokens
            starts_in = outer.get('start') <= inner.get('start') \
                <= outer.get('end')
            ends_in = outer.get('start') <= inner.get('end') \
                <= outer.get('end')
            return starts_in and ends_in

        if not _differ(tokens):
            return False

        return _in_range(tokens)
111526
def _wrap(cls, func):
        

        if isinstance(func, cls):
            return func
        return functools.update_wrapper(cls(func), func)
525019
def wrap_all(self, rows: Iterable[Union[Mapping[str, Any], Sequence[Any]]]):
        """"""
        return (self.wrap(r) for r in rows)
821221
def transform(self, target_type: Type[T], value: F, context: PipelineContext = None) -> T:
        
        pass
137552
def evaluate(self, sequence, transformations):
        
        # pylint: disable=no-self-use
        result = sequence
        for transform in transformations:
            strategies = transform.execution_strategies
            if strategies is not None and ExecutionStrategies.PRE_COMPUTE in strategies:
                result = transform.function(list(result))
            else:
                result = transform.function(result)
        return iter(result)
31182
def chain(self, **kwargs):
        
        chain = self.build_chain(**kwargs)
        self._patterns.append(chain)
        return chain
754652
def map_wrap(f):
    
    @functools.wraps(f)
    def wrapper(*args, **kwargs):
        return f(*args, **kwargs)
    return wrapper
1299974
def _transform(self, data, transform, step_size):
    '''
    
    '''
    if callable(transform):
      data = transform(data, step_size)
    return data
447092
def wraps(
    wrapped, assigned=functools.WRAPPER_ASSIGNMENTS, updated=functools.WRAPPER_UPDATES
):
    """"""
    if not is_cython_function(wrapped):
        return functools.wraps(wrapped, assigned, updated)
    else:
        return lambda wrapper: wrapper