How to use the overrides.i3ipc.Connection function in overrides

To help you get started, we’ve selected a few overrides examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github altdesktop / i3ipc-python / overrides / i3ipc.py View on Github external
from gi.repository.GLib import MainLoop
from ..module import get_introspection_module
from ..overrides import override

i3ipc = get_introspection_module('i3ipc')

__all__ = []

class Connection(i3ipc.Connection):
    def main(self):
        main_loop = MainLoop()
        self.connect('ipc_shutdown', lambda self: main_loop.quit())
        main_loop.run()

Connection = override(Connection)
__all__.append('Connection')

class Con(i3ipc.Con):
    def __getattr__(self, name):
        if name == 'nodes':
            return self.get_nodes()
        try:
            return self.get_property(name)
        except TypeError:
            raise AttributeError


Con = override(Con)
__all__.append('Con')

overrides

A decorator to automatically detect mismatch when overriding a method.

Apache-2.0
Latest version published 11 months ago

Package Health Score

81 / 100
Full package analysis

Similar packages