Skip to content

IODeviceMixin

Base classes

Name Children Inherits
ObjectMixin
prettyqt.core.object

Subclasses

Class Module Description
IODevice prettyqt.core.iodevice
FileDeviceMixin prettyqt.core.filedevice Interface for reading from and writing to open files.
Buffer prettyqt.core.buffer
Process prettyqt.core.process
BluetoothSocket prettyqt.bluetooth.bluetoothsocket
AbstractSocketMixin prettyqt.network.abstractsocket
LocalSocket prettyqt.network.localsocket

⋔ Inheritance diagram

graph TD
  1473299871632["core.IODeviceMixin"]
  1473299815024["core.ObjectMixin"]
  140713234304496["builtins.object"]
  1473299815024 --> 1473299871632
  140713234304496 --> 1473299815024

🛈 DocStrings

Bases: ObjectMixin

Source code in prettyqt\core\iodevice.py
class IODeviceMixin(core.ObjectMixin):
    def __len__(self):
        return self.size()

    @contextlib.contextmanager
    def open_file(self, mode: OpenModeStr | mod.OpenModeFlag):
        self.open(OPEN_MODES.get_enum_value(mode))
        yield self
        self.close()

    def get_open_mode(self) -> OpenModeStr:
        return OPEN_MODES.inverse[self.openMode()]