>>> get_shred_id("ca-bacs.5638.frag11.22000-23608")
    ("ca-bacs.5638", 11)
559972
def get_shred_id(id):
    
    try:
        parts = id.split(".")
        aid = ".".join(parts[:2])
        fid = int(parts[2].replace("frag", ""))
    except:
        aid, fid = None, None
    return aid, fid
94167
def _aix_get_machine_id():
    '''
    
    '''
    grains = {}
    cmd = salt.utils.path.which('lsattr')
    if cmd:
        data = __salt__['cmd.run']('{0} -El sys0'.format(cmd)) + os.linesep
        uuid_regexes = [re.compile(r'(?im)^\s*os_uuid\s+(\S+)\s+(.*)')]
        for regex in uuid_regexes:
            res = regex.search(data)
            if res and len(res.groups()) >= 1:
                grains['machine_id'] = res.group(1).strip()
                break
    else:
        log.error('The \'lsattr\' binary was not found in $PATH.')
    return grains
224862
def get_id(self, grp):
        
        thehash = hex(hash(grp))
        if ISPY3:  # use default encoding to get bytes
            thehash = thehash.encode()
        return self.cache.get(grp, hashlib.sha1(thehash).hexdigest())
29396
function rndid(len) {
  len = len || 8;
  const id = rndm(len);

  if (document.getElementById(id)) {
    return rndid(len);
  }

  return id;
}
154708
def to_id(self):
        
        return "%s%s%s%s%s" % (TraceId.VERSION, TraceId.DELIMITER,
                               format(self.start_time, 'x'),
                               TraceId.DELIMITER, self.__number)
1292929
def classify_identifier(did):
    
    if _is_unused_did(did):
        return 'unused on this Member Node'
    elif is_sid(did):
        return 'a Series ID (SID) of a revision chain'
    elif is_local_replica(did):
        return 'a Persistent ID (PID) of a local replica'
    elif is_unprocessed_local_replica(did):
        return (
            'a Persistent ID (PID) of an accepted but not yet processed local replica'
        )
    elif is_archived(did):
        return 'a Persistent ID (PID) of a previously archived local object'
    elif is_obsoleted(did):
        return 'a Persistent ID (PID) of a previously updated (obsoleted) local object'
    elif is_resource_map_db(did):
        return 'a Persistent ID (PID) of a local resource map'
    elif is_existing_object(did):
        return 'a Persistent ID (PID) of an existing local object'
    elif is_revision_chain_placeholder(did):
        return (
            'a Persistent ID (PID) of a remote or non-existing revision of a local '
            'replica'
        )
    elif is_resource_map_member(did):
        return (
            'a Persistent ID (PID) of a remote or non-existing object aggregated in '
            'a local Resource Map'
        )
    logger.warning('Unable to classify known identifier. did="{}"'.format(did))
    return '<UNKNOWN>'
899924
def current_id(self):
        
        try:
            cmd = ['git', 'rev-parse', '--short', 'HEAD']
            return self.sh(cmd,
                        shell=False,
                        ignore_error=True).rstrip()
        except subprocess.CalledProcessError as e:
            log.exception(e)
            #if e.returncode == 128  # bare repo
            return None
570216
def ascii2h5(dirname, output_fname):
    

    import tarfile
    import sys
    from glob import glob
    from contextlib import closing

    # The datatype that will be used to store extinction, A0
    A0_dtype = 'float16'

    def load_samp_file(f, fname):
        # Parse filename
        fname_chunks = os.path.split(fname)[1].split('_')
        l = float(fname_chunks[0])
        b = float(fname_chunks[1])

        # Load ASCII data
        data_raw = np.loadtxt(f, dtype='float64')

        n_samples = data_raw.shape[1] - 1
        n_dists = data_raw.shape[0]

        # Construct output
        dtype = [
            ('dist', 'int32'),
            ('A0', A0_dtype, (n_samples,))]

        data = np.empty(n_dists, dtype=dtype)
        data['dist'][:] = data_raw[:,0]
        data['A0'][:,:] = data_raw[:,1:]

        return (l,b), data

    def process_tarball(tarball_fname):
        # Write to the progress bar
        print('.', end='')
        sys.stdout.flush()

        with closing(tarfile.open(tarball_fname, mode='r:gz')) as f_tar:
            fnames = f_tar.getnames()

            f = f_tar.extractfile(fnames[0])
            (l,b), data = load_samp_file(f, fnames[0])
            n_dists, n_samples = data['A0'].shape
            n_coords = len(fnames)

            dtype = [
                ('l', 'float32'),
                ('b', 'float32'),
                ('dist', 'int32', (n_dists,)),
                ('A0', A0_dtype, (n_dists, n_samples))]
            data_combined = np.empty(n_coords, dtype=dtype)

            for k,fn in enumerate(fnames):
                # print('File {: >4d} of {:d}'.format(k+1, n_coords))
                f = f_tar.extractfile(fn)
                (l,b), data = load_samp_file(f, fn)
                data_combined['l'][k] = l
                data_combined['b'][k] = b
                data_combined['dist'][k] = data['dist']
                data_combined['A0'][k] = data['A0']

        return data_combined

    def save_data(data, fname):
        with closing(h5py.File(fname, 'w')) as f:
            f.create_dataset(
                'samples',
                data=data,
                chunks=True,
                compression='gzip',
                compression_opts=3)

    print('Progress: ', end='')
    sys.stdout.flush()

    tar_fname_list = glob(os.path.join(dirname, 'A_samp_*.tar.gz'))
    d = np.hstack([process_tarball(fn) for fn in tar_fname_list])

    print('+', end='')
    sys.stdout.flush()

    save_data(d, output_fname)

    print('')
