of block length and version to check for extensions
334299
private void generateExtensibilityMethods(
        final StringBuilder sb,
        final String typeName,
        final Token token)
    {
        sb.append(String.format(
            "\nfunc (*%1$s) SbeBlockLength() (blockLength uint) {\n" +
            "\treturn %2$s\n" +
            "}\n" +
            "\nfunc (*%1$s) SbeSchemaVersion() (schemaVersion %3$s) {\n" +
            "\treturn %4$s\n" +
            "}\n",
            typeName,
            generateLiteral(ir.headerStructure().blockLengthType(), Integer.toString(token.encodedLength())),
            golangTypeName(ir.headerStructure().schemaVersionType()),
            generateLiteral(ir.headerStructure().schemaVersionType(), Integer.toString(ir.version()))));
    }
19191
def _archive_extensions():
        
        if six.PY3:
            ext_map = {}
            fmt_map = {}
            for key, exts, desc in shutil.get_unpack_formats():
                fmt_map[key] = exts[0]
                for ext in exts:
                    ext_map[ext] = key
        else:
            ext_map = {'.tar': 'tar',
                       '.tar.bz2': 'bztar',
                       '.tar.gz': 'gztar',
                       '.tar.xz': 'xztar',
                       '.tbz2': 'bztar',
                       '.tgz': 'gztar',
                       '.txz': 'xztar',
                       '.zip': 'zip'}
            fmt_map = {'bztar': '.tar.bz2',
                       'gztar': '.tar.gz',
                       'tar': '.tar',
                       'xztar': '.tar.xz',
                       'zip': '.zip'}
        return ext_map, fmt_map
518569
def read_block_idb(self, block, _):
        """"""
        options = block[16:]
        tsresol = 1000000
        while len(options) >= 4:
            code, length = struct.unpack(self.endian + "HH", options[:4])
            # PCAP Next Generation (pcapng) Capture File Format
            # 4.2. - 
            # http://xml2rfc.tools.ietf.org/cgi-bin/xml2rfc.cgi?url=https://raw.githubusercontent.com/pcapng/pcapng/master/draft-tuexen-opsawg-pcapng.xml&modeAsFormat=html/ascii&type=ascii#rfc.section.4.2
            if code == 9 and length == 1 and len(options) >= 5:
                tsresol = orb(options[4])
                tsresol = (2 if tsresol & 128 else 10) ** (tsresol & 127)
            if code == 0:
                if length != 0:
                    warning("PcapNg: invalid option length %d for end-of-option" % length)  # noqa: E501
                break
            if length % 4:
                length += (4 - (length % 4))
            options = options[4 + length:]
        self.interfaces.append(struct.unpack(self.endian + "HxxI", block[:8]) +
                               (tsresol,))
1357363
function detectExtension() {
  var mimeType = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
  var favoredExtension = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';

  mimeType = mimeType.toString().toLowerCase().replace(/\s/g, '');
  if (!(mimeType in _listTypes.types)) {
    return 'bin';
  }

  if (typeof _listTypes.types[mimeType] === 'string') {
    return _listTypes.types[mimeType];
  }

  favoredExtension = favoredExtension.toString().toLowerCase().replace(/\s/g, '');
  if (favoredExtension && _listTypes.types[mimeType].includes(favoredExtension)) {
    return favoredExtension;
  }

  // search for name match
  var mimePart = mimeType.split('/')[1];
  for (var i = 0, len = _listTypes.types[mimeType].length; i < len; i++) {
    if (mimePart === _listTypes.types[mimeType][i]) {
      return _listTypes.types[mimeType][i];
    }
  }

  // use the first one
  return _listTypes.types[mimeType][0];
}
219123
function(blockName) {
        // TODO: support any custom naming scheme, e.g. flat, when there are
        // no directories for blocks
        var decl = this.getDeclByIntrospection(PATH.dirname(this.get('block', [blockName])));
        return decl.length? decl.shift() : {};
    }
1189123
function _getExtension(file) {
        var ret;
        if (file) {
            var fileTypes = file.split(".");
            var len = fileTypes.length;
            if (0 === len) {
                return ret;
            }
            ret = fileTypes[len - 1];
            return ret;
        }
    }
