Get the possible nick prefixes and associated modes for a client.
966115
def _get_prefixes(self):
        """"""
        prefixes = {
            "@": "o",
            "+": "v",
        }
        feature_prefixes = self.server.features.get('PREFIX')
        if feature_prefixes:
            modes = feature_prefixes[1:len(feature_prefixes)//2]
            symbols = feature_prefixes[len(feature_prefixes)//2+1:]
            prefixes = dict(zip(symbols, modes))
        return prefixes
106328
def get_join_info():
    '''
    
    '''
    info = win32net.NetGetJoinInformation()
    status = {win32netcon.NetSetupUnknown: 'Unknown',
              win32netcon.NetSetupUnjoined: 'Unjoined',
              win32netcon.NetSetupWorkgroupName: 'Workgroup',
              win32netcon.NetSetupDomainName: 'Domain'}
    return {'Domain': info[0],
            'DomainType': status[info[1]]}
1315936
def _parse_nick(client, command, actor, args):
    
    old_nick, _, _ = actor.partition('!')
    new_nick = args

    if old_nick == client.user.nick:
        client.user.nick = new_nick

    modified_channels = set()
    for channel in client.server.channels.itervalues():
        user = channel.members.get(old_nick)
        if user:
            user.nick = new_nick
            channel.members[new_nick] = user
            del channel.members[old_nick]
            modified_channels.add(channel.name)

    client.dispatch_event("NICK", old_nick, new_nick)
    for channel in modified_channels:
        client.dispatch_event("MEMBERS", channel)
1150573
def _get_nr_prefix(i):
    
    for lookup_range, prefix_string in _nr_prefix_strings.items():
        if i in lookup_range:
            return prefix_string
    raise ValueError("No prefix string associated with {0}!".format(i))
1275845
def server_and_prefix(self):
        """"""
        return(host_port_prefix(self.config.host, self.config.port, self.prefix))
742428
def get_domainaliases(self, domainid, page=None):
        """"""
        opts = {}
        if page:
            opts['page'] = page
        return self.api_call(
            ENDPOINTS['domainaliases']['list'],
            dict(domainid=domainid), **opts)
404431
def unique_prefixes(context):
    
    res = {}
    for m in context.modules.values():
        if m.keyword == "submodule": continue
        prf = new = m.i_prefix
        suff = 0
        while new in res.values():
            suff += 1
            new = "%s%x" % (prf, suff)
        res[m] = new
    return res
1039641
def keys_info(cls, fqdn, key):
        """"""
        return cls.json_get('%s/domains/%s/keys/%s' %
                            (cls.api_url, fqdn, key))
992563
def lookup(self, nick):
        """"""
        query = dict(nick=nick)
        order = [('time', pymongo.DESCENDING)]
        recs = self.db.pastes.find(query).sort(order).limit(1)
        try:
            return next(recs)['uid']
        except StopIteration:
            pass
913929
def list_nictags(include_etherstubs=True):
    '''
    
    '''
    ret = {}
    cmd = 'nictagadm list -d "|" -p{0}'.format(
        ' -L' if not include_etherstubs else ''
    )
    res = __salt__['cmd.run_all'](cmd)
    retcode = res['retcode']
    if retcode != 0:
        ret['Error'] = res['stderr'] if 'stderr' in res else 'Failed to get list of nictags.'
    else:
        header = ['name', 'macaddress', 'link', 'type']
        for nictag in res['stdout'].splitlines():
            nictag = nictag.split('|')
            nictag_data = {}
            for field in header:
                nictag_data[field] = nictag[header.index(field)]
            ret[nictag_data['name']] = nictag_data
            del ret[nictag_data['name']]['name']
    return ret
562671
def get_cert_profile_kwargs(name=None):
    """"""

    if name is None:
        name = ca_settings.CA_DEFAULT_PROFILE

    profile = deepcopy(ca_settings.CA_PROFILES[name])
    kwargs = {
        'cn_in_san': profile['cn_in_san'],
        'subject': get_default_subject(name=name),
    }

    key_usage = profile.get('keyUsage')
    if key_usage and key_usage.get('value'):
        kwargs['key_usage'] = KeyUsage(key_usage)
    ext_key_usage = profile.get('extendedKeyUsage')
    if ext_key_usage and ext_key_usage.get('value'):
        kwargs['extended_key_usage'] = ExtendedKeyUsage(ext_key_usage)
    tls_feature = profile.get('TLSFeature')
    if tls_feature and tls_feature.get('value'):
        kwargs['tls_feature'] = TLSFeature(tls_feature)
    if profile.get('ocsp_no_check'):
        kwargs['ocsp_no_check'] = profile['ocsp_no_check']

    return kwargs
728996
def get_prefix(dir="../"):
    
    prefix = glob(dir + "*.gkpStore")[0]
    prefix = op.basename(prefix).rsplit(".", 1)[0]

    return prefix
61397
def regenerate_prefixes(self, *args):
        """"""
        nick = self.controller.client.user.nick
        self.prefixes = set([
            nick + ": ",
            nick + ", ",
            nick + " - ",
        ])
        # Include lower-case versions as well, but not caps
        self.prefixes.update([p.lower() for p in self.prefixes])
        if self.sigil:
            self.prefixes.add(self.sigil)
201693
def get_api_key_with_prefix(self, identifier):
        
        if self.api_key.get(identifier) and self.api_key_prefix.get(identifier):
            return self.api_key_prefix[identifier] + ' ' + self.api_key[identifier]
        elif self.api_key.get(identifier):
            return self.api_key[identifier]
513430
def _parse_current_network_settings():
    '''
    
    '''
    opts = salt.utils.odict.OrderedDict()
    opts['networking'] = ''

    if os.path.isfile(_DEB_NETWORKING_FILE):
        with salt.utils.files.fopen(_DEB_NETWORKING_FILE) as contents:
            for line in contents:
                salt.utils.stringutils.to_unicode(line)
                if line.startswith('#'):
                    continue
                elif line.startswith('CONFIGURE_INTERFACES'):
                    opts['networking'] = line.split('=', 1)[1].strip()

    hostname = _parse_hostname()
    domainname = _parse_domainname()
    searchdomain = _parse_searchdomain()

    opts['hostname'] = hostname
    opts['domainname'] = domainname
    opts['searchdomain'] = searchdomain
    return opts
599050
def nickmask(prefix: str, kwargs: Dict[str, Any]) -> None:
    
    if "!" in prefix and "@" in prefix:
        # From a user
        kwargs["nick"], remainder = prefix.split("!", 1)
        kwargs["user"], kwargs["host"] = remainder.split("@", 1)
    else:
        # From a server, probably the host
        kwargs["host"] = prefix
69629
def get_nic_hwaddr(nic):
    """"""
    cmd = ['ip', '-o', '-0', 'addr', 'show', nic]
    ip_output = subprocess.check_output(cmd).decode('UTF-8')
    hwaddr = ""
    words = ip_output.split()
    if 'link/ether' in words:
        hwaddr = words[words.index('link/ether') + 1]
    return hwaddr