pydoc > problem_report.ProblemReport

Help on class ProblemReport in problem_report:

problem_report.ProblemReport = class ProblemReport(collections.UserDict)
 |  problem_report.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 0x7ffa1c7141d0>)
 |      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,).

Generated by phpman v4.12.29 · Markdown · JSON Author: Che Dong Under GNU General Public License
2026-12-04 07:15 @216.73.216.5
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_^