How to use the overrides.override 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 GNOME / gedit / gedit / Gedit.py View on Github external
msg = self.create(object_path, method, **kwargs)
        self.send_message(msg)

        return msg

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

class Message(Gedit.Message):
    def __getattribute__(self, name):
        try:
            return Gedit.Message.__getattribute__(self, name)
        except:
            return getattr(self.props, name)

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


def get_trace_info(num_back_frames=0):
    frame = inspect.currentframe().f_back
    try:
        for i in range(num_back_frames):
            back_frame = frame.f_back
            if back_frame == None:
                break
            frame = back_frame

        filename = frame.f_code.co_filename

        # http://code.activestate.com/recipes/145297-grabbing-the-current-line-number-easily/
        lineno = frame.f_lineno
github TingPing / irc-client / lib / Irc.py View on Github external
from ..overrides import override

Irc = get_introspection_module('Irc')
__all__ = []

class Message(Irc.Message):
	def __str__(self):
		return str({
			'time': self.timestamp,
			'sender': self.sender,
			'command': self.command,
			'numeric': self.numeric,
			'params': self.params,
		})

Message = override (Message)
__all__.append('Message')
github GNOME / gedit / gedit / Gedit.py View on Github external
@override(Gedit.debug_plugin_message)
def debug_plugin_message(format, *format_args):
    filename, lineno, func_name = get_trace_info(1)
    orig_debug_plugin_message_func(filename, lineno, func_name, format % format_args)
__all__.append(debug_plugin_message)
github GNOME / gedit / gedit / Gedit.py View on Github external
return GObject.new(tp, **kwargs)

    def send_sync(self, object_path, method, **kwargs):
        msg = self.create(object_path, method, **kwargs)
        self.send_message_sync(msg)

        return msg

    def send(self, object_path, method, **kwargs):
        msg = self.create(object_path, method, **kwargs)
        self.send_message(msg)

        return msg

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

class Message(Gedit.Message):
    def __getattribute__(self, name):
        try:
            return Gedit.Message.__getattribute__(self, name)
        except:
            return getattr(self.props, name)

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


def get_trace_info(num_back_frames=0):
    frame = inspect.currentframe().f_back
    try:

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