pydoc > problem_report

Help on module problem_report:

NAME
    problem_report - Store, load, and handle problem reports.

CLASSES
    builtins.ValueError(builtins.Exception)
        MalformedProblemReport
    builtins.object
        CompressedFile
        CompressedValue
    collections.UserDict(collections.abc.MutableMapping)
        ProblemReport

    class CompressedFile(builtins.object)
     |  CompressedFile(filename: str) -> None
     |
     |  Represents a ProblemReport value which points to a compressed file.
     |
     |  The file is expected to be compressed with gzip or zstandard.
     |
     |  Methods defined here:
     |
     |  __del__(self)
     |
     |  __eq__(self, other)
     |      Return self==value.
     |
     |  __init__(self, filename: str) -> None
     |      Initialize self.  See help(type(self)) for accurate signature.
     |
     |  __repr__(self)
     |      Return repr(self).
     |
     |  is_readable(self) -> bool
     |      Check if the compressed file is readable by the effective user.
     |
     |  iter_compressed(self) -> collections.abc.Iterator[bytes]
     |      Iterate over the compressed content of the file in 1 MB chunks.
     |
     |  ----------------------------------------------------------------------
     |  Data descriptors defined here:
     |
     |  __dict__
     |      dictionary for instance variables
     |
     |  __weakref__
     |      list of weak references to the object
     |
     |  ----------------------------------------------------------------------
     |  Data and other attributes defined here:
     |
     |  __annotations__ = {'filename': <class 'str'>}
     |
     |  __dataclass_fields__ = {'filename': Field(name='filename',type=<class ...
     |
     |  __dataclass_params__ = _DataclassParams(init=True,repr=True,eq=True,or...
     |
     |  __hash__ = None
     |
     |  __match_args__ = ('filename',)

    class CompressedValue(builtins.object)
     |  CompressedValue(value: bytes | None = None, name: str | None = None, compressed_value: bytes | None = None) -> None
     |
     |  Represent a ProblemReport value which is gzip or zstandard compressed.
     |
     |  By default, compressed values are in gzip format. Earlier versions of
     |  problem_report used zlib format (without gzip header).
     |
     |  Methods defined here:
     |
     |  __init__(self, value: bytes | None = None, name: str | None = None, compressed_value: bytes | None = None) -> None
     |      Initialize an empty CompressedValue object with an optional name.
     |
     |  __len__(self) -> int
     |      Return length of uncompressed value.
     |
     |  get_compressed_size(self) -> int
     |      Return size of the compressed (but not base64 encoded) value.
     |
     |  get_on_disk_size(self) -> int
     |      Return the size needed on disk to store the compressed value.
     |
     |      The compressed value will be base64 encoded when written to disk
     |      which adds an overhead of 1/3 plus up to 2 bytes of padding. Additional
     |      spaces and newlines are ignored in this calculation.
     |
     |  get_value(self) -> bytes
     |      Return uncompressed value.
     |
     |  set_value(self, value: bytes) -> None
     |      Set uncompressed value.
     |
     |  splitlines(self) -> list[bytes]
     |      Behaves like splitlines() for a normal string.
     |
     |  write(self, file: <class 'BinaryIO'>) -> None
     |      Write uncompressed value into given file-like object.
     |
     |  ----------------------------------------------------------------------
     |  Static methods defined here:
     |
     |  decode_compressed_stream(entry: collections.abc.Iterator[bytes]) -> collections.abc.Iterator[bytes]
     |      Decode the given compressed value (iterator version).
     |
     |  ----------------------------------------------------------------------
     |  Data descriptors defined here:
     |
     |  __dict__
     |      dictionary for instance variables
     |
     |  __weakref__
     |      list of weak references to the object

    class MalformedProblemReport(builtins.ValueError)
     |  MalformedProblemReport(message: str, *args: object)
     |
     |  Raised when a problem report violates the crash report format.
     |
     |  This exception might be raised when the keys of the report are not ASCII.
     |
     |  Method resolution order:
     |      MalformedProblemReport
     |      builtins.ValueError
     |      builtins.Exception
     |      builtins.BaseException
     |      builtins.object
     |
     |  Methods defined here:
     |
     |  __init__(self, message: str, *args: object)
     |      Initialize self.  See help(type(self)) for accurate signature.
     |
     |  ----------------------------------------------------------------------
     |  Data descriptors defined here:
     |
     |  __weakref__
     |      list of weak references to the object
     |
     |  ----------------------------------------------------------------------
     |  Static methods inherited from builtins.ValueError:
     |
     |  __new__(*args, **kwargs) class method of builtins.ValueError
     |      Create and return a new object.  See help(type) for accurate signature.
     |
     |  ----------------------------------------------------------------------
     |  Methods inherited from builtins.BaseException:
     |
     |  __delattr__(self, name, /)
     |      Implement delattr(self, name).
     |
     |  __getattribute__(self, name, /)
     |      Return getattr(self, name).
     |
     |  __reduce__(...)
     |      Helper for pickle.
     |
     |  __repr__(self, /)
     |      Return repr(self).
     |
     |  __setattr__(self, name, value, /)
     |      Implement setattr(self, name, value).
     |
     |  __setstate__(...)
     |
     |  __str__(self, /)
     |      Return str(self).
     |
     |  add_note(...)
     |      Exception.add_note(note) --
     |      add a note to the exception
     |
     |  with_traceback(...)
     |      Exception.with_traceback(tb) --
     |      set self.__traceback__ to tb and return self.
     |
     |  ----------------------------------------------------------------------
     |  Data descriptors inherited from builtins.BaseException:
     |
     |  __cause__
     |      exception cause
     |
     |  __context__
     |      exception context
     |
     |  __dict__
     |
     |  __suppress_context__
     |
     |  __traceback__
     |
     |  args

    class ProblemReport(collections.UserDict)
     |  ProblemReport(problem_type: str = 'Crash', date: str | None = None) -> None
     |
     |  Class to store, load, and handle problem reports.
     |
     |  Method resolution order:
     |      ProblemReport
     |      collections.UserDict
     |      collections.abc.MutableMapping
     |      collections.abc.Mapping
     |      collections.abc.Collection
     |      collections.abc.Sized
     |      collections.abc.Iterable
     |      collections.abc.Container
     |      builtins.object
     |
     |  Methods defined here:
     |
     |  __init__(self, problem_type: str = 'Crash', date: str | None = None) -> None
     |      Initialize a fresh problem report.
     |
     |      problem_type can be 'Crash', 'Packaging', 'KernelCrash' or
     |      'KernelOops'. date is the desired date/time string; if
     |      None (default), the current local time is used.
     |
     |  __setitem__(self, k: str, v: bytes | problem_report.CompressedFile | problem_report.CompressedValue | str | tuple) -> None
     |
     |  add_tags(self, tags: collections.abc.Iterable[str]) -> None
     |      Add tags to the report. Duplicates are dropped.
     |
     |  add_to_existing(self, reportfile: str, keep_times: bool = False) -> None
     |      Add this report's data to an already existing report file.
     |
     |      The file will be temporarily chmod'ed to 000 to prevent frontends
     |      from picking up a hal-updated report file. If keep_times
     |      is True, then the file's atime and mtime restored after updating.
     |
     |  extract_keys(self, file: gzip.GzipFile | typing.BinaryIO, bin_keys: collections.abc.Iterable[str] | str, directory: str) -> None
     |      Extract only given binary elements from the problem report.
     |
     |      Binary elements like kernel crash dumps can be very big. This method
     |      extracts directly files without loading the report into memory.
     |
     |  get_tags(self) -> set[str]
     |      Return the set of tags.
     |
     |  get_timestamp(self) -> int | None
     |      Get timestamp (seconds since epoch) from Date field.
     |
     |      Return None if it is not present.
     |
     |  has_removed_fields(self) -> bool
     |      Check if the report has any keys which were not loaded.
     |
     |      This could happen when using binary=False in load().
     |
     |  load(self, file: gzip.GzipFile | typing.BinaryIO, binary: Union[bool, Literal['compressed']] = True, key_filter: collections.abc.Iterable[str] | None = None) -> None
     |      Initialize problem report from a file-like object.
     |
     |      If binary is False, binary data is not loaded; the dictionary key is
     |      created, but its value will be an empty string. If it is True, it is
     |      transparently uncompressed and available as dictionary byte array
     |      values. If binary is 'compressed', the compressed value is retained,
     |      and the dictionary value will be a CompressedValue object. This is
     |      useful if the compressed value is still useful (to avoid recompression
     |      if the file needs to be written back).
     |
     |      file needs to be opened in binary mode.
     |
     |      If key_filter is given, only those keys will be loaded.
     |
     |      Files are in RFC822 format, but with case sensitive keys.
     |
     |  new_keys(self) -> set[str]
     |      Return newly added keys.
     |
     |      Return the set of keys which have been added to the report since it
     |      was constructed or loaded.
     |
     |  sorted_items(self, keys: collections.abc.Iterable[str] | None = None) -> collections.abc.Iterator[tuple[str, bytes | problem_report.CompressedValue | str | tuple]]
     |      Iterate over all non-internal items sorted.
     |
     |      The most interesting fields will be returned first. The remaining
     |      items will be returned in alphabetical order. Keys starting with
     |      an underscore are considered internal and are skipped. Also values
     |      that are None will be skipped.
     |
     |      If keys is provided, only those keys will be iterated over.
     |
     |  write(self, file: <class 'BinaryIO'>, only_new: bool = False) -> None
     |      Write information into the given file-like object.
     |
     |      If only_new is True, only keys which have been added since the last
     |      load() are written (i. e. those returned by new_keys()).
     |
     |      If a value is a string, it is written directly. Otherwise it must be a
     |      tuple of the form (file, encode=True, limit=None, fail_on_empty=False).
     |      The first argument can be a file name or a file-like object,
     |      which will be read and its content will become the value of this key.
     |      'encode' specifies whether the contents will be
     |      gzip compressed and base64-encoded (this defaults to True). If limit is
     |      set to a positive integer, the file is not attached if it's larger
     |      than the given limit, and the entire key will be removed. If
     |      fail_on_empty is True, reading zero bytes will cause an OSError.
     |
     |      file needs to be opened in binary mode.
     |
     |      Files are written in RFC822 format.
     |
     |  write_mime(self, file, attach_treshold=5, extra_headers=None, skip_keys=None, priority_fields=None)
     |      Write MIME/Multipart RFC 2822 formatted data into file.
     |
     |      file must be a file-like object, not a path.  It needs to be opened in
     |      binary mode.
     |
     |      If a value is a string or a CompressedValue, it is written directly.
     |      Otherwise it must be a tuple containing the source file and an optional
     |      boolean value (in that order); the first argument can be a file name or
     |      a file-like object, which will be read and its content will become the
     |      value of this key.  The file will be gzip compressed, unless the key
     |      already ends in .gz.
     |
     |      attach_treshold specifies the maximum number of lines for a value to be
     |      included into the first inline text part. All bigger values (as well as
     |      all non-ASCII ones) will become an attachment, as well as text
     |      values bigger than 1 kB.
     |
     |      Extra MIME preamble headers can be specified, too, as a dictionary.
     |
     |      skip_keys is a set/list specifying keys which are filtered out and not
     |      written to the destination file.
     |
     |      priority_fields is a set/list specifying the order in which keys should
     |      appear in the destination file.
     |
     |  ----------------------------------------------------------------------
     |  Static methods defined here:
     |
     |  is_binary(string: bytes | str) -> bool
     |      Check if the given strings contains binary data.
     |
     |  ----------------------------------------------------------------------
     |  Data and other attributes defined here:
     |
     |  __abstractmethods__ = frozenset()
     |
     |  ----------------------------------------------------------------------
     |  Methods inherited from collections.UserDict:
     |
     |  __contains__(self, key)
     |      # Modify __contains__ and get() to work like dict
     |      # does when __missing__ is present.
     |
     |  __copy__(self)
     |
     |  __delitem__(self, key)
     |
     |  __getitem__(self, key)
     |
     |  __ior__(self, other)
     |
     |  __iter__(self)
     |
     |  __len__(self)
     |
     |  __or__(self, other)
     |      Return self|value.
     |
     |  __repr__(self)
     |      Return repr(self).
     |
     |  __ror__(self, other)
     |      Return value|self.
     |
     |  copy(self)
     |
     |  get(self, key, default=None)
     |      D.get(k[,d]) -> D[k] if k in D, else d.  d defaults to None.
     |
     |  ----------------------------------------------------------------------
     |  Class methods inherited from collections.UserDict:
     |
     |  fromkeys(iterable, value=None)
     |
     |  ----------------------------------------------------------------------
     |  Data descriptors inherited from collections.UserDict:
     |
     |  __dict__
     |      dictionary for instance variables
     |
     |  __weakref__
     |      list of weak references to the object
     |
     |  ----------------------------------------------------------------------
     |  Methods inherited from collections.abc.MutableMapping:
     |
     |  clear(self)
     |      D.clear() -> None.  Remove all items from D.
     |
     |  pop(self, key, default=<object object at 0x7f50472941d0>)
     |      D.pop(k[,d]) -> v, remove specified key and return the corresponding value.
     |      If key is not found, d is returned if given, otherwise KeyError is raised.
     |
     |  popitem(self)
     |      D.popitem() -> (k, v), remove and return some (key, value) pair
     |      as a 2-tuple; but raise KeyError if D is empty.
     |
     |  setdefault(self, key, default=None)
     |      D.setdefault(k[,d]) -> D.get(k,d), also set D[k]=d if k not in D
     |
     |  update(self, other=(), /, **kwds)
     |      D.update([E, ]**F) -> None.  Update D from mapping/iterable E and F.
     |      If E present and has a .keys() method, does:     for k in E: D[k] = E[k]
     |      If E present and lacks .keys() method, does:     for (k, v) in E: D[k] = v
     |      In either case, this is followed by: for k, v in F.items(): D[k] = v
     |
     |  ----------------------------------------------------------------------
     |  Methods inherited from collections.abc.Mapping:
     |
     |  __eq__(self, other)
     |      Return self==value.
     |
     |  items(self)
     |      D.items() -> a set-like object providing a view on D's items
     |
     |  keys(self)
     |      D.keys() -> a set-like object providing a view on D's keys
     |
     |  values(self)
     |      D.values() -> an object providing a view on D's values
     |
     |  ----------------------------------------------------------------------
     |  Data and other attributes inherited from collections.abc.Mapping:
     |
     |  __hash__ = None
     |
     |  __reversed__ = None
     |
     |  ----------------------------------------------------------------------
     |  Class methods inherited from collections.abc.Collection:
     |
     |  __subclasshook__(C)
     |      Abstract classes can override this to customize issubclass().
     |
     |      This is invoked early on by abc.ABCMeta.__subclasscheck__().
     |      It should return True, False or NotImplemented.  If it returns
     |      NotImplemented, the normal algorithm is used.  Otherwise, it
     |      overrides the normal algorithm (and the outcome is cached).
     |
     |  ----------------------------------------------------------------------
     |  Class methods inherited from collections.abc.Iterable:
     |
     |  __class_getitem__ = GenericAlias(...)
     |      Represent a PEP 585 generic type
     |
     |      E.g. for t = list[int], t.__origin__ is list and t.__args__ is (int,).

DATA
    CHUNK_SIZE = 131072
    GZIP_HEADER_START = b'\x1f\x8b\x08'
    ZSTANDARD_MAGIC_NUMBER = b'(\xb5/\xfd'

FILE
    /usr/lib/python3/dist-packages/problem_report.py


problem_report □✕
NAME CLASSES
class CompressedFile(builtins.object) class CompressedValue(builtins.object) class MalformedProblemReport(builtins.ValueError) class ProblemReport(collections.UserDict)
DATA FILE

Generated by phpman v4.12.29 · Markdown · JSON Author: Che Dong Under GNU General Public License
2026-12-03 06:15 @216.73.216.10
CrawledBy Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
Valid XHTML 1.0 Transitional!Valid CSS!

^_top_^