:param prefix: sd|vd|xvd
970425
def unix_partition(self, prefix=None):
        
        path = self.unix_device(prefix=prefix)
        path += str(self.random_digit())
        return path
297544
def prefix(self, keys):
        
        assert isinstance(keys, tuple)

        self._prefix = keys
        self._load_prefix_binding()
1171740
def add_prefix(prefix, s):
    ""
    # tokenize the XPath expression
    toks = xpath_lexer.scan(s)
    # add default prefix to unprefixed names
    toks2 = [_add_prefix(prefix, tok) for tok in toks]
    # build a string of the patched expression
    ls = [x.value for x in toks2]
    return ''.join(ls)
325095
def set_prefix(self, elt, pyobj):
        '''
        '''
        if isinstance(pyobj, tuple):
            namespaceURI,localName = pyobj
            self.prefix = elt.getPrefix(namespaceURI)
814472
def parse_prefix(identifier):
    
    pf, id = (), identifier
    if "|" in identifier:
        pf, id = tuple(identifier.split('|')[:-1]), identifier.split('|')[-1]

    return pf, id
848805
def _allKeys(self, prefix):
        
        global dictItemsIter
        result = [prefix + self.key] if self.key != None else []
        for key, trie in dictItemsIter(self.slots):        
            result.extend(trie._allKeys(prefix + key))        
        return result
303132
def unix_device(self, prefix=None):
        
        prefix = prefix or self.random_element(self.unix_device_prefixes)
        suffix = self.random_element(string.ascii_lowercase)
        path = '/dev/%s%s' % (prefix, suffix)
        return path
102070
def split_prefix(var, prefix)

      if prefix.nil?
        m = VAR_PREFIX_REGEX.match(var.to_s)
        prefix = m[1]
        var = m[2]
      end

      [ var, prefix ]
    end
1076510
def common_prefix(s1, s2):
    ""
    if not s1 or not s2:
        return ""
    k = 0
    while s1[k] == s2[k]:
        k = k + 1
        if k >= len(s1) or k >= len(s2):
            return s1[0:k]
    return s1[0:k]
1205955
def mounts(prefix, __mounts):
    
    i = 0
    mntpoints = []
    for mount in __mounts:
        if not isinstance(mount, dict):
            mntpoint = "{0}/{1}".format(prefix, str(i))
            mntpoints.append(mntpoint)
            i = i + 1
    return mntpoints
1058247
def get_pairtree_prefix(pairtree_store):
    """"""
    prefix_path = os.path.join(pairtree_store, 'pairtree_prefix')
    with open(prefix_path, 'r') as prefixf:
        prefix = prefixf.read().strip()
    return prefix
1238407
def delete_prefix(self, key_prefix):
        """"""
        return self.delete(
            key_prefix, range_end=_encode(_increment_last_byte(key_prefix)))
657163
def prefix_attr_add(arg, opts, shell_opts):
    

    spec = { 'prefix': arg }
    v = get_vrf(opts.get('vrf_rt'), abort=True)
    spec['vrf_rt'] = v.rt

    res = Prefix.list(spec)
    if len(res) == 0:
        print("Prefix %s not found in %s." % (arg, vrf_format(v)), file=sys.stderr)
        return

    p = res[0]

    for avp in opts.get('extra-attribute', []):
        try:
            key, value = avp.split('=', 1)
        except ValueError:
            print("ERROR: Incorrect extra-attribute: %s. Accepted form: 'key=value'\n" % avp, file=sys.stderr)
            sys.exit(1)

        if key in p.avps:
            print("Unable to add extra-attribute: '%s' already exists." % key, file=sys.stderr)
            sys.exit(1)

        p.avps[key] = value

    try:
        p.save()
    except NipapError as exc:
        print("Could not save prefix changes: %s" % str(exc), file=sys.stderr)
        sys.exit(1)

    print("Prefix %s in %s saved." % (p.display_prefix, vrf_format(p.vrf)))
991628
def sys_prefix(self):
        

        command = [self.python, "-c" "import sys; print(sys.prefix)"]
        c = vistir.misc.run(command, return_object=True, block=True, nospin=True, write_to_stdout=False)
        sys_prefix = vistir.compat.Path(vistir.misc.to_text(c.out).strip()).as_posix()
        return sys_prefix
382868
def prefix_fragment(self, nid):
        
        sep=':'
        if nid.startswith('http'):
            if '#' in nid:
               sep='#'
            else:
                sep='/'
        parts = nid.split(sep)
        frag = parts.pop()
        prefix = sep.join(parts)
        return prefix, frag
1373546
def add_prefix(self, prefix, flags, prf):
        
        self._req('prefix add %s %s %s' % (prefix, flags, prf))
        time.sleep(1)
        self._req('netdataregister')
368098
def opt_strip(prefix, opts):
    

    ret = {}
    for opt_name, opt_value in opts.items():
        # remove prefix
        if opt_name.startswith(prefix):
            opt_name = opt_name[len(prefix):]

        ret[opt_name] = opt_value

    return ret