Formaqts information about the given local DAP in a human readable form to list of lines
186079
def format_local_dap(dap, full=False, **kwargs):
    ''''''
    lines = []

    # Determining label width
    label_width = dapi.DapFormatter.calculate_offset(BASIC_LABELS)

    # Metadata
    lines.append(dapi.DapFormatter.format_meta(dap.meta, labels=BASIC_LABELS,
                                               offset=label_width, **kwargs))

    # Assistants
    lines.append('')
    lines.append(dapi.DapFormatter.format_assistants(dap.assistants))

    # Snippets
    if full:
        lines.append('')
        lines.append(dapi.DapFormatter.format_snippets(dap.snippets))

    # Supported platforms
    if 'supported_platforms' in dap.meta:
        lines.append('')
        lines.append(dapi.DapFormatter.format_platforms(dap.meta['supported_platforms']))

    lines.append()
    return lines
167556
def process_map
      output    = `ps -eo ppid,pid`
      processes = {}

      output.split("\n").each do |line|
        if result = line.match(/(\d+)\s(\d+)/)
          parent = result[1].to_i
          child  = result[2].to_i

          processes[parent] ||= []
          processes[parent] << child
        end
      end

      processes
    end
648492
def doit(self):
        """"""
        print('                . doit')
        lines = Lines()
        lines.add(1, 'cpdef inline void doit(self, int idx) %s:' % _nogil)
        lines.add(2, 'self.idx_sim = idx')
        if getattr(self.model.sequences, 'inputs', None) is not None:
            lines.add(2, 'self.load_data()')
        if self.model.INLET_METHODS:
            lines.add(2, 'self.update_inlets()')
        if hasattr(self.model, 'solve'):
            lines.add(2, 'self.solve()')
        else:
            lines.add(2, 'self.run()')
            if getattr(self.model.sequences, 'states', None) is not None:
                lines.add(2, 'self.new2old()')
        if self.model.OUTLET_METHODS:
            lines.add(2, 'self.update_outlets()')
        return lines
1353964
def lines_from_stream(f, as_interned=False):
    
    if as_interned:
        return [sys.intern(line) for line in f.read().splitlines()]
    return f.read().splitlines()
1361284
def _get_deps(deps, tree_base, saltenv='base'):
    '''
    
    '''
    deps_list = ''
    if deps is None:
        return deps_list
    if not isinstance(deps, list):
        raise SaltInvocationError(
            '\'deps\' must be a Python list or comma-separated string'
        )
    for deprpm in deps:
        parsed = _urlparse(deprpm)
        depbase = os.path.basename(deprpm)
        dest = os.path.join(tree_base, depbase)
        if parsed.scheme:
            __salt__['cp.get_url'](deprpm, dest, saltenv=saltenv)
        else:
            shutil.copy(deprpm, dest)

        deps_list += ' {0}'.format(dest)

    return deps_list
500256
def modified_lines_from_udiff(udiff):
    """"""
    chunks = re.split('\n@@ [^\n]+\n', udiff)[1:]

    line_numbers = re.findall('@@\s[+-]\d+,\d+ \+(\d+)', udiff)
    line_numbers = list(map(int, line_numbers))

    for c, start in zip(chunks, line_numbers):
        ilines = enumerate((line for line in c.splitlines()
                            if not line.startswith('-')),
                           start=start)
        added_lines = [i for i, line in ilines if line.startswith('+')]
        if added_lines:
            yield (added_lines[0], added_lines[-1])
707923
def contents(self):
        """"""
        rslt = []
        for (dpos, dlen, ulen, flag, typcd, nm) in self.toc:
            rslt.append(nm)
        return rslt
367928
def toc(self):
        
        if not self.activated:
            return []
        for exe in self.exes:
            for array in exe.arg_arrays:
                array.wait_to_read()
            for array in exe.aux_arrays:
                array.wait_to_read()
        for exe in self.exes:
            for name, array in zip(exe._symbol.list_arguments(), exe.arg_arrays):
                if self.re_prog.match(name):
                    self.queue.append((self.step, name, self.stat_func(array)))
            for name, array in zip(exe._symbol.list_auxiliary_states(), exe.aux_arrays):
                if self.re_prog.match(name):
                    self.queue.append((self.step, name, self.stat_func(array)))
        self.activated = False
        res = []
        if self.sort:
            self.queue.sort(key=lambda x: x[1])
        for n, k, v_list in self.queue:
            if isinstance(v_list, NDArray):
                v_list = [v_list]
            assert isinstance(v_list, list)
            s = ''
            for v in v_list:
                assert isinstance(v, NDArray)
                if v.shape == (1,):
                    s += str(v.asscalar()) + '\t'
                else:
                    s += str(v.asnumpy()) + '\t'
            res.append((n, k, s))
        self.queue = []
        return res
611396
def split_dae_alg(eqs: SYM, dx: SYM) -> Dict[str, SYM]:
    """"""
    dae = []
    alg = []
    for eq in ca.vertsplit(eqs):
        if ca.depends_on(eq, dx):
            dae.append(eq)
        else:
            alg.append(eq)
    return {
        'dae': ca.vertcat(*dae),
        'alg': ca.vertcat(*alg)
    }