533502
def retrieve(run_id, det_id, outfile=None):
    """"""
    try:
        det_id = int(det_id)
    except ValueError:
        pass
    path = irods_filepath(det_id, run_id)
    suffix = '' if outfile is None else outfile
    os.system("iget -Pv {0} {1}".format(path, suffix))
1373076
def version_id(self):
        
        return hashlib.sha1('{0}__{1}'.format(
            self.id, self.updated).encode('utf-8')).hexdigest()
997515
def cred_def_id2seq_no(cd_id: str) -> int:
    

    if ok_cred_def_id(cd_id):
        return int(cd_id.split(':')[3])  # sequence number is token at 0-based position 3
    raise BadIdentifier('Bad credential definition identifier {}'.format(cd_id))
1305426
private static Integer getFreeId()
    {
        if (!RECYCLE.isEmpty())
        {
            final Integer id = RECYCLE.poll();
            IDS.add(id);
            return id;
        }
        if (IDS.size() == Integer.MAX_VALUE)
        {
            throw new LionEngineException(ERROR_FREE_ID);
        }
        Integer id;
        while (IDS.contains(id = Integer.valueOf(lastId))) // CHECKSTYLE IGNORE LINE: TrailingComment|InnerAssignment
        {
            lastId++;
        }
        IDS.add(id);
        return id;
    }
1207996
public static String get2BitCrid(String str) {
         if (str != null) {
             String crid = LookupCodes.lookupCode("CRID", str, "DSSAT");
             if (crid.equals(str) && crid.length() > 2) {
                 crid = def2BitVal;
             }
            return crid.toUpperCase();
        } else {
            return def2BitVal;
        }
//        if (str == null) {
//            return def2BitVal;
//        } else if (str.length() == 2) {
//            return str;
//        }
//        String ret = crids.get(str);
//        if (ret == null || ret.equals("")) {
//            return str;
//        } else {
//            return ret;
//        }
    }
966966
def did_to_id_bytes(did):
    
    if isinstance(did, str):
        if re.match('^[0x]?[0-9A-Za-z]+$', did):
            raise ValueError(f'{did} must be a DID not a hex string')
        else:
            did_result = did_parse(did)
            if not did_result:
                raise ValueError(f'{did} is not a valid did')
            if not did_result['id']:
                raise ValueError(f'{did} is not a valid ocean did')
            id_bytes = Web3.toBytes(hexstr=did_result['id'])
    elif isinstance(did, bytes):
        id_bytes = did
    else:
        raise TypeError(
            f'Unknown did format, expected str or bytes, got {did} of type {type(did)}')
    return id_bytes
990326
function getCardId(o) {
  return o.master + '#' + o.combination.front.join(',') + '@' + o.combination.back.join(',');
}
1027180
public static function getDummyId() {
    return 'wcmf'.md5(uniqid(ip2long(@$_SERVER['REMOTE_ADDR']) ^ (int)@$_SERVER['REMOTE_PORT'] ^ @getmypid() ^ @disk_free_space(sys_get_temp_dir()), 1));
  }
644781
def get_partition_id(self, key):
        
        data = self._client.serialization_service.to_data(key)
        count = self.get_partition_count()
        if count <= 0:
            return 0
        return hash_to_index(data.get_partition_hash(), count)