{
    "mode": "pydoc",
    "parameter": "problem_report",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/pydoc/problem_report/json",
    "generated": "2026-11-28T01:17:13Z",
    "sections": {
        "NAME": {
            "content": "problemreport - Store, load, and handle problem reports.\n",
            "subsections": []
        },
        "CLASSES": {
            "content": "builtins.ValueError(builtins.Exception)\nMalformedProblemReport\nbuiltins.object\nCompressedFile\nCompressedValue\ncollections.UserDict(collections.abc.MutableMapping)\nProblemReport\n",
            "subsections": [
                {
                    "name": "class CompressedFile",
                    "content": "|  CompressedFile(filename: str) -> None\n|\n|  Represents a ProblemReport value which points to a compressed file.\n|\n|  The file is expected to be compressed with gzip or zstandard.\n|\n|  Methods defined here:\n|\n|  del(self)\n|\n|  eq(self, other)\n|      Return self==value.\n|\n|  init(self, filename: str) -> None\n|      Initialize self.  See help(type(self)) for accurate signature.\n|\n|  repr(self)\n|      Return repr(self).\n|\n|  isreadable(self) -> bool\n|      Check if the compressed file is readable by the effective user.\n|\n|  itercompressed(self) -> collections.abc.Iterator[bytes]\n|      Iterate over the compressed content of the file in 1 MB chunks.\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors defined here:\n|\n|  dict\n|      dictionary for instance variables\n|\n|  weakref\n|      list of weak references to the object\n|\n|  ----------------------------------------------------------------------\n|  Data and other attributes defined here:\n|\n|  annotations = {'filename': <class 'str'>}\n|\n|  dataclassfields = {'filename': Field(name='filename',type=<class ...\n|\n|  dataclassparams = DataclassParams(init=True,repr=True,eq=True,or...\n|\n|  hash = None\n|\n|  matchargs = ('filename',)\n"
                },
                {
                    "name": "class CompressedValue",
                    "content": "|  CompressedValue(value: bytes | None = None, name: str | None = None, compressedvalue: bytes | None = None) -> None\n|\n|  Represent a ProblemReport value which is gzip or zstandard compressed.\n|\n|  By default, compressed values are in gzip format. Earlier versions of\n|  problemreport used zlib format (without gzip header).\n|\n|  Methods defined here:\n|\n|  init(self, value: bytes | None = None, name: str | None = None, compressedvalue: bytes | None = None) -> None\n|      Initialize an empty CompressedValue object with an optional name.\n|\n|  len(self) -> int\n|      Return length of uncompressed value.\n|\n|  getcompressedsize(self) -> int\n|      Return size of the compressed (but not base64 encoded) value.\n|\n|  getondisksize(self) -> int\n|      Return the size needed on disk to store the compressed value.\n|\n|      The compressed value will be base64 encoded when written to disk\n|      which adds an overhead of 1/3 plus up to 2 bytes of padding. Additional\n|      spaces and newlines are ignored in this calculation.\n|\n|  getvalue(self) -> bytes\n|      Return uncompressed value.\n|\n|  setvalue(self, value: bytes) -> None\n|      Set uncompressed value.\n|\n|  splitlines(self) -> list[bytes]\n|      Behaves like splitlines() for a normal string.\n|\n|  write(self, file: <class 'BinaryIO'>) -> None\n|      Write uncompressed value into given file-like object.\n|\n|  ----------------------------------------------------------------------\n|  Static methods defined here:\n|\n|  decodecompressedstream(entry: collections.abc.Iterator[bytes]) -> collections.abc.Iterator[bytes]\n|      Decode the given compressed value (iterator version).\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors defined here:\n|\n|  dict\n|      dictionary for instance variables\n|\n|  weakref\n|      list of weak references to the object\n"
                },
                {
                    "name": "class MalformedProblemReport",
                    "content": "|  MalformedProblemReport(message: str, *args: object)\n|\n|  Raised when a problem report violates the crash report format.\n|\n|  This exception might be raised when the keys of the report are not ASCII.\n|\n|  Method resolution order:\n|      MalformedProblemReport\n|      builtins.ValueError\n|      builtins.Exception\n|      builtins.BaseException\n|      builtins.object\n|\n|  Methods defined here:\n|\n|  init(self, message: str, *args: object)\n|      Initialize self.  See help(type(self)) for accurate signature.\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors defined here:\n|\n|  weakref\n|      list of weak references to the object\n|\n|  ----------------------------------------------------------------------\n|  Static methods inherited from builtins.ValueError:\n|\n|  new(*args, kwargs) class method of builtins.ValueError\n|      Create and return a new object.  See help(type) for accurate signature.\n|\n|  ----------------------------------------------------------------------\n|  Methods inherited from builtins.BaseException:\n|\n|  delattr(self, name, /)\n|      Implement delattr(self, name).\n|\n|  getattribute(self, name, /)\n|      Return getattr(self, name).\n|\n|  reduce(...)\n|      Helper for pickle.\n|\n|  repr(self, /)\n|      Return repr(self).\n|\n|  setattr(self, name, value, /)\n|      Implement setattr(self, name, value).\n|\n|  setstate(...)\n|\n|  str(self, /)\n|      Return str(self).\n|\n|  addnote(...)\n|      Exception.addnote(note) --\n|      add a note to the exception\n|\n|  withtraceback(...)\n|      Exception.withtraceback(tb) --\n|      set self.traceback to tb and return self.\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors inherited from builtins.BaseException:\n|\n|  cause\n|      exception cause\n|\n|  context\n|      exception context\n|\n|  dict\n|\n|  suppresscontext\n|\n|  traceback\n|\n|  args\n"
                },
                {
                    "name": "class ProblemReport",
                    "content": "|  ProblemReport(problemtype: str = 'Crash', date: str | None = None) -> None\n|\n|  Class to store, load, and handle problem reports.\n|\n|  Method resolution order:\n|      ProblemReport\n|      collections.UserDict\n|      collections.abc.MutableMapping\n|      collections.abc.Mapping\n|      collections.abc.Collection\n|      collections.abc.Sized\n|      collections.abc.Iterable\n|      collections.abc.Container\n|      builtins.object\n|\n|  Methods defined here:\n|\n|  init(self, problemtype: str = 'Crash', date: str | None = None) -> None\n|      Initialize a fresh problem report.\n|\n|      problemtype can be 'Crash', 'Packaging', 'KernelCrash' or\n|      'KernelOops'. date is the desired date/time string; if\n|      None (default), the current local time is used.\n|\n|  setitem(self, k: str, v: bytes | problemreport.CompressedFile | problemreport.CompressedValue | str | tuple) -> None\n|\n|  addtags(self, tags: collections.abc.Iterable[str]) -> None\n|      Add tags to the report. Duplicates are dropped.\n|\n|  addtoexisting(self, reportfile: str, keeptimes: bool = False) -> None\n|      Add this report's data to an already existing report file.\n|\n|      The file will be temporarily chmod'ed to 000 to prevent frontends\n|      from picking up a hal-updated report file. If keeptimes\n|      is True, then the file's atime and mtime restored after updating.\n|\n|  extractkeys(self, file: gzip.GzipFile | typing.BinaryIO, binkeys: collections.abc.Iterable[str] | str, directory: str) -> None\n|      Extract only given binary elements from the problem report.\n|\n|      Binary elements like kernel crash dumps can be very big. This method\n|      extracts directly files without loading the report into memory.\n|\n|  gettags(self) -> set[str]\n|      Return the set of tags.\n|\n|  gettimestamp(self) -> int | None\n|      Get timestamp (seconds since epoch) from Date field.\n|\n|      Return None if it is not present.\n|\n|  hasremovedfields(self) -> bool\n|      Check if the report has any keys which were not loaded.\n|\n|      This could happen when using binary=False in load().\n|\n|  load(self, file: gzip.GzipFile | typing.BinaryIO, binary: Union[bool, Literal['compressed']] = True, keyfilter: collections.abc.Iterable[str] | None = None) -> None\n|      Initialize problem report from a file-like object.\n|\n|      If binary is False, binary data is not loaded; the dictionary key is\n|      created, but its value will be an empty string. If it is True, it is\n|      transparently uncompressed and available as dictionary byte array\n|      values. If binary is 'compressed', the compressed value is retained,\n|      and the dictionary value will be a CompressedValue object. This is\n|      useful if the compressed value is still useful (to avoid recompression\n|      if the file needs to be written back).\n|\n|      file needs to be opened in binary mode.\n|\n|      If keyfilter is given, only those keys will be loaded.\n|\n|      Files are in RFC822 format, but with case sensitive keys.\n|\n|  newkeys(self) -> set[str]\n|      Return newly added keys.\n|\n|      Return the set of keys which have been added to the report since it\n|      was constructed or loaded.\n|\n|  sorteditems(self, keys: collections.abc.Iterable[str] | None = None) -> collections.abc.Iterator[tuple[str, bytes | problemreport.CompressedValue | str | tuple]]\n|      Iterate over all non-internal items sorted.\n|\n|      The most interesting fields will be returned first. The remaining\n|      items will be returned in alphabetical order. Keys starting with\n|      an underscore are considered internal and are skipped. Also values\n|      that are None will be skipped.\n|\n|      If keys is provided, only those keys will be iterated over.\n|\n|  write(self, file: <class 'BinaryIO'>, onlynew: bool = False) -> None\n|      Write information into the given file-like object.\n|\n|      If onlynew is True, only keys which have been added since the last\n|      load() are written (i. e. those returned by newkeys()).\n|\n|      If a value is a string, it is written directly. Otherwise it must be a\n|      tuple of the form (file, encode=True, limit=None, failonempty=False).\n|      The first argument can be a file name or a file-like object,\n|      which will be read and its content will become the value of this key.\n|      'encode' specifies whether the contents will be\n|      gzip compressed and base64-encoded (this defaults to True). If limit is\n|      set to a positive integer, the file is not attached if it's larger\n|      than the given limit, and the entire key will be removed. If\n|      failonempty is True, reading zero bytes will cause an OSError.\n|\n|      file needs to be opened in binary mode.\n|\n|      Files are written in RFC822 format.\n|\n|  writemime(self, file, attachtreshold=5, extraheaders=None, skipkeys=None, priorityfields=None)\n|      Write MIME/Multipart RFC 2822 formatted data into file.\n|\n|      file must be a file-like object, not a path.  It needs to be opened in\n|      binary mode.\n|\n|      If a value is a string or a CompressedValue, it is written directly.\n|      Otherwise it must be a tuple containing the source file and an optional\n|      boolean value (in that order); the first argument can be a file name or\n|      a file-like object, which will be read and its content will become the\n|      value of this key.  The file will be gzip compressed, unless the key\n|      already ends in .gz.\n|\n|      attachtreshold specifies the maximum number of lines for a value to be\n|      included into the first inline text part. All bigger values (as well as\n|      all non-ASCII ones) will become an attachment, as well as text\n|      values bigger than 1 kB.\n|\n|      Extra MIME preamble headers can be specified, too, as a dictionary.\n|\n|      skipkeys is a set/list specifying keys which are filtered out and not\n|      written to the destination file.\n|\n|      priorityfields is a set/list specifying the order in which keys should\n|      appear in the destination file.\n|\n|  ----------------------------------------------------------------------\n|  Static methods defined here:\n|\n|  isbinary(string: bytes | str) -> bool\n|      Check if the given strings contains binary data.\n|\n|  ----------------------------------------------------------------------\n|  Data and other attributes defined here:\n|\n|  abstractmethods = frozenset()\n|\n|  ----------------------------------------------------------------------\n|  Methods inherited from collections.UserDict:\n|\n|  contains(self, key)\n|      # Modify contains and get() to work like dict\n|      # does when missing is present.\n|\n|  copy(self)\n|\n|  delitem(self, key)\n|\n|  getitem(self, key)\n|\n|  ior(self, other)\n|\n|  iter(self)\n|\n|  len(self)\n|\n|  or(self, other)\n|      Return self|value.\n|\n|  repr(self)\n|      Return repr(self).\n|\n|  ror(self, other)\n|      Return value|self.\n|\n|  copy(self)\n|\n|  get(self, key, default=None)\n|      D.get(k[,d]) -> D[k] if k in D, else d.  d defaults to None.\n|\n|  ----------------------------------------------------------------------\n|  Class methods inherited from collections.UserDict:\n|\n|  fromkeys(iterable, value=None)\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors inherited from collections.UserDict:\n|\n|  dict\n|      dictionary for instance variables\n|\n|  weakref\n|      list of weak references to the object\n|\n|  ----------------------------------------------------------------------\n|  Methods inherited from collections.abc.MutableMapping:\n|\n|  clear(self)\n|      D.clear() -> None.  Remove all items from D.\n|\n|  pop(self, key, default=<object object at 0x7fc39e1881d0>)\n|      D.pop(k[,d]) -> v, remove specified key and return the corresponding value.\n|      If key is not found, d is returned if given, otherwise KeyError is raised.\n|\n|  popitem(self)\n|      D.popitem() -> (k, v), remove and return some (key, value) pair\n|      as a 2-tuple; but raise KeyError if D is empty.\n|\n|  setdefault(self, key, default=None)\n|      D.setdefault(k[,d]) -> D.get(k,d), also set D[k]=d if k not in D\n|\n|  update(self, other=(), /, kwds)\n|      D.update([E, ]F) -> None.  Update D from mapping/iterable E and F.\n|      If E present and has a .keys() method, does:     for k in E: D[k] = E[k]\n|      If E present and lacks .keys() method, does:     for (k, v) in E: D[k] = v\n|      In either case, this is followed by: for k, v in F.items(): D[k] = v\n|\n|  ----------------------------------------------------------------------\n|  Methods inherited from collections.abc.Mapping:\n|\n|  eq(self, other)\n|      Return self==value.\n|\n|  items(self)\n|      D.items() -> a set-like object providing a view on D's items\n|\n|  keys(self)\n|      D.keys() -> a set-like object providing a view on D's keys\n|\n|  values(self)\n|      D.values() -> an object providing a view on D's values\n|\n|  ----------------------------------------------------------------------\n|  Data and other attributes inherited from collections.abc.Mapping:\n|\n|  hash = None\n|\n|  reversed = None\n|\n|  ----------------------------------------------------------------------\n|  Class methods inherited from collections.abc.Collection:\n|\n|  subclasshook(C)\n|      Abstract classes can override this to customize issubclass().\n|\n|      This is invoked early on by abc.ABCMeta.subclasscheck().\n|      It should return True, False or NotImplemented.  If it returns\n|      NotImplemented, the normal algorithm is used.  Otherwise, it\n|      overrides the normal algorithm (and the outcome is cached).\n|\n|  ----------------------------------------------------------------------\n|  Class methods inherited from collections.abc.Iterable:\n|\n|  classgetitem = GenericAlias(...)\n|      Represent a PEP 585 generic type\n|\n|      E.g. for t = list[int], t.origin is list and t.args is (int,).\n"
                }
            ]
        },
        "DATA": {
            "content": "CHUNKSIZE = 131072\nGZIPHEADERSTART = b'\\x1f\\x8b\\x08'\nZSTANDARDMAGICNUMBER = b'(\\xb5/\\xfd'\n",
            "subsections": []
        },
        "FILE": {
            "content": "/usr/lib/python3/dist-packages/problemreport.py\n\n",
            "subsections": []
        }
    },
    "summary": "problemreport - Store, load, and handle problem reports.",
    "flags": [],
    "examples": [],
    "see_also": []
}