class_docstr: A file object providing transparent LZMA (de)compression.
  
  An LZMAFile can act as a wrapper for an existing file object, or
  refer directly to a named file on disk.
  
  Note that LZMAFile provides a *binary* file interface - data read
  is returned as bytes, and data to be written must be given as bytes.
docstr: Open an LZMA-compressed file in binary mode.
  
  filename can be either an actual file name (given as a str,
  bytes, or PathLike object), in which case the named file is
  opened, or it can be an existing file object to read from or
  write to.
  
  mode can be "r" for reading (default), "w" for (over)writing,
  "x" for creating exclusively, or "a" for appending. These can
  equivalently be given as "rb", "wb", "xb" and "ab" respectively.
  
  format specifies the container format to use for the file.
  If mode is "r", this defaults to FORMAT_AUTO. Otherwise, the
  default is FORMAT_XZ.
  
  check specifies the integrity check to use. This argument can
  only be used when opening a file for writing. For FORMAT_XZ,
  the default is CHECK_CRC64. FORMAT_ALONE and FORMAT_RAW do not
  support integrity checks - for these formats, check must be
  omitted, or be CHECK_NONE.
  
  When opening a file for reading, the *preset* argument is not
  meaningful, and should be omitted. The *filters* argument should
  also be omitted, except when format is FORMAT_RAW (in which case
  it is required).
  
  When opening a file for writing, the settings used by the
  compressor can be specified either as a preset compression
  level (with the *preset* argument), or in detail as a custom
  filter chain (with the *filters* argument). For FORMAT_XZ and
  FORMAT_ALONE, the default is to use the PRESET_DEFAULT preset
  level. For FORMAT_RAW, the caller must always specify a filter
  chain; the raw compressor does not support preset compression
  levels.
  
  preset (if provided) should be an integer in the range 0-9,
  optionally OR-ed with the constant PRESET_EXTREME.
  
  filters (if provided) should be a sequence of dicts. Each dict
  should have an entry for "id" indicating ID of the filter, plus
  additional entries for options to the filter.
