Skip to content

ProcessEnvironment

Base classes

Name Children Inherits
QProcessEnvironment
PySide6.QtCore
QProcessEnvironment(self, /) -> None
MutableMapping
collections.abc
A MutableMapping is a generic container for associating

⋔ Inheritance diagram

graph TD
  2340126189["core.ProcessEnvironment"]
  3601839297["QtCore.QProcessEnvironment"]
  37984305["Shiboken.Object"]
  2751680898["builtins.object"]
  1799060090["abc.MutableMapping"]
  4016029557["abc.Mapping"]
  2852422536["abc.Collection"]
  4051874921["abc.Sized"]
  2021119437["abc.Iterable"]
  1031828782["abc.Container"]
  3601839297 --> 2340126189
  37984305 --> 3601839297
  2751680898 --> 37984305
  1799060090 --> 2340126189
  4016029557 --> 1799060090
  2852422536 --> 4016029557
  4051874921 --> 2852422536
  2751680898 --> 4051874921
  2021119437 --> 2852422536
  2751680898 --> 2021119437
  1031828782 --> 2852422536
  2751680898 --> 1031828782

🛈 DocStrings

Bases: QProcessEnvironment, MutableMapping

Holds the environment variables that can be passed to a program.

Source code in prettyqt/core/processenvironment.py
class ProcessEnvironment(
    QtCore.QProcessEnvironment, MutableMapping, metaclass=datatypes.QABCMeta
):
    """Holds the environment variables that can be passed to a program."""

    def __bool__(self):
        return not self.isEmpty()

    def __contains__(self, other: str):
        return self.contains(other)

    def __getitem__(self, index: str) -> str:
        if index not in self:
            msg = "Environment variable not set."
            raise KeyError(msg)
        return self.value(index)

    def __delitem__(self, index: str):
        self.remove(index)

    def __setitem__(self, index: str, value: str):
        return self.insert(index, value)

    def __iter__(self) -> Iterator[str]:
        return iter(self.keys())

    def __len__(self):
        return len(self.keys())

    @classmethod
    def get_system_environment(cls) -> Self:
        return cls(cls.systemEnvironment())

:fa-brands-github: Show source on GitHub