StubxWriter.VERSION_0_FILE_MAGIC_NUMBER (?)
422144
private static void writeModel(DataOutputStream out) throws IOException {
    Map<String, String> importedAnnotations =
        ImmutableMap.<String, String>builder()
            .put("Nonnull", "javax.annotation.Nonnull")
            .put("Nullable", "javax.annotation.Nullable")
            .build();
    Map<String, Set<String>> packageAnnotations = new HashMap<>();
    Map<String, Set<String>> typeAnnotations = new HashMap<>();
    Map<String, MethodAnnotationsRecord> methodRecords = new LinkedHashMap<>();

    for (Map.Entry<String, Set<Integer>> entry : map_result.entrySet()) {
      String sign = entry.getKey();
      Set<Integer> ddParams = entry.getValue();
      if (ddParams.isEmpty()) continue;
      Map<Integer, ImmutableSet<String>> argAnnotation =
          new HashMap<Integer, ImmutableSet<String>>();
      for (Integer param : ddParams) {
        argAnnotation.put(param, ImmutableSet.of("Nonnull"));
      }
      methodRecords.put(
          sign,
          new MethodAnnotationsRecord(
              nullableReturns.contains(sign) ? ImmutableSet.of("Nullable") : ImmutableSet.of(),
              ImmutableMap.copyOf(argAnnotation)));
      nullableReturns.remove(sign);
    }
    for (String nullableReturnMethodSign : Iterator2Iterable.make(nullableReturns.iterator())) {
      methodRecords.put(
          nullableReturnMethodSign,
          new MethodAnnotationsRecord(ImmutableSet.of("Nullable"), ImmutableMap.of()));
    }
    StubxWriter.write(out, importedAnnotations, packageAnnotations, typeAnnotations, methodRecords);
  }
323877
def _get_file_magic_name(self, buffer):
        
        default = "Unknown"
        ftype = None

        try:
            # Magic is optional
            import magic
        except ImportError:
            return default

        try:
            # There are several implementations of magic,
            # unfortunately all called magic
            # We use this one: https://github.com/ahupp/python-magic/
            getattr(magic, "MagicException")
        except AttributeError:
            # Looks like no magic was installed
            return default

        try:
            ftype = magic.from_buffer(buffer[:1024])
        except magic.MagicError as e:
            log.exception("Error getting the magic type!")
            return default

        if not ftype:
            return default
        else:
            return self._patch_magic(buffer, ftype)
638605
def stub(ctx):
    

    report.info(ctx, "package.stub", f"generating typing stubs for package")
    ctx.run(
        f"stubgen --include-private --no-import "
        f"--output {ctx.directory.joinpath('stubs')!s} "
        f"--search-path {ctx.directory.joinpath('src')!s} "
        f"--package {ctx.metadata['package_name']}"
    )
1054289
function ScriptNum(num, base) {
  if (!(this instanceof ScriptNum))
    return new ScriptNum(num, base);

  I64.call(this, num, base);
}
1208130
public static void setHTTPVersion(Stub stub, boolean http10) {
        stub._setProperty(MessageContext.HTTP_TRANSPORT_VERSION,
                          (http10)
                          ? HTTPConstants.HEADER_PROTOCOL_V10
                          : HTTPConstants.HEADER_PROTOCOL_V11);
    }
691034
def magic_file(filename):
    
    head, foot = _file_details(filename)
    if not head:
        raise ValueError("Input was empty")
    try:
        info = _identify_all(head, foot, ext_from_filename(filename))
    except PureError:
        info = []
    info.sort(key=lambda x: x.confidence, reverse=True)
    return info
135341
function Spreadsheet_Excel_Writer_BIFFwriter()
    {
        $this->_byte_order = '';
        $this->_data       = '';
        $this->_datasize   = 0;
        $this->_limit      = 2080;
        $this->_tmp_dir    = '';
        // Set the byte order
        $this->_setByteOrder();
    }
1361732
private void writeVersion(VectorClock newClock) {
        File versionFile = getVersionFile();
        try {
            if(!versionFile.exists() || versionFile.delete()) {
                String hexCode = new String(Hex.encodeHex(newClock.toBytes()));
                FileUtils.writeStringToFile(versionFile, hexCode, "UTF-8");
                this.cachedVersion = newClock;
            }
        } catch(Exception e) {
            throw new VoldemortException("Failed to write Version for the current file :"
                                         + getName(), e);
        }
    }
919891
def wrap_stub(elf_file):
    
    print('Wrapping ELF file %s...' % elf_file)
    e = esptool.ELFFile(elf_file)

    text_section = e.get_section('.text')
    try:
        data_section = e.get_section('.data')
    except ValueError:
        data_section = None
    stub = {
         'text': text_section.data,
         'text_start': text_section.addr,
         'entry': e.entrypoint,
        }
    if data_section is not None:
        stub['data'] = data_section.data
        stub['data_start'] = data_section.addr

    # Pad text with NOPs to mod 4.
    if len(stub['text']) % 4 != 0:
        stub['text'] += (4 - (len(stub['text']) % 4)) * '\0'

    print('Stub text: %d @ 0x%08x, data: %d @ 0x%08x, entry @ 0x%x' % (
        len(stub['text']), stub['text_start'],
        len(stub.get('data', '')), stub.get('data_start', 0),
        stub['entry']), file=sys.stderr)
    return stub
