Return the ps grain
436858
def _ps(osdata):
    '''
    
    '''
    grains = {}
    bsd_choices = ('FreeBSD', 'NetBSD', 'OpenBSD', 'MacOS')
    if osdata['os'] in bsd_choices:
        grains['ps'] = 'ps auxwww'
    elif osdata['os_family'] == 'Solaris':
        grains['ps'] = '/usr/ucb/ps auxwww'
    elif osdata['os'] == 'Windows':
        grains['ps'] = 'tasklist.exe'
    elif osdata.get('virtual', '') == 'openvzhn':
        grains['ps'] = (
            'ps -fH -p $(grep -l \"^envID:[[:space:]]*0\\$\" '
            '/proc/[0-9]*/status | sed -e \"s=/proc/\\([0-9]*\\)/.*=\\1=\")  '
            '| awk \'{ $7=\"\"; print }\''
        )
    elif osdata['os_family'] == 'AIX':
        grains['ps'] = '/usr/bin/ps auxww'
    elif osdata['os_family'] == 'NILinuxRT':
        grains['ps'] = 'ps -o user,pid,ppid,tty,time,comm'
    else:
        grains['ps'] = 'ps -efHww'
    return grains
391477
def pluck(self) :
		""""""
		e = copy.copy(self)
		e.transcript = str(self.transcript)
		return e
740632
def ps():
    '''
    
    '''
    containers = get_containers()
    containers = [pretty_container(c) for c in containers]
    print_table(containers, ['name', 'ip', 'ports', 'created', 'image'], sort='name')
653479
def coarse_grain(coarse_grain):
    """"""
    partition(coarse_grain.partition)

    if len(coarse_grain.partition) != len(coarse_grain.grouping):
        raise ValueError('output and state groupings must be the same size')

    for part, group in zip(coarse_grain.partition, coarse_grain.grouping):
        if set(range(len(part) + 1)) != set(group[0] + group[1]):
            # Check that all elements in the partition are in one of the two
            # state groupings
            raise ValueError('elements in output grouping {0} do not match '
                             'elements in state grouping {1}'.format(
                                 part, group))
1215447
def grains(**kwargs):
    '''
    
    '''
    import __main__ as main  # pylint: disable=unused-import
    if not DEVICE_DETAILS['grains_cache']:
        data = sendline('show version')
        if CONNECTION == 'nxapi':
            data = data[0]
        ret = salt.utils.nxos.system_info(data)
        log.debug(ret)
        DEVICE_DETAILS['grains_cache'].update(ret['nxos'])
    return {'nxos': DEVICE_DETAILS['grains_cache']}
759627
def get_proteins_from_psm(line):
    """"""
    proteins = line[mzidtsvdata.HEADER_PROTEIN].split(';')
    outproteins = []
    for protein in proteins:
        prepost_protein = re.sub('\(pre=.*post=.*\)', '', protein).strip()
        outproteins.append(prepost_protein)
    return outproteins
731308
def retrieve():
    """"""
    a = TpPd(pd=0x3)
    b = MessageType(mesType=0x1c)  # 00011100
    packet = a / b
    return packet
1016141
def _mixup( self, ps ):
        """"""
        for i in range(len(ps) - 1, 0, -1):
            j = int(numpy.random.random() * i)
            temp = ps[i]
            ps[i] = ps[j]
            ps[j] = temp
        return ps
213361
def _ps(self, sys_output):
        
        '''  '''
        
        import re
        gap_pattern = re.compile('\t|\s{2,}')
        container_list = []
        output_lines = sys_output.split('\n')
        column_headers = gap_pattern.split(output_lines[0])
        for i in range(1,len(output_lines)):
            columns = gap_pattern.split(output_lines[i])
            container_details = {}
            if len(columns) > 1:
                for j in range(len(column_headers)):
                    container_details[column_headers[j]] = ''
                    if j <= len(columns) - 1:
                        container_details[column_headers[j]] = columns[j]
        # stupid hack for possible empty port column
                if container_details['PORTS'] and not container_details['NAMES']:
                    from copy import deepcopy
                    container_details['NAMES'] = deepcopy(container_details['PORTS'])
                    container_details['PORTS'] = ''
                container_list.append(container_details)
    
        return container_list
815358
def _process_table(self, cache=True):
        """"""
        table = self.source()
        assert not isinstance(table, None.__class__), \
            "{}.source needs to return something, not None".format(self.__class__.__name__)
        table = post_process(table, self.post_processors())
        if cache:
            self.to_cache(table)
        return table
1099573
def dp_from_ps(bk, pk, ps, pfull_coord):
    """"""
    return d_deta_from_phalf(phalf_from_ps(bk, pk, ps), pfull_coord)
243815
def load( self, stats ):
        """"""
        rows = self.rows
        for func, raw in stats.iteritems():
            try:
                rows[func] = row = PStatRow( func,raw )
            except ValueError, err:
                log.info( 'Null row: %s', func )
        for row in rows.itervalues():
            row.weave( rows )
        return self.find_root( rows )
1258580
function crop(data, rows, cols, nRows, nCols) {

    if (rows === nRows && cols === nCols) {
        //Do nothing. Returns the same input!!! Be careful
        return data;
    }

    var output = new Array(nCols * nRows);

    var shiftR = Math.floor((rows - nRows) / 2);
    var shiftC = Math.floor((cols - nCols) / 2);
    var destinyRow, sourceRow, i, j;
    for (i = 0; i < nRows; i++) {
        destinyRow = i * nCols;
        sourceRow = (i + shiftR) * cols;
        for (j = 0; j < nCols; j++) {
            output[destinyRow + j] = data[sourceRow + (j + shiftC)];
        }
    }

    return output;
}
554245
def _grains():
    '''
    
    '''
    client = _get_client()
    # This is a collection of the configuration of all running devices under NSO
    ret = client.get_datastore(DatastoreType.RUNNING)
    GRAINS_CACHE.update(ret)
    return GRAINS_CACHE
365448
def get_psm(line, unroll=False, specfncol=None):
    
    if specfncol is None:
        specfncol = mzidtsvdata.HEADER_SPECFILE
    specfn = line[specfncol]
    psm_id = get_psm_id(line)
    scan = line[mzidtsvdata.HEADER_SCANNR]
    peptideseq = get_psm_sequence(line, unroll)
    score = line[mzidtsvdata.HEADER_MSGFSCORE]
    return specfn, psm_id, scan, peptideseq, score
989239
def _select_ps(p):
    # There are more generic ways of doing this but profiling
    # revealed that selecting these points is one of the slow
    # things that is easy to change. This is about 11 times
    # faster than the generic algorithm it is replacing.
    #
    # it is possible that different break points could yield
    # better estimates, but the function this is refactoring
    # just used linear distance.
    """"""
    if p >= .99:
        return .990, .995, .999
    elif p >= .975:
        return .975, .990, .995
    elif p >= .95:
        return .950, .975, .990
    elif p >= .9125:
        return .900, .950, .975
    elif p >= .875:
        return .850, .900, .950
    elif p >= .825:
        return .800, .850, .900
    elif p >= .7625:
        return .750, .800, .850
    elif p >= .675:
        return .675, .750, .800
    elif p >= .500:
        return .500, .675, .750
    else:
        return .100, .500, .675
74601
def pverb(self, *args, **kwargs):
        
        if not self.verbose:
            return
        self.pstd(*args, **kwargs)