\
    Returns the mode name for the provided mode constant.

    :param int mode_const: The mode constant (see :py:module:`segno.consts`)
321336
def get_mode_name(mode_const):
    
    for name, val in consts.MODE_MAPPING.items():
        if val == mode_const:
            return name
    raise ModeError('Unknown mode "{0}"'.format(mode_const))
829010
def get_keybindings(self, mode):
        
        globalmaps, modemaps = {}, {}
        bindings = self._bindings
        # get bindings for mode `mode`
        # retain empty assignations to silence corresponding global mappings
        if mode in bindings.sections:
            for key in bindings[mode].scalars:
                value = bindings[mode][key]
                if isinstance(value, list):
                    value = ','.join(value)
                modemaps[key] = value
        # get global bindings
        # ignore the ones already mapped in mode bindings
        for key in bindings.scalars:
            if key not in modemaps:
                value = bindings[key]
                if isinstance(value, list):
                    value = ','.join(value)
                if value and value != '':
                    globalmaps[key] = value
        # get rid of empty commands left in mode bindings
        for k, v in list(modemaps.items()):
            if not v:
                del modemaps[k]

        return globalmaps, modemaps
1011002
def get_name(self, func):
        '''
        
        '''
        if hasattr(func, 'name'):
            return func.name

        return '%s.%s' % (
            func.__module__,
            func.__name__
        )
200685
def cmd_mode(self, args):
        ''''''
        mode_mapping = self.master.mode_mapping()
        if mode_mapping is None:
            print('No mode mapping available')
            return
        if len(args) != 1:
            print('Available modes: ', mode_mapping.keys())
            return
        if args[0].isdigit():
            modenum = int(args[0])
        else:
            mode = args[0].upper()
            if mode not in mode_mapping:
                print('Unknown mode %s: ' % mode)
                return
            modenum = mode_mapping[mode]
        self.master.set_mode(modenum)
62394
def _get_const_info(const_index, const_list):
    
    argval = const_index
    if const_list is not None:
        argval = const_list[const_index]

    # float values nan and inf are not directly representable in Python at least
    # before 3.5 and even there it is via a library constant.
    # So we will canonicalize their representation as float('nan') and float('inf')
    if isinstance(argval, float) and str(argval) in frozenset(['nan', '-nan', 'inf', '-inf']):
        return argval, "float('%s')" % argval
    return argval, repr(argval)
1133260
protected static function buildEscapeCodes($mode_texts) {
    if (!is_array($mode_texts)) { $mode_texts = array($mode_texts); }

    $code_text = '';
    foreach ($mode_texts as $mode) {
      $constant_name = 'self::CONSOLE_'.strtoupper($mode);
      if (defined($constant_name)) {
        $code_text .= (strlen($code_text) ? ';': '').constant($constant_name);
      }
    }

    return chr(27)."[0;".$code_text."m";
  }
822887
def look_up_const(maudule = Duxml)
      mod_names = name.split(':')
      until mod_names.empty?
        k = mod_names.shift.constantize
        case
          when maudule.const_defined?(k, true)
          when Module.const_defined?(simple_class, true)
            k = simple_class
          else
            return nil
        end
        const = maudule.const_get(k)
        if const.is_a?(Module)
          maudule = const
        end

        return const if mod_names.empty? and [Module, Class].include?(const.class)
      end
      nil
    end
671401
def qualified_name(self):
        ''''''
        return '{0}.{1}#{2}'.format(self.module.name, self.enum.name, self.name)
569107
def get_module_name(module: types.ModuleType) -> str:
    
    try:
        return module.__spec__.name
    except AttributeError:
        return module.__name__
930298
def config_string(self):
        
        return (gc.CONFIG_STRING_SEPARATOR_SYMBOL).join(
            [u"%s%s%s" % (fn, gc.CONFIG_STRING_ASSIGNMENT_SYMBOL, self.data[fn]) for fn in sorted(self.data.keys()) if self.data[fn] is not None]
        )
508807
def const_name
      components = name.gsub(/\W/,' ').split.collect {|word| word.strip.upcase }
      components.join '_'
    end
31025
def code_constants(self):
        
        # TODO: remove link register values
        return [const.value for block in self.blocks for const in block.vex.constants]
448607
def _get_type_name(type_):
    # type: (type) -> str
    
    name = repr(type_)
    if name.startswith("<"):
        name = getattr(type_, "__qualname__", getattr(type_, "__name__", ""))
    return name.rsplit(".", 1)[-1] or repr(type_)
6400
def defconfig_filename(self):
        
        if self.defconfig_list:
            for filename, cond in self.defconfig_list.defaults:
                if expr_value(cond):
                    try:
                        with self._open_config(filename.str_value) as f:
                            return f.name
                    except IOError:
                        continue

        return None
26019
def _extract_constants(self, specification):
        
        constants = {}

        for attribute in specification.attributes:

            if attribute.allowed_choices and len(attribute.allowed_choices) > 0:

                name = attribute.local_name.upper()

                for choice in attribute.allowed_choices:
                    constants["CONST_%s_%s" % (name, choice.upper())] = choice

        return constants
1229102
public function getOptionNameFromDefinition($constant_name)
    {
        if ($this->strStartsWith($constant_name, "'") && $this->strEndsWith($constant_name, "'")) {
            return trim(trim($constant_name, "'")); // single quote
        } else {
            if ($this->strStartsWith($constant_name, '"') && $this->strEndsWith($constant_name, '"')) {
                return trim(trim($constant_name, '"')); // double quote
            } else {
                return $constant_name;
            }
        }
    }
1029449
def ENUM_CONSTANT_DECL(self, cursor):
        """"""
        name = cursor.displayname
        value = cursor.enum_value
        pname = self.get_unique_name(cursor.semantic_parent)
        parent = self.get_registered(pname)
        obj = typedesc.EnumValue(name, value, parent)
        parent.add_value(obj)
        return obj