949359
def ad_hoc_magic_from_file(filename, **kwargs):
    """"""
    with open(filename, 'rb') as stream:
        head = stream.read(16)
        if head[:4] == b'\x7fELF':
            return b'application/x-executable'
        elif head[:2] == b'MZ':
            return b'application/x-dosexec'
        else:
            raise NotImplementedError()
856664
function thaw_4_0_0(getFile, cb) {
    var p = new Purefts();

    delete p.keys;
    p.fts = {};

    /* give p an appropriate async file getter */
    p.getFile = getFile;

    loadIndexes(p, cb);
}
104656
function _storeBof($type)
    {
        $record  = 0x0809;        // Record identifier

        // According to the SDK $build and $year should be set to zero.
        // However, this throws a warning in Excel 5. So, use magic numbers.
        if ($this->_BIFF_version == 0x0500) {
            $length  = 0x0008;
            $unknown = '';
            $build   = 0x096C;
            $year    = 0x07C9;
        } elseif ($this->_BIFF_version == 0x0600) {
            $length  = 0x0010;
            $unknown = pack("VV", 0x00000041, 0x00000006); //unknown last 8 bytes for BIFF8
            $build   = 0x0DBB;
            $year    = 0x07CC;
        }
        $version = $this->_BIFF_version;

        $header  = pack("vv",   $record, $length);
        $data    = pack("vvvv", $version, $type, $build, $year);
        $this->_prepend($header . $data . $unknown);
    }
1301078
public byte[] toBytes() throws IOException {

		ByteWriter writer = new ByteWriter();

		// Write GP as the 2 byte magic number
		writer.writeString(GeoPackageConstants.GEO_PACKAGE_GEOMETRY_MAGIC_NUMBER);

		// Write a byte as the version, value of 0 = version 1
		writer.writeByte(GeoPackageConstants.GEO_PACKAGE_GEOMETRY_VERSION_1);

		// Build and write a flags byte
		byte flags = buildFlagsByte();
		writer.writeByte(flags);
		writer.setByteOrder(byteOrder);

		// Write the 4 byte srs id int
		writer.writeInt(srsId);

		// Write the envelope
		writeEnvelope(writer);

		// Save off where the WKB bytes start
		wkbGeometryIndex = writer.size();

		// Write the Well-Known Binary Geometry if not marked as empty
		if (!empty) {
			GeometryWriter.writeGeometry(writer, geometry);
		}

		// Get the bytes
		bytes = writer.getBytes();

		// Close the writer
		writer.close();

		return bytes;
	}
120156
def stub(self, obj, attr=None):
        '''
        
        '''
        s = stub(obj, attr)
        if s not in self._stubs:
            self._stubs.append(s)
        return s
1093845
def write_to(self, f, version = None):
        
        if not version:
            version = self.version
        if version == 1:
            header = "%(url)s %(ip_address)s %(date)s %(content_type)s %(length)s"
        elif version == 2:
            header = "%(url)s %(ip_address)s %(date)s %(content_type)s %(result_code)s %(checksum)s %(location)s %(offset)s %(filename)s %(length)s"

        header =  header%dict(url          = self['url'],
                              ip_address   = self['ip_address'],
                              date         = self['date'],
                              content_type = self['content_type'],
                              result_code  = self['result_code'],
                              checksum     = self['checksum'],
                              location     = self['location'],
                              offset       = self['offset'],
                              filename     = self['filename'],
                              length       = self['length'])
        f.write(header)
291909
def _init_modules_stub(self, **_):
        
        from google.appengine.api import request_info
        # edit all_versions per modules & versions thereof needing tests
        all_versions = {}  # {'default': [1], 'andsome': [2], 'others': [1]}
        def_versions = {}  # {m: all_versions[m][0] for m in all_versions}
        m2h = {}  # {m: {def_versions[m]: 'localhost:8080'} for m in def_versions}
        for module in self.configuration.modules:
            module_name = module._module_name or 'default'
            module_version = module._version or '1'
            all_versions[module_name] = [module_version]
            def_versions[module_name] = module_version
            m2h[module_name] = {module_version: 'localhost:8080'}

        request_info._local_dispatcher = request_info._LocalFakeDispatcher(
            module_names=list(all_versions),
            module_name_to_versions=all_versions,
            module_name_to_default_versions=def_versions,
            module_name_to_version_to_hostname=m2h)
        self.testbed.init_modules_stub()
896136
public static void write(OutputStream os, byte version) throws IOException {
    os.write(FSA_MAGIC >> 24);
    os.write(FSA_MAGIC >> 16);
    os.write(FSA_MAGIC >>  8);
    os.write(FSA_MAGIC);
    os.write(version);
  }