Decodes our custom extension types
543107
def ext_hook(self, code, data):
        
        if code == self.EXT_DATETIME:
            # Unpack datetime object from a big-endian signed 64-bit integer.
            microseconds = self.STRUCT_DATETIME.unpack(data)[0]
            return datetime.datetime.utcfromtimestamp(microseconds / 1000000.0)
        elif code == self.EXT_DATE:
            # Unpack local-date object from a big-endian unsigned short and two big-endian unsigned chars
            return datetime.date(*self.STRUCT_DATE.unpack(data))
        elif code == self.EXT_TIME:
            # Unpack a dateless-time object from three big-endian unsigned chars and a big-endian unsigned
            # 32-bit integer.
            return datetime.time(*self.STRUCT_TIME.unpack(data))
        elif code == self.EXT_DECIMAL:
            obj_len = self.STRUCT_DECIMAL_LENGTH.unpack(data[:2])[0]
            obj_decoder = struct.Struct(str('!{}s'.format(obj_len)))
            return decimal.Decimal(obj_decoder.unpack(data[2:])[0].decode('utf-8'))
        elif code == self.EXT_CURRINT:
            # Unpack Amount object into (code, minor) from a 3-char ASCII string and a signed 64-bit integer.
            code, minor_value = self.STRUCT_CURRINT.unpack(data)
            return currint.Amount.from_code_and_minor(code.decode('ascii'), minor_value)
        else:
            raise TypeError('Cannot decode unknown extension type {} from MessagePack'.format(code))
621012
public String convertExtensionToMediaType(String extension) {
        ProvFormat format = extensionRevMap.get(extension);
        if (format == null)
            return null;
        return mimeTypeMap.get(format);
    }
698490
function decode(s) {
    if (s) {
        s = s.toString().replace(re.pluses, '%20');
        s = decodeURIComponent(s);
    }
    return s;
  }
1038886
def parse_object_type_extension(lexer: Lexer) -> Node:
    """"""
    start = lexer.token
    expect_keyword(lexer, "extend")
    expect_keyword(lexer, "type")
    name = parse_name(lexer)
    interfaces = parse_implements_interfaces(lexer)
    directives = parse_directives(lexer, True)
    fields = parse_fields_definition(lexer)
    if not (interfaces or directives or fields):
        raise unexpected(lexer)
    return Node(
        name=name,
        interfaces=interfaces,
        directives=directives,
        fields=fields,
        loc=loc(lexer, start),
    )
516058
function get_extension($type)
    {
        $type = strtolower($type);
        foreach ($this->mime_types as $ext => $m_type) {
            if ($m_type == $type) return $ext;
        }
        return false;
    }
739761
private void readDoctype(boolean saveDtdText) throws IOException, XmlPullParserException {
        read(START_DOCTYPE);

        int startPosition = -1;
        if (saveDtdText) {
            bufferCapture = new StringBuilder();
            startPosition = position;
        }
        try {
            skip();
            rootElementName = readName();
            readExternalId(true, true);
            skip();
            if (peekCharacter() == '[') {
                readInternalSubset();
            }
            skip();
        } finally {
            if (saveDtdText) {
                bufferCapture.append(buffer, 0, position);
                bufferCapture.delete(0, startPosition);
                text = bufferCapture.toString();
                bufferCapture = null;
            }
        }

        read('>');
        skip();
    }
196378
function decodeSimple($value, $type, $typens) {
		// TODO: use the namespace!
		if ((!isset($type)) || $type == 'string' || $type == 'long' || $type == 'unsignedLong') {
			return (string) $value;
		}
		if ($type == 'int' || $type == 'integer' || $type == 'short' || $type == 'byte') {
			return (int) $value;
		}
		if ($type == 'float' || $type == 'double' || $type == 'decimal') {
			return (double) $value;
		}
		if ($type == 'boolean') {
			if (strtolower($value) == 'false' || strtolower($value) == 'f') {
				return false;
			}
			return (boolean) $value;
		}
		if ($type == 'base64' || $type == 'base64Binary') {
			$this->debug('Decode base64 value');
			return base64_decode($value);
		}
		// obscure numeric types
		if ($type == 'nonPositiveInteger' || $type == 'negativeInteger'
			|| $type == 'nonNegativeInteger' || $type == 'positiveInteger'
			|| $type == 'unsignedInt'
			|| $type == 'unsignedShort' || $type == 'unsignedByte') {
			return (int) $value;
		}
		// bogus: parser treats array with no elements as a simple type
		if ($type == 'array') {
			return array();
		}
		// everything else
		return (string) $value;
	}
