def __init__(self, func, *args, **kwargs): Thread.__init__(self) Mode.__init__(self) self.func = func self.args = args self.kwargs = kwargs self.data = None self.is_done = False core.gear.pool.append(self) self.start()
def __init__(self, *args): """ """ self.child = Popen(args, shell=0, stdout=PIPE, stdin=PIPE, stderr=STDOUT, env=environ) self.stdin = self.child.stdin self.stdout = self.child.stdout self.stderr = self.child.stderr self.args = args self.queue = Queue() self.terminate = self.child.terminate core.gear.pool.append(self) Mode.__init__(self) Thread.__init__(self) self.start()
def __init__(self, sock=None): socket.__init__(self, _sock = sock._sock if sock else None) Mode.__init__(self) self.setblocking(0)
import sys from untwisted.mode import Mode from untwisted.event import TICK, CLOSE from untwisted.magic import sign from untwisted.core import gear import util import debug EXIT_DELAY_SECONDS = 0.1 b_link = util.LinkSet() mode = Mode() mode.domain = 'run' mode.poll = mode gear.tick_list.append(mode) m_link = util.LinkSet() #if '--debug' in sys.argv: m_link.link_module(debug) sleepers = list() def install(bot): b_link.install(bot) m_link.install(mode) def uninstall(bot): m_link.uninstall(mode)
from untwisted.utils.common import append, shrug from untwisted.magic import sign import util import debug import runtime import bridge from util import NotInstalled, AlreadyInstalled RECONNECT_DELAY_SECONDS = 1 conf_servers = util.table('conf/minecraft.py', 'server', socket.__dict__) mc_work = [] mc_mode = Mode() mc_mode.domain = 'mc' mc_link = util.LinkSet() mc_link.link_module(std) mc_link.link(DATA, append) mc_link.link(BUFFER, shrug, '\n') if '--debug' in sys.argv: mc_link.link_module(debug) ab_mode = None ab_link = util.LinkSet() class MinecraftState(object): def __init__(self): self.map_name = None self.agent = None
from untwisted.network import Work from untwisted.event import DATA, BUFFER, FOUND, CLOSE, RECV_ERR from untwisted.utils import std from untwisted.utils.common import append, shrug from untwisted.magic import sign import util import debug import runtime from util import NotInstalled, AlreadyInstalled SOCKET_ADDRESS = 'state/chess' RECONNECT_DELAY_SECONDS = 1 ch_work = [] ch_mode = Mode() ch_mode.domain = 'ch' ch_link = util.LinkSet() ch_link.link_module(std) ch_link.link(DATA, append) ch_link.link(BUFFER, shrug, '\n') if '--debug' in sys.argv: ch_link.link_module(debug) ab_mode = None ab_link = util.LinkSet() @ab_link(('HELP', 'chess')) def h_help(bot, reply, args): reply('chess start', 'Starts a new game of chess.')
def __init__(self, sock=None): socket.__init__(self, _sock=sock._sock if sock else None) Mode.__init__(self) self.setblocking(0)