147553
def _rec_filter_to_info(line):
    
    parts = line.rstrip().split("\t")
    move_filters = {"bSeq": "strand", "bPcr": "damage"}
    new_filters = []
    bias_info = []
    for f in parts[6].split(";"):
        if f in move_filters:
            bias_info.append(move_filters[f])
        elif f not in ["."]:
            new_filters.append(f)
    if bias_info:
        parts[7] += ";DKFZBias=%s" % ",".join(bias_info)
    parts[6] = ";".join(new_filters or ["PASS"])
    return "\t".join(parts) + "\n"
908543
def get_lines(self, key):
        """"""
        if key in self._indices:
            return self._indices[key].values()
        else:
            return []
505582
def logical_lines(lines):
    """"""
    if isinstance(lines, string_types):
        lines = StringIO(lines)
    buf = []
    for line in lines:
        if buf and not line.startswith(' '):
            chunk = ''.join(buf).strip()
            if chunk:
                yield chunk
            buf[:] = []

        buf.append(line)
    chunk = ''.join(buf).strip()
    if chunk:
        yield chunk
46694
def show(self):
        ''''''
        textWidth = max(60, shutil.get_terminal_size((80, 20)).columns)
        text = f'  {self.step_name() + ":":<21} ' + self.comment
        print('\n'.join(
            textwrap.wrap(
                text,
                width=textWidth,
                initial_indent='',
                subsequent_indent=' ' * 24)))
        local_parameters = {
            x: y
            for x, y in self.parameters.items()
            if x not in self.global_parameters
        }
        if local_parameters:
            print('    Workflow Options:')
        for name, (value, comment) in local_parameters.items():
            par_str = f'      {format_par(name, value)}'
            print(par_str)
            if comment:
                print('\n'.join(
                    textwrap.wrap(
                        comment,
                        width=textWidth,
                        initial_indent=' ' * 24,
                        subsequent_indent=' ' * 24)))
388464
def pad(lines, delim):
	
	"""
	Populates text into chunks. If the delim was & then
	['12 & 344', '344 & 8', '8 & 88'] would be stored in chunks as
	[['12', '344', '8'], ['344', '8', '88']]
	"""
	chunks = []
	for i in range(len(lines)):
		line = lines[i]
		sections = line.split(delim)
		for j in range(len(sections)):
			if len(chunks) <= j:
				chunks.append([])
			chunks[j].append(sections[j])

	"""
	Calculates & Stores the max length of chunks
	"""
	max_lengths = []
	for i in range(len(chunks)):
		_max = max([len(j) for j in chunks[i]])
		max_lengths.append(_max)

	"""
	Pads the children of chunks according to the chunk's max length" \
	"""
	for i in range(len(chunks)):
		for j in range(len(chunks[i])):
			chunks[i][j] += (max_lengths[i] - len(chunks[i][j])) * ' '
	new_lines = ['' for i in range(len(lines))]

	for i in range(len(chunks)):
		for j in range(len(chunks[i])):
			new_lines[j] += chunks[i][j]
	return new_lines
834975
def _lines(self):
        

        chunkIndices = self._listChunks()
        for chunkIndex in chunkIndices:
            with self._openChunk(chunkIndex) as chunk:
                yield from chunk._lines()
253379
def description_of(lines, name='stdin'):
    
    u = UniversalDetector()
    for line in lines:
        u.feed(line)
    u.close()
    result = u.result
    if result['encoding']:
        return '{0}: {1} with confidence {2}'.format(name, result['encoding'],
                                                     result['confidence'])
    else:
        return '{0}: no result'.format(name)
320084
def getpexts(lsp):
    '''
    
    '''
    lines=lsp.split('\n');
    #unfortunately regex doesn't work here
    lns,planens = zip(
        *[ (i,int(re.search('^ *extract *([0-9]+)',line).group(1)))
           for i,line in enumerate(lines)
           if re.search('^ *extract *[0-9]+', line)]);
    if len(lns) == 0: return [];
    end = lns[-1];
    
    for i,line in enumerate(lines[end+1:]):
        if re.match(' *\[',line): break;
    end += i;
    lineranges = zip(lns,(lns+(end,))[1:]);
    planes=dict()
    for (i,end),plane in zip(lineranges,planens):
        d=dict();
        labels = [
            'species',
            'direction',
            'position',];
        datarx = [
            '^ *species *([0-9]+)',
            '^ *direction *([xXyYzZ])',
            '^ *at *(.*)',];
        convs  = [
            lambda s: int(s),
            lambda i: i,
            lambda s: np.array(
                map(float,s.split(' '))),
        ];
        for line in lines[i:end]:
            for label,rx,conv in zip(labels,datarx,convs):
                if re.match(rx,line):
                    d[label]=conv(re.match(rx,line).group(1));
                pass
            pass
        planes[plane] = d;
    return planes;