908478
def load_extensions(environment, extensions):
    
    result = {}
    for extension in extensions:
        if isinstance(extension, basestring):
            extension = import_string(extension)
        result[extension.identifier] = extension(environment)
    return result
569136
function getFileTypeReg(type) {
    var map = [],
        ext = ""; // fis.config.get('project.fileType.' + type);
    if (type === 'text') {
        map = TEXT_FILE_EXTS;
    } else if (type === 'image') {
        map = IMAGE_FILE_EXTS;
    } else {
        xgulp.log.error('invalid file type [%s]', type);
    }
    if (ext && ext.length) {
        if (typeof ext === 'string') {
            ext = ext.split(/\s*,\s*/);
        }
        map = map.concat(ext);
    }
    map = map.join('|');
    return new RegExp('\\.(?:' + map + ')$', 'i');
}
929715
function decodefield (str) {
  var match = EXT_VALUE_REGEXP.exec(str)

  if (!match) {
    throw new TypeError('invalid extended field value')
  }

  var charset = match[1].toLowerCase()
  var encoded = match[2]
  var value

  // to binary string
  var binary = encoded.replace(HEX_ESCAPE_REPLACE_REGEXP, pdecode)

  switch (charset) {
    case 'iso-8859-1':
      value = getlatin1(binary)
      break
    case 'utf-8':
      value = Buffer.from(binary, 'binary').toString('utf8')
      break
    default:
      throw new TypeError('unsupported charset in extended field')
  }

  return value
}
836841
def decode_work_type(obj)
      if obj['type'] =~ WORK_TYPE_WITH_PREFIX_PATTERN
        return 'GenericWork' if Regexp.last_match(2).nil?
        Regexp.last_match(2)
      else
        # this will return nil if key t does not exist
        work_type = obj['type'].downcase
        WORK_TYPES[work_type]
      end
    end
295438
function populateMaps (extensions, types) {
  // source preference (least -> most)
  var preference = ['nginx', 'apache', undefined, 'iana']

  Object.keys(db).forEach(function forEachMimeType (type) {
    var mime = db[type]
    var exts = mime.extensions

    if (!exts || !exts.length) {
      return
    }

    // mime -> extensions
    extensions[type] = exts

    // extension -> mime
    for (var i = 0; i < exts.length; i++) {
      var extension = exts[i]

      if (types[extension]) {
        var from = preference.indexOf(db[types[extension]].source)
        var to = preference.indexOf(mime.source)

        if (types[extension] !== 'application/octet-stream' &&
          (from > to || (from === to && types[extension].substr(0, 12) === 'application/'))) {
          // skip the remapping
          continue
        }
      }

      // set the extension -> mime
      types[extension] = type
    }
  })
}
21111
public ChromeOptions addEncodedExtensions(List<String> encoded) {
    for (String extension : encoded) {
      checkNotNull(extension);
    }
    extensions.addAll(encoded);
    return this;
  }
439360
function decode(callback) {
    if (typeof callback == 'function') {
      return callback;
    } else {
      var split = callback.split('::');
      var action = split[0];
      var method = split[1] || 'index';
      return {
        action: action,
        method: method,
        arguments: []
      };
    }
  }
648451
def encode_abi(types, args)
      parsed_types = types.map {|t| Type.parse(t) }

      head_size = (0...args.size)
        .map {|i| parsed_types[i].size || 32 }
        .reduce(0, &:+)

      head, tail = '', ''
      args.each_with_index do |arg, i|
        if parsed_types[i].dynamic?
          head += encode_type(Type.size_type, head_size + tail.size)
          tail += encode_type(parsed_types[i], arg)
        else
          head += encode_type(parsed_types[i], arg)
        end
      end

      "#{head}#{tail}"
    end
1351635
def custom_decode(encoding):
    """"""
    encoding = encoding.lower()
    alternates = {
        'big5': 'big5hkscs',
        'gb2312': 'gb18030',
        'ascii': 'utf-8',
        'MacCyrillic': 'cp1251',
    }
    if encoding in alternates:
        return alternates[encoding]
    else:
        return encoding
315471
function parseStoredType(value /* , context */) {
    const regex = /^(\w+)(\((.*?)\))?$/;
    const result = value.match(regex);
    if (!result) throw new ImplementationError(`Invalid storedType "${value}"`);

    const type = result[1];
    const options = {};
    if (result[2]) {
        const regexOptions = /^(\w+)=(.*)/;
        result[3].split(';').forEach(o => {
            const resultOptions = o.match(regexOptions);
            if (!resultOptions) throw new ImplementationError(`Invalid storedType "${value}"`);
            options[resultOptions[1]] = resultOptions[2];
        });
    }

    return { type, options };
}