Backport support for original codes.
765730
def get(key, default=-1):
        """"""
        if isinstance(key, int):
            return RegistrationFailure(key)
        if key not in RegistrationFailure._member_map_:
            extend_enum(RegistrationFailure, key, default)
        return RegistrationFailure[key]
644539
function _rCallback (cb) {
        return function (err, res, data) {
            if (err) return cb(err);
            if (!res || res.statusCode > 400) return cb(data);

            cb(null, data);
        };
    }
1234068
def _build_codes_reverse(
        codes: Dict[str, Dict[str, str]]) -> Dict[str, Dict[str, str]]:
    
    built = {}  # type: Dict[str, Dict[str, str]]
    for codetype, codemap in codes.items():
        for name, escapecode in codemap.items():
            # Skip shorcut aliases to avoid overwriting long names.
            if len(name) < 2:
                continue
            if built.get(codetype, None) is None:
                built[codetype] = {}
            built[codetype][escapecode] = name
    return built
257038
def get(key, default=-1):
        """"""
        if isinstance(key, int):
            return ErrorCode(key)
        if key not in ErrorCode._member_map_:
            extend_enum(ErrorCode, key, default)
        return ErrorCode[key]
669465
def backend_from_mime(mime):
    """"""
    try:
        mod_name = MIMETYPE_TO_BACKENDS[mime]

    except KeyError:
        msg = "No handler for %r, defaulting to %r" % (mime, DEFAULT_MIME)
        if 'FULLTEXT_TESTING' in os.environ:
            warn(msg)
        else:
            LOGGER.debug(msg)

        mod_name = MIMETYPE_TO_BACKENDS[DEFAULT_MIME]
    mod = import_mod(mod_name)
    return mod
600843
def get_backend_init_list(backend_vals):
    """"""
    cmd_list = []
    for (key, val) in backend_vals.items():
        cmd_list.append('-backend-config')
        cmd_list.append(key + '=' + val)
    return cmd_list
115505
def get(key, default=-1):
        """"""
        if isinstance(key, int):
            return Checksum(key)
        if key not in Checksum._member_map_:
            extend_enum(Checksum, key, default)
        return Checksum[key]
45805
def new_code_block(self, **kwargs):
        """"""
        proto = {'content': '',
                 'type': self.code,
                 'IO': '',
                 'attributes': ''}
        proto.update(**kwargs)
        return proto
1232354
def disco(self, code, lasti=-1, file=None):
        """"""
        return _disco(self.python_version, code, timestamp=0,
                      out=file, is_pypy=self.is_pypy, header=False)
977096
def code(self, code=None, ret_r=False):
        '''
        
        '''
        if code or ret_r:
            self._code = code
            return self
        return self._code
280692
def compile_rich(cls, code, path=None, extra_args=None):
        """"""

        return {
            contract_name: {
                'code': '0x' + contract.get('bin_hex'),
                'info': {
                    'abiDefinition': contract.get('abi'),
                    'compilerVersion': cls.compiler_version(),
                    'developerDoc': contract.get('devdoc'),
                    'language': 'Solidity',
                    'languageVersion': '0',
                    'source': code,
                    'userDoc': contract.get('userdoc')
                },
            }
            for contract_name, contract
            in cls.combined(code, path=path, extra_args=extra_args)
        }
461674
def _build_codes() -> Dict[str, Dict[str, str]]:
    
    built = {
        'fore': {},
        'back': {},
        'style': {},
    }  # type: Dict[str, Dict[str, str]]

    # Set codes for forecolors (30-37) and backcolors (40-47)
    # Names are given to some of the 256-color variants as 'light' colors.
    for name, number in _namemap:
        # Not using format_* functions here, no validation needed.
        built['fore'][name] = codeformat(30 + number)
        built['back'][name] = codeformat(40 + number)
        litename = 'light{}'.format(name)  # type: str
        built['fore'][litename] = codeformat(90 + number)
        built['back'][litename] = codeformat(100 + number)

    # Set reset codes for fore/back.
    built['fore']['reset'] = codeformat(39)
    built['back']['reset'] = codeformat(49)

    # Set style codes.
    for code, names in _stylemap:
        for alias in names:
            built['style'][alias] = codeformat(code)

    # Extended (256 color codes)
    for i in range(256):
        built['fore'][str(i)] = extforeformat(i)
        built['back'][str(i)] = extbackformat(i)

    return built
291807
def get_grp2codes(self):
        """"""
        grp2codes = cx.defaultdict(set)
        for code, ntd in self.code2nt.items():
            grp2codes[ntd.group].add(code)
        return dict(grp2codes)
789403
def init_backends():
    """"""

    global _BACKENDS, _ACTIVE_BACKENDS

    try:
        from .cffi_backend import CFFIBackend
    except ImportError:
        pass
    else:
        _BACKENDS.append(CFFIBackend)

    from .ctypes_backend import CTypesBackend
    from .null_backend import NullBackend

    _BACKENDS.append(CTypesBackend)
    _ACTIVE_BACKENDS = _BACKENDS[:]
    # null isn't active by default
    _BACKENDS.append(NullBackend)
877653
def get_modifier_mapping(self):
        """"""
        r = request.GetModifierMapping(display = self.display)
        return r.keycodes
49218
def scan_used_functions(example_file, gallery_conf):
    """"""
    example_code_obj = identify_names(example_file)
    if example_code_obj:
        codeobj_fname = example_file[:-3] + '_codeobj.pickle.new'
        with open(codeobj_fname, 'wb') as fid:
            pickle.dump(example_code_obj, fid, pickle.HIGHEST_PROTOCOL)
        _replace_md5(codeobj_fname)

    backrefs = set('{module_short}.{name}'.format(**entry)
                   for entry in example_code_obj.values()
                   if entry['module'].startswith(gallery_conf['doc_module']))

    return backrefs
1111187
def get(key, default=-1):
        """"""
        if isinstance(key, int):
            return TOS_REL(key)
        if key not in TOS_REL._member_map_:
            extend_enum(TOS_REL, key, default)
        return TOS_REL[key]