return dictionary mapping mode numbers to name, or None if unknown
486619
def mode_mapping_bynumber(mav_type):
    ''''''
    map = None
    if mav_type in [mavlink.MAV_TYPE_QUADROTOR,
                    mavlink.MAV_TYPE_HELICOPTER,
                    mavlink.MAV_TYPE_HEXAROTOR,
                    mavlink.MAV_TYPE_OCTOROTOR,
                    mavlink.MAV_TYPE_COAXIAL,
                    mavlink.MAV_TYPE_TRICOPTER]:
        map = mode_mapping_acm
    if mav_type == mavlink.MAV_TYPE_FIXED_WING:
        map = mode_mapping_apm
    if mav_type == mavlink.MAV_TYPE_GROUND_ROVER:
        map = mode_mapping_rover
    if mav_type == mavlink.MAV_TYPE_ANTENNA_TRACKER:
        map = mode_mapping_tracker
    if map is None:
        return None
    return map
755611
def parse_modes(params, mode_types=None, prefixes=''):
    
    # we don't accept bare strings because we don't want to try to do
    #   intelligent parameter splitting
    params = list(params)

    if params[0][0] not in '+-':
        raise Exception('first param must start with + or -')

    if mode_types is None:
        mode_types = ['', '', '', '']

    mode_string = params.pop(0)
    args = params

    assembled_modes = []
    direction = mode_string[0]
    for char in mode_string:
        if char in '+-':
            direction = char
            continue

        if (char in mode_types[0] or char in mode_types[1] or char in prefixes or
                (char in mode_types[2] and direction == '+') and len(args)):
            value = args.pop(0)
        else:
            value = None

        assembled_modes.append([direction, char, value])

    return assembled_modes
124771
def _get_wrhiercfg(self):
        """"""
        prtfmt = self.gosubdag.prt_attr['fmt']
        prtfmt = prtfmt.replace('{GO} # ', '')
        prtfmt = prtfmt.replace('{D1:5} ', '')
        return {'name2prtfmt':{'ITEM':prtfmt, 'ID':'{GO}{alt:1}'},
                'max_indent': self.usrdct.get('max_indent'),
                'include_only': self.usrdct.get('include_only'),
                'item_marks': self.usrdct.get('item_marks', {}),
                'concise_prt': 'concise' in self.usrset,
                'indent': 'no_indent' not in self.usrset,
                'dash_len': self.usrdct.get('dash_len', 6),
                'sortby': self.usrdct.get('sortby')
               }
176925
def make_mapping(args):
    """"""
    mapping = {}

    if args:
        for arg in args:
            name_value = arg.split('=', 1)
            mapping[name_value[0]] = (name_value[1]
                                      if len(name_value) > 1
                                      else None)

    return mapping
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
1172983
def modes(self):
        
        (self._modes, value) = self.get_cached_attr_set(self._modes, 'modes')
        return value
45771
def detect_mode(cls, **params):
        
        modes = []
        for mode in cls.modes:
            if params.get(mode) is not None:
                modes.append(mode)
        if len(modes) > 1:
            error_message = 'ambiguous mode, must be one of {}'
            modes_csv = ', '.join(list(cls.modes))
            raise ValueError(error_message.format(modes_csv))
        return modes[0] if modes else cls.default_mode
1243432
def nmltostring(nml):
    """"""
    if not isinstance(nml,dict):
      raise ValueError("nml should be a dict !")

    curstr = ""
    for key,group in nml.items():
       namelist = ["&" + key]
       for k, v in group.items():
         if isinstance(v, list) or isinstance(v, tuple):
           namelist.append(k + " = " + ",".join(map(str, v)) + ",")
         elif is_string(v):
           namelist.append(k + " = '" + str(v) + "',")
         else:
           namelist.append(k + " = " + str(v) + ",")
       namelist.append("/")

       curstr = curstr + "\n".join(namelist) + "\n"

    return curstr
1057601
def _map_arg_names(source, mapping):
        """"""
        return {cartopy_name: source[cf_name] for cartopy_name, cf_name in mapping
                if cf_name in source}
1217505
def available_modes(self):
        """"""
        if not self._available_modes:
            modes = self.available_modes_with_ids
            if not modes:
                return None
            self._available_modes = list(modes.keys())
        return self._available_modes
1012246
def _get_vi_mode(cli):
    """"""
    return {
        InputMode.INSERT: 'I',
        InputMode.NAVIGATION: 'N',
        InputMode.REPLACE: 'R',
        InputMode.INSERT_MULTIPLE: 'M'
    }[cli.vi_state.input_mode]
592598
def _router_numbers(self):
        """"""
        return tuple(up for up in self._up2down.keys()
                     if up in self._up2down.values())
1222453
def map(self, **kwargs):
        '''  '''
        return { key: str(self._envars[kwargs[key]])  # str strips Entry
                 for key in kwargs }
1153629
def get_mode(device):
    '''
    
    '''
    ret = {}
    cmd = 'quotaon -p {0}'.format(device)
    out = __salt__['cmd.run'](cmd, python_shell=False)
    for line in out.splitlines():
        comps = line.strip().split()
        if comps[3] not in ret:
            if comps[0].startswith('quotaon'):
                if comps[1].startswith('Mountpoint'):
                    ret[comps[4]] = 'disabled'
                    continue
                elif comps[1].startswith('Cannot'):
                    ret[device] = 'Not found'
                    return ret
                continue
            ret[comps[3]] = {
                'device': comps[4].replace('(', '').replace(')', ''),
            }
        ret[comps[3]][comps[0]] = comps[6]
    return ret
1134624
def parse_modes(modes, targets=None, noargs=''):
    
    if not targets:
        targets = []
    cleaned = []
    for mode in modes:
        if mode in '-+':
            char = mode
            continue
        target = targets.pop(0) if mode not in noargs else None
        cleaned.append((char, mode, target))
    return cleaned
669064
def reverse_code_map(self):
        """"""

        return {c.value: (c.ikey if c.ikey else c.key) for c in self.codes}
406709
def getMethName(meth):
    '''
    
    '''
    item = meth.__self__
    mname = item.__module__
    cname = item.__class__.__name__
    fname = meth.__func__.__name__
    return '.'.join((mname, cname, fname))