docstr_tok: ["Open","an","LZMA-compressed","file","in","binary","mode",".","filename","can","be","either","an","actual","file","name","(","given","as","a","str",",","bytes",",","or","PathLike","object",")",",","in","which","case","the","named","file","is","opened",",","or","it","can","be","an","existing","file","object","to","read","from","or","write","to",".","mode","can","be","``","r","''","for","reading","(","default",")",",","``","w","''","for","(","over",")","writing",",","''","x","''","for","creating","exclusively",",","or","``","a","''","for","appending",".","These","can","equivalently","be","given","as","``","rb","''",",","``","wb","''",",","``","xb","''","and","``","ab","''","respectively",".","format","specifies","the","container","format","to","use","for","the","file",".","If","mode","is","``","r","''",",","this","defaults","to","FORMAT_AUTO",".","Otherwise",",","the","default","is","FORMAT_XZ",".","check","specifies","the","integrity","check","to","use",".","This","argument","can","only","be","used","when","opening","a","file","for","writing",".","For","FORMAT_XZ",",","the","default","is","CHECK_CRC64",".","FORMAT_ALONE","and","FORMAT_RAW","do","not","support","integrity","checks","-","for","these","formats",",","check","must","be","omitted",",","or","be","CHECK_NONE",".","When","opening","a","file","for","reading",",","the","*","preset","*","argument","is","not","meaningful",",","and","should","be","omitted",".","The","*","filters","*","argument","should","also","be","omitted",",","except","when","format","is","FORMAT_RAW","(","in","which","case","it","is","required",")",".","When","opening","a","file","for","writing",",","the","settings","used","by","the","compressor","can","be","specified","either","as","a","preset","compression","level","(","with","the","*","preset","*","argument",")",",","or","in","detail","as","a","custom","filter","chain","(","with","the","*","filters","*","argument",")",".","For","FORMAT_XZ","and","FORMAT_ALONE",",","the","default","is","to","use","the","PRESET_DEFAULT","preset","level",".","For","FORMAT_RAW",",","the","caller","must","always","specify","a","filter","chain",";","the","raw","compressor","does","not","support","preset","compression","levels",".","preset","(","if","provided",")","should","be","an","integer","in","the","range","0-9",",","optionally","OR-ed","with","the","constant","PRESET_EXTREME",".","filters","(","if","provided",")","should","be","a","sequence","of","dicts",".","Each","dict","should","have","an","entry","for","``","id","''","indicating","ID","of","the","filter",",","plus","additional","entries","for","options","to","the","filter","."]
code: def __init__(
      self,
      filename=None,
      mode="r",
      *,
      format=None,
      check=-1,
      preset=None,
      filters=None,
  ):
      """Open an LZMA-compressed file in binary mode.
  
      filename can be either an actual file name (given as a str,
      bytes, or PathLike object), in which case the named file is
      opened, or it can be an existing file object to read from or
      write to.
  
      mode can be "r" for reading (default), "w" for (over)writing,
      "x" for creating exclusively, or "a" for appending. These can
      equivalently be given as "rb", "wb", "xb" and "ab" respectively.
  
      format specifies the container format to use for the file.
      If mode is "r", this defaults to FORMAT_AUTO. Otherwise, the
      default is FORMAT_XZ.
  
      check specifies the integrity check to use. This argument can
      only be used when opening a file for writing. For FORMAT_XZ,
      the default is CHECK_CRC64. FORMAT_ALONE and FORMAT_RAW do not
      support integrity checks - for these formats, check must be
      omitted, or be CHECK_NONE.
  
      When opening a file for reading, the *preset* argument is not
      meaningful, and should be omitted. The *filters* argument should
      also be omitted, except when format is FORMAT_RAW (in which case
      it is required).
  
      When opening a file for writing, the settings used by the
      compressor can be specified either as a preset compression
      level (with the *preset* argument), or in detail as a custom
      filter chain (with the *filters* argument). For FORMAT_XZ and
      FORMAT_ALONE, the default is to use the PRESET_DEFAULT preset
      level. For FORMAT_RAW, the caller must always specify a filter
      chain; the raw compressor does not support preset compression
      levels.
  
      preset (if provided) should be an integer in the range 0-9,
      optionally OR-ed with the constant PRESET_EXTREME.
  
      filters (if provided) should be a sequence of dicts. Each dict
      should have an entry for "id" indicating ID of the filter, plus
      additional entries for options to the filter.
      """
      self._fp = None
      self._closefp = False
      self._mode = _MODE_CLOSED
  
      if mode in ("r", "rb"):
          if check != -1:
              raise ValueError(
                  "Cannot specify an integrity check "
                  "when opening a file for reading"
              )
          if preset is not None:
              raise ValueError(
                  "Cannot specify a preset compression "
                  "level when opening a file for reading"
              )
          if format is None:
              format = FORMAT_AUTO
          mode_code = _MODE_READ
      elif mode in ("w", "wb", "a", "ab", "x", "xb"):
          if format is None:
              format = FORMAT_XZ
          mode_code = _MODE_WRITE
          self._compressor = LZMACompressor(
              format=format, check=check, preset=preset, filters=filters
          )
          self._pos = 0
      else:
          raise ValueError("Invalid mode: {!r}".format(mode))
  
      if isinstance(filename, (str, bytes, os.PathLike)):
          if "b" not in mode:
              mode += "b"
          self._fp = builtins.open(filename, mode)
          self._closefp = True
          self._mode = mode_code
      elif hasattr(filename, "read") or hasattr(filename, "write"):
          self._fp = filename
          self._mode = mode_code
      else:
          raise TypeError(
              "filename must be a str, bytes, file or PathLike object"
          )
  
      if self._mode == _MODE_READ:
          raw = _compression.DecompressReader(
              self._fp,
              LZMADecompressor,
              trailing_error=LZMAError,
              format=format,
              filters=filters,
          )
          self._buffer = io.BufferedReader(raw)
  
imports: import builtins
  import io
  import os
  from _lzma import *
  from _lzma import _encode_filter_properties, _decode_filter_properties
  import _compression
label_desc: Use image node_id 1 to create a new LZMAFile object from inherited base classes: _compression with example: obj = LZMAFile(filename, mode)