本文整理汇总了Python中dispatcher.Dispatcher.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python Dispatcher.__init__方法的具体用法?Python Dispatcher.__init__怎么用?Python Dispatcher.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dispatcher.Dispatcher
的用法示例。
在下文中一共展示了Dispatcher.__init__方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from dispatcher import Dispatcher [as 别名]
# 或者: from dispatcher.Dispatcher import __init__ [as 别名]
def __init__(self, server, parent=None):
Dispatcher.__init__(self, server, parent)
self.vm = VmManager()
self.vm.loadAllMachines()
#externalToVm --> {clientId: [(vmId, vmInfo),]}
self.externalToVm = {}
self.callbacks = {
Message.CMD_START_VM: self.startVM,
Message.CMD_CLOSE_VM: self.closeVM,
Message.CMD_RESET_VM: self.resetVM,
Message.CMD_QUERY_VMS: self.queryVms,
Message.CMD_QUERY_GPS: self.queryGPS,
Message.CMD_UPDATE_VM: self.updateVm,
Message.CMD_UPDATE_GPS: self.updateGps,
Message.CMD_ADD_GPS: self.addGps,
Message.CMD_DELETE_GPS: self.deleteGps,
Message.CMD_ADD_ACCOUNT: self.addAccount,
Message.CMD_QUERY_ACCOUNT: self.queryAccount,
Message.CMD_DELETE_ACCOUNT: self.deleteAccount,
}
self.server.clientDisconnected.connect(self.clearVmForClient)
EventManager.bind('DataCenter.gpsLoaded', self._sendGpsData)
EventManager.bind('DataCenter.gpsUpdated', self._updateGpsData)
EventManager.bind('DataCenter.gpsAdded', self._addGpsData)
EventManager.bind('DataCenter.gpsDeleted', self._deleteGpsData)
EventManager.bind('DataCenter.accountAdded', self._addAccountData)
EventManager.bind('DataCenter.accountLoaded', self._sendAccountData)
EventManager.bind('DataCenter.accountDeleted', self._deleteAccountData)
示例2: __init__
# 需要导入模块: from dispatcher import Dispatcher [as 别名]
# 或者: from dispatcher.Dispatcher import __init__ [as 别名]
def __init__(self, destaddr, output=None):
Dispatcher.__init__(self)
self.eventloop = EventLoop()
self.starttime = None
self.output = output
self.ready = True
self.max_ttl = 16
self.current_ttl = 16
self.min_ttl = 0
self.ident = -1
try:
sock = socket.socket(socket.AF_INET, socket.SOCK_RAW, socket.IPPROTO_UDP)
sock.setsockopt(socket.IPPROTO_IP, socket.IP_HDRINCL, 1)
self.set_socket(sock)
except socket.error, err:
if _sockerror(err.args[0]) == 'EPERM':
logging.root.error('You need sudo privilages to use raw sockets')
else:
log_str = 'Socket Error: %s' % _sockerror(err.args[0])
logging.root.error(log_str)
sys.exit(-1)
示例3: __init__
# 需要导入模块: from dispatcher import Dispatcher [as 别名]
# 或者: from dispatcher.Dispatcher import __init__ [as 别名]
def __init__(self):
self.width = 3
self.height = 3
Deferrer.__init__(self)
Dispatcher.__init__(self)
self.data = util.make2dArray(self.width, self.height, None)
self.curPlayer = 1
示例4: __init__
# 需要导入模块: from dispatcher import Dispatcher [as 别名]
# 或者: from dispatcher.Dispatcher import __init__ [as 别名]
def __init__(self, clientManager, parent=None):
Dispatcher.__init__(self, clientManager, parent)
self.callbacks = {
Message.CMD_CLIENT_VALIDATED: self.loadResources,
Message.CMD_QUERY_VMS_OK: self.loadVms,
Message.CMD_UPDATE_VM_OK: self.handleUpdateVmOk,
Message.CMD_VM_START_OK: self.handleVmStartOk,
Message.CMD_VM_START_FAIL: self.handleVmStartFail,
Message.CMD_VM_UPDATED: self.updateVm,
Message.CMD_QUERY_GPS_OK: self.loadGps,
Message.CMD_ADD_GPS_OK: self.handleAddGpsOk,
Message.CMD_UPDATE_GPS_OK: self.handleUpdateGpsOk,
Message.CMD_GPS_UPDATED: self.updateGps,
Message.CMD_GPS_ADDED: self.loadGps,
Message.CMD_GPS_DELETED: self.deleteGps,
Message.CMD_DELETE_GPS_OK: self.handleDeleteGpsOk,
Message.CMD_ACCOUNT_ADDED: self.loadAccounts,
Message.CMD_QUERY_ACCOUNT: self.loadAccounts,
Message.CMD_QUERY_ACCOUNT_OK: self.loadAccounts,
Message.CMD_ADD_ACCOUNT_OK: self.handleAddAccountOk,
Message.CMD_DELETE_ACCOUNT_OK: self.handleDeleteAccountsOk,
Message.CMD_ACCOUNT_DELETED: self.deleteAccounts
}
示例5: __init__
# 需要导入模块: from dispatcher import Dispatcher [as 别名]
# 或者: from dispatcher.Dispatcher import __init__ [as 别名]
def __init__(self, canvas, x, y, width, height, options={}):
Dispatcher.__init__(self)
self.obj_id = None
self.canvas = canvas
self.x = x
self.y = y
self.width = width
self.height = height
self.options = options
示例6: __init__
# 需要导入模块: from dispatcher import Dispatcher [as 别名]
# 或者: from dispatcher.Dispatcher import __init__ [as 别名]
def __init__(self, connection):
Dispatcher.__init__(self, 3, SASL_FRAME)
self.connection = connection
self.mechanisms = None
self.mechanism = None
self.username = None
self.password = None
self.output_redirect = False
self.outcome = None
示例7: __init__
# 需要导入模块: from dispatcher import Dispatcher [as 别名]
# 或者: from dispatcher.Dispatcher import __init__ [as 别名]
def __init__(self, sockaddr=DEFAULT_ADDR):
asynchat.async_chat.__init__(self)
Dispatcher.__init__(self)
self._host, self._port = sockaddr
self._receiver_thread = None
self._receiver_thread_exiting = threading.Event()
self._receiver_thread_exited = False
self._ibuffer = ""
# IQfeed separates rows with newline
self.set_terminator("\r\n")
示例8: __init__
# 需要导入模块: from dispatcher import Dispatcher [as 别名]
# 或者: from dispatcher.Dispatcher import __init__ [as 别名]
def __init__(self, sockaddr=DEFAULT_ADDR, log=None):
asynchat.async_chat.__init__(self)
Dispatcher.__init__(self)
self._host, self._port = sockaddr
self._receiver_thread = threading.Thread(None, _start_receive_loop)
self._close_event = threading.Event()
self._ibuffer = ""
self._log = log
# IQfeed separates rows with newline
self.set_terminator("\n")
示例9: __init__
# 需要导入模块: from dispatcher import Dispatcher [as 别名]
# 或者: from dispatcher.Dispatcher import __init__ [as 别名]
def __init__(self, tasks):
Dispatcher.__init__(self, tasks, SyncReporter(tasks))
# create remote directory if it does not exists
# this create remote-dir and remote-dir/satt
for t in tasks:
m = '{0}@{1}'.format(configs['ssh-user'], t.getMachine())
dbg('Creating remote directory on {0}'.format(t.getMachine()))
subprocess.call(['ssh', m,
'mkdir', '-p',
'{0}/satt'.format(configs['remote-dir'])])
示例10: __init__
# 需要导入模块: from dispatcher import Dispatcher [as 别名]
# 或者: from dispatcher.Dispatcher import __init__ [as 别名]
def __init__(self, canvas, x, y, num_x, num_y, rec_width, rec_height, reccls, rec_options={}):
Dispatcher.__init__(self)
self.canvas = canvas
self.x = x
self.y = y
self.num_x = num_x
self.num_y = num_y
self.rec_width = rec_width
self.rec_height = rec_height
self.reccls = reccls
self.rec_options = rec_options
self.map_rec = {}
Grid.regcb(self)
示例11: __init__
# 需要导入模块: from dispatcher import Dispatcher [as 别名]
# 或者: from dispatcher.Dispatcher import __init__ [as 别名]
def __init__(self, destaddr):
Dispatcher.__init__(self)
self.eventloop = EventLoop()
self.destaddr = destaddr
self.srcaddr = ("0.0.0.0", 1)
try:
sock = socket.socket(socket.AF_INET, socket.SOCK_RAW, socket.IPPROTO_ICMP)
self.set_socket(sock)
self.bind(self.srcaddr)
except socket.error, err:
log_str = "Socket Error: %s" % _sockerror(err.args[0])
logging.root.exception(log_str)
sys.exit(-1)
示例12: __init__
# 需要导入模块: from dispatcher import Dispatcher [as 别名]
# 或者: from dispatcher.Dispatcher import __init__ [as 别名]
def __init__(self, factory):
Dispatcher.__init__(self, 0, AMQP_FRAME)
self.factory = factory
self.container_id = None
self.open_rcvd = False
self.open_sent = False
self.close_rcvd = False
self.close_sent = False
self.exception = None
# incoming channel -> session
self.incoming = {}
# outgoing channel -> session
self.outgoing = {}
self.max_frame_size = 4294967295
示例13: __init__
# 需要导入模块: from dispatcher import Dispatcher [as 别名]
# 或者: from dispatcher.Dispatcher import __init__ [as 别名]
def __init__(self, server, parent=None):
Dispatcher.__init__(self, server, parent)
示例14: __init__
# 需要导入模块: from dispatcher import Dispatcher [as 别名]
# 或者: from dispatcher.Dispatcher import __init__ [as 别名]
def __init__(self, sockaddr=DEFAULT_ADDR):
Dispatcher.__init__(self)
self._host, self._port = sockaddr
#self._close_event = threading.Event()
self._ibuffer = ""