1091697
private void generateExtensionCheck(
        final StringBuilder sb,
        final char varName)
    {
        this.imports.add("io");
        this.imports.add("io/ioutil");
        sb.append(String.format(
            "\tif actingVersion > %1$s.SbeSchemaVersion() && blockLength > %1$s.SbeBlockLength() {\n" +
            "\t\tio.CopyN(ioutil.Discard, _r, int64(blockLength-%1$s.SbeBlockLength()))\n" +
            "\t}\n",
            varName));
    }
132206
public static long getPosFromBlockOffset(long offsetInBlock, int bytesPerChecksum,
      int checksumSize) {
    // We only support to read full chunks, so offsetInBlock must be the boundary
    // of the chunks.
    assert offsetInBlock % bytesPerChecksum == 0;
    // The position in the file will be the same as the file size for the block
    // size.
    return getFileLengthFromBlockSize(offsetInBlock, bytesPerChecksum, checksumSize);
  }
510432
def as_extension(self):
        """"""
        return x509.extensions.Extension(oid=self.oid, critical=self.critical, value=self.extension_type)
720559
private function extensionCheck()
    {
        // Check for required PHP extensions
        $required_extensions = ['PDO', 'curl', 'gd', 'json', 'openssl', 'mbstring'];
        $missing = [];
        foreach ($required_extensions as $extension) {
            if (!extension_loaded($extension)) {
                $missing[] = $extension;
            }
        }
        if (count($missing)) {
            asort($missing);
            $this->console->error('Extension required: ' . implode(', ', $missing));
            $this->errors =  true;
        }
    }
231386
private void read_block_sizes_from_disk(boolean coalesce_blocks)
    throws IOException
    {
        long addr = FIRST_TAIL;
        int length;
        long new_tail = tail_ptr;

        while (addr < tail_ptr) {
            seek(addr);
            if (coalesce_blocks) {
                length = combine_blocks(addr);
            } else {
                length = readInt();
            }
            if (length > 0) {
                if ((length + addr >= tail_ptr) && (!readOnly)) {
                    // add last block to tail
                    new_tail = addr;
                } else {
                    add_to_freelist(addr, length);
                }
            } else {
                length = - length;
                allocated_blocks++;
                allocated_words += length;
            }
            addr = addr + length;
        }
        if ((new_tail != tail_ptr) && (!readOnly)) {
            tail_ptr = new_tail;
            seek(TAIL_DPTR);
            writeLong(tail_ptr);
        }

    }
269769
def watched_extension(extension):
    """"""
    for ext in hamlpy.VALID_EXTENSIONS:
        if extension.endswith('.' + ext):
            return True
    return False
1338660
function (content) {

            // XXX extension-specific for get blocks too.
            //
            // Eg. for each predefined extensions directives may vary. eg <!--
            // directive --> for html, /** directive **/ for css
            var blocks = getBlocks(content);

            content = updateReferences(blocks, content);

            compactContent(blocks);

            return content;
        }
1167212
def _validate_extension(self):
        
        extension = self.fpath.split('.')[-1]
        if extension not in self.supported_extensions:
            raise UnsupportedExtensionError
1133715
def safe_size_check(checked_path, error_detail, max_bytes=500000000):
    """"""
    actual_size = 0
    for dirpath, dirnames, filenames in os.walk(checked_path):
        for f in filenames:
            fp = os.path.join(dirpath, f)
            actual_size += os.path.getsize(fp)

    assert actual_size <= max_bytes, "Path {} size of {} >= {} bytes. {}".format(
        checked_path, actual_size, max_bytes, error_detail)
753183
def expand_block(self, feat):
        
        chrom_end = self._ref_sizes.get(feat.chrom)
        if chrom_end:
            if feat.start < self._end_buffer:
                feat.start = 0
            if feat.stop >= chrom_end - self._end_buffer:
                feat.stop = chrom_end
        return feat
1291441
def _versioned_lib_suffix(env, suffix, version):
    """'"""
    Verbose = False
    if Verbose:
        print("_versioned_lib_suffix: suffix={:r}".format(suffix))
        print("_versioned_lib_suffix: version={:r}".format(version))
    if not suffix.endswith(version):
        suffix = suffix + '.' + version
    if Verbose:
        print("_versioned_lib_suffix: return suffix={:r}".format(suffix))
    return suffix