How to use the arsenic.Arsenic.persist function in arsenic

To help you get started, we’ve selected a few arsenic 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 KittyHawkIrc / core / arsenic.py View on Github external
setattr(self, 'isop', auth)
            setattr(self, 'isowner', owner)
            setattr(self, 'type', 'privmsg')
            setattr(self, 'command', command)
            setattr(self, 'message', msg)
            setattr(self, 'user', user)  # This will change to a profile object soon!
            setattr(self, 'channel', channel)
            setattr(self, 'ver', VER)
            setattr(self, 'profile', profile)  # Provide profile support to modules (temporary!)

            if command in mod_declare_privmsg:
                try:
                    self.lockerbox[mod_declare_privmsg[command]]
                except:
                    self.lockerbox[mod_declare_privmsg[
                        command]] = self.persist()

                # attributes
                setattr(self, 'store', save)
                setattr(self, 'locker', self.lockerbox[
                    mod_declare_privmsg[command]])

                ##### Hijack config object functions to reduce scope

                def __config_get__(item, default=False):  # stubs, basically
                    return config.get(mod_declare_privmsg[command], item, default)

                def __config_set__(item, value):
                    return config.set(mod_declare_privmsg[command], item, value)

                def __config_remove__(item):
                    return config_remove(mod_declare_privmsg[command], item)
github KittyHawkIrc / core / arsenic.py View on Github external
def __config_set__(item, value):
            return config.set(mod_declare_privmsg[command], item, value)

        def __config_remove__(item):
            return config_remove(mod_declare_privmsg[command], item)

        setattr(self, 'config_get', __config_get__)
        setattr(self, 'config_set', __config_set__)
        setattr(self, 'config_remove', __config_remove__)

        for command in mod_declare_syncmsg:
            try:
                self.lockerbox[command]
            except:
                self.lockerbox[command] = self.persist()
            setattr(self, 'locker', self.lockerbox[command])

            modlook[
                mod_declare_syncmsg[command]].callback(
                    self)
github KittyHawkIrc / core / arsenic.py View on Github external
"""Twisted callbacks registered here"""

    def __init__(self, profileManager, cache_fd, extra=False):
        self.profileManager = profileManager
        self.__extra__ = extra
        self.cache_fd = cache_fd
        if extra:
            self.msg = extra.msg

        return

    class persist:
        def __init__(self):
            pass

    save = persist()

    lockerbox = {}

    floodprotect = False

    versionName = 'KittyHawk'
    versionNum = VER
    versionEnv = platform.platform()
    sourceURL = "https://github.com/KittyHawkIRC"

    def ctcp(self, data):
        data = data.strip('\x01')
        if data.startswith('CLIENTINFO'):
            return [('CLIENTINFO', 'ACTION CLIENTINFO PING SOURCE TIME VERSION')]
        elif data.startswith('VERSION'):
            return [('VERSION', '%s %s (%s)' % (self.versionName, self.versionNum, self.versionEnv))]