class_docstr: Deterministic variant of GzipFile
  
  This writer does not add filename information to the header, and defaults
  to a modification time (``mtime``) of 0 seconds.
class_docstr_tok: ["Deterministic","variant","of","GzipFile","This","writer","does","not","add","filename","information","to","the","header",",","and","defaults","to","a","modification","time","(","``","mtime","``",")","of","0","seconds","."]
code: def __init__(
      self,
      filename: str | None = None,
      mode: Mode | None = None,
      compresslevel: int = 9,
      fileobj: io.FileIO | None = None,
      mtime: int = 0,
  ):
      if mode is None:
          mode = "rb"
      modestr: str = mode
  
      # These two guards are adapted from
      # https://github.com/python/cpython/blob/6ab65c6/Lib/gzip.py#L171-L174
      if "b" not in modestr:
          modestr = f"{mode}b"
      if fileobj is None:
          if filename is None:
              raise TypeError("Must define either fileobj or filename")
          # Cast because GzipFile.myfileobj has type io.FileIO while open returns ty.IO
          fileobj = self.myfileobj = ty.cast(
              io.FileIO, open(filename, modestr)
          )
      return super().__init__(
          filename="",
          mode=modestr,
          compresslevel=compresslevel,
          fileobj=fileobj,
          mtime=mtime,
      )
  
imports: from __future__ import annotations
  import gzip
  import io
  import typing
  from bz2 import BZ2File
  from os.path import splitext
  from ._compression import HAVE_INDEXED_GZIP, IndexedGzipFile, pyzstd
label_desc: Use image node_id 1 to create a new DeterministicGzipFile object from inherited base classes: gzip with example: obj = DeterministicGzipFile(filename, mode, compresslevel, fileobj, mtime)