Return the old code id to construct a old decoder
162423
private String getOldCodeId(FileStatus srcStat ) throws IOException {
    if (codec.id.equals("xor") || codec.id.equals("rs")) {
      return codec.id;
    } else {
      // Search for xor/rs parity files
      if (ParityFilePair.getParityFile(
        Codec.getCodec("xor"), srcStat, this.conf) != null)
        return "xor";
      if (ParityFilePair.getParityFile(
        Codec.getCodec("rs"), srcStat, this.conf) != null)
        return "rs";
    }
    return null;
  }
400542
private MethodCode getDecodeMethodCode() {
        MethodCode mc = new MethodCode();
        mc.setName("decode");
        mc.setScope(ClassCode.SCOPE_PUBLIC);
        mc.setReturnType(ClassHelper.getInternalName(cls.getCanonicalName()));
        mc.addParameter("byte[]", "bb");
        mc.addException("IOException");

        // add method code
        mc.appendLineCode1("CodedInputStream input = CodedInputStream.newInstance(bb, 0, bb.length)");

        getParseBytesMethodCode(mc);

        return mc;
    }
476180
def default_filename_decoder():
    
    factory = default_filename_grammar_factory()

    grammar_old = factory.get_rule('filename_old')
    grammar_new = factory.get_rule('filename_new')

    return FileNameDecoder(grammar_old, grammar_new)
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
189809
def GetDecoder(cls, encoding_method):
    
    encoding_method = encoding_method.lower()
    decoder = cls._decoders.get(encoding_method, None)
    if not decoder:
      return None

    return decoder()
904066
def _decode_module_id(self, module_id):
        
        name = [''] * 9
        module_id >>= 10
        for i in reversed(range(9)):
            name[i] = self.charset[module_id & 63]
            module_id >>= 6
        return ''.join(name)
645594
def _id_remapper(orig, new):
    
    new_chrom_to_index = {}
    for i_n, (chr_n, _) in enumerate(new):
        new_chrom_to_index[chr_n] = i_n
    remap_indexes = {}
    for i_o, (chr_o, _) in enumerate(orig):
        if chr_o in new_chrom_to_index.keys():
            remap_indexes[i_o] = new_chrom_to_index[chr_o]
    remap_indexes[None] = None
    return remap_indexes
207756
def decode(self, offset):
        
        new_offset = offset + 1
        (ctrl_byte,) = struct.unpack(b'!B', self._buffer[offset:new_offset])
        type_num = ctrl_byte >> 5
        # Extended type
        if not type_num:
            (type_num, new_offset) = self._read_extended(new_offset)

        (size, new_offset) = self._size_from_ctrl_byte(
            ctrl_byte, new_offset, type_num)
        return self._type_decoder[type_num](self, size, new_offset)
622164
def get_old_value(self, args, kwargs, default=None):
        # type: (List[Any], Dict[str, Any], Any) -> Any
        
        if self.arg_pos is not None and len(args) > self.arg_pos:
            return args[self.arg_pos]
        else:
            return kwargs.get(self.name, default)
490367
def reverse_compl_with_name(old_seq):
    """"""
    new_seq = old_seq.reverse_complement()
    new_seq.id = old_seq.id
    new_seq.description = old_seq.description
    return new_seq
625003
def _get_code(self, key):
        

        data = self.grid.code_array(key)
        self.grid.code_array.result_cache.clear()

        return data
1285775
def make_code_obsolete(code):
    
    fs = FileSystem(code=code)
    if os.path.exists(fs.parent_dir):
        # Move to obsolete folder
        destination_dir = os.path.join(fs._data_dir, 'obsolete', code[1:3], code)
        if os.path.exists(destination_dir):
            shutil.rmtree(destination_dir)
        shutil.move(fs.parent_dir, destination_dir)

        # Remove containing (two-letter) folder if empty, else pass.
        two_letter_dir = os.path.dirname(fs.parent_dir)
        try:
            os.rmdir(two_letter_dir)
        except OSError:
            pass

    return
323385
def with_code(self, code):
        
        self.code = code if code != None else 'UNKNOWN'
        self.name = code
        return self
841477
def _decoder(self, obj):
        
        if '__class__' in obj:
            elem = eval(obj['__class__'])()
            elem.ident = obj['ident']
            elem.group = str(obj['group'])
            elem.name = str(obj['name'])
            elem.ctype = str(obj['ctype'])
            elem.pytype = str(obj['pytype'])
            elem.access = obj['access']
            return elem
        return obj
1364246
def decode(self, ids, strip_extraneous=False):
    
    if strip_extraneous:
      ids = strip_ids(ids, list(range(self._num_reserved_ids or 0)))
    return unicode_to_native(
        tokenizer.decode(self._subtoken_ids_to_tokens(ids)))
899377
def _create_old_return_value(payload, num_ints, buff):
    """"""

    parsed = {'ints': payload[:num_ints], 'buffer': None, 'error': 'No Error',
              'is_error': False, 'return_value': 0}

    if buff:
        parsed['buffer'] = bytearray(payload[-1])

    return parsed
383680
def _slice_replace(code, index, old, new):
        """"""
        nodes = [str(node) for node in code.get(index)]
        substring = "".join(nodes).replace(old, new)
        code.nodes[index] = parse_anything(substring).nodes