def __init__(self, callback=None): """ Creates a polling object and a dictionary of handlers. """ self.log = getlog(self) self.fd = dict() #: A dictionary of handlers ``{fd: server}`` self.poll = select.poll() #: The polling object if callback is not None: self.set_callback(callback)
def __init__ (self, address, port): """ Prepare configuration """ self.log = getlog(self) self.address = address #: The servers address self.port = port #: The servers port self.socket = None #: The socket that has a connection to the server self._buffer = "" #: The primary buffer for incoming data self.buffer = list() #: The secondary buffer for lines read from the primary buffer
def __init__ (self, config): # Setup logging self.log = getlog(self) self.log.info("Initialising") #: The top-level configuration dictionary self.config = config # The dispatcher recives the events generated by the reactor self.dispatcher = Dispatcher(self.config['modules']) self.reactor = Reactor(self.config, self.config.pop('connections'))
def __init__ (self, listeners=None): self.log = getlog(self) self.listeners = listeners
def __init__ (self, group, log=None): self.log = log or getlog(self) self.group = group self.entry_points = {ep.name: ep for ep in iter_entry_points(group=self.group)}