本文整理汇总了Python中pyee.EventEmitter.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python EventEmitter.__init__方法的具体用法?Python EventEmitter.__init__怎么用?Python EventEmitter.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyee.EventEmitter
的用法示例。
在下文中一共展示了EventEmitter.__init__方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from pyee import EventEmitter [as 别名]
# 或者: from pyee.EventEmitter import __init__ [as 别名]
def __init__(self, address):
EventEmitter.__init__(self)
threading.Thread.__init__(self)
self.sp = serial.Serial(address, timeout=1)
self.alive = True
self.lock = threading.Lock()
示例2: __init__
# 需要导入模块: from pyee import EventEmitter [as 别名]
# 或者: from pyee.EventEmitter import __init__ [as 别名]
def __init__(self, url, debug=False):
WebSocketClient.__init__(self, url)
EventEmitter.__init__(self)
self.debug = debug
self._session = None
self._uniq_id = 0
self._callbacks = {}
示例3: __init__
# 需要导入模块: from pyee import EventEmitter [as 别名]
# 或者: from pyee.EventEmitter import __init__ [as 别名]
def __init__(self, **kwargs):
EventEmitter.__init__(self)
for key, value in kwargs.iteritems():
setattr(self, key, value)
component_config = types.ComponentConfig(realm = u"sputnik")
wamp.ApplicationSessionFactory.__init__(self, config=component_config)
示例4: __init__
# 需要导入模块: from pyee import EventEmitter [as 别名]
# 或者: from pyee.EventEmitter import __init__ [as 别名]
def __init__(self, url, debug=False):
self.debug = debug
# by default socket connections don't timeout. this causes issues
# where reconnects can get stuck
# TODO: make this configurable?
socket.setdefaulttimeout(10)
WebSocketClient.__init__(self, url)
EventEmitter.__init__(self)
示例5: __init__
# 需要导入模块: from pyee import EventEmitter [as 别名]
# 或者: from pyee.EventEmitter import __init__ [as 别名]
def __init__(self, id=None, secret=None, endpoint="https://api.coinsetter.com/v1"):
EventEmitter.__init__(self)
self.username = id
self.password = secret
self.endpoint = endpoint
self.session_id = None
from urllib2 import urlopen
self.ip = json.load(urlopen('http://jsonip.com'))['ip']
示例6: __init__
# 需要导入模块: from pyee import EventEmitter [as 别名]
# 或者: from pyee.EventEmitter import __init__ [as 别名]
def __init__(self, log, clock, script_path, id, app, name, popen=subprocess.Popen):
EventEmitter.__init__(self)
self.log = log
self.clock = clock
self.script_path = script_path
self.app = app
self.name = name
self.runner = None
self._name = "%s-%s-%s" % (id, app, name)
self._popen = popen
示例7: __init__
# 需要导入模块: from pyee import EventEmitter [as 别名]
# 或者: from pyee.EventEmitter import __init__ [as 别名]
def __init__(self):
"""Constructor."""
# run the superclass constructor
EventEmitter.__init__(self)
self.type = None
self.control_elements = []
self.data_conditions = []
# sensor_id should be unique
rndnum = random.randint(0, 100000)
self.sensor_id = "sensor" + str(rndnum)
示例8: __init__
# 需要导入模块: from pyee import EventEmitter [as 别名]
# 或者: from pyee.EventEmitter import __init__ [as 别名]
def __init__(self, clock, container, id, app, name,
image, command, config, port_pool, port):
EventEmitter.__init__(self)
self.clock = clock
self.id = id
self.app = app
self.name = name
self.image = image
self.command = command
self.config = config
self.port_pool = port_pool
self.port = port
self.state = 'init'
self._container = container
示例9: __init__
# 需要导入模块: from pyee import EventEmitter [as 别名]
# 或者: from pyee.EventEmitter import __init__ [as 别名]
def __init__(self, url, auto_reconnect=True, auto_reconnect_timeout=0.5, debug=False):
EventEmitter.__init__(self)
self.collection_data = CollectionData()
self.ddp_client = DDPClient(url, auto_reconnect=auto_reconnect,
auto_reconnect_timeout=auto_reconnect_timeout, debug=debug)
self.ddp_client.on('connected', self.connected)
self.ddp_client.on('socket_closed', self.closed)
self.ddp_client.on('failed', self.failed)
self.ddp_client.on('added', self.added)
self.ddp_client.on('changed', self.changed)
self.ddp_client.on('removed', self.removed)
self.ddp_client.on('reconnected', self._reconnected)
self.connected = False
self.subscriptions = {}
self._login_data = None
示例10: __init__
# 需要导入模块: from pyee import EventEmitter [as 别名]
# 或者: from pyee.EventEmitter import __init__ [as 别名]
def __init__(
self, # type: Any
addr, # type: str
port, # type: int
prot=default_protocol, # type: Protocol
out_addr=None, # type: Union[None, Tuple[str, int]]
debug_level=0 # type: int
): # type: (...) -> None
"""Initializes a peer to peer socket
Args:
addr: The address you wish to bind to (ie: "192.168.1.1")
port: The port you wish to bind to (ie: 44565)
prot: The protocol you wish to operate over, defined by a
:py:class:`py2p.base.Protocol` object
out_addr: Your outward facing address. Only needed if you're
connecting over the internet. If you use '0.0.0.0'
for the addr argument, this will automatically be
set to your LAN address.
debug_level: The verbosity you want this socket to use when
printing event data
Raises:
socket.error: The address you wanted could not be bound, or is
otherwise used
"""
object.__init__(self)
EventEmitter.__init__(self)
self.protocol = prot
self.debug_level = debug_level
self.routing_table = {} # type: Dict[bytes, BaseConnection]
# In format {ID: handler}
self.awaiting_ids = [] # type: List[BaseConnection]
# Connected, but not handshook yet
if out_addr: # Outward facing address, if you're port forwarding
self.out_addr = out_addr
elif addr == '0.0.0.0':
self.out_addr = get_lan_ip(), port
else:
self.out_addr = addr, port
info = (str(self.out_addr).encode(), prot.id.encode(), user_salt)
h = sha384(b''.join(info))
self.id = b58encode_int(int(h.hexdigest(), 16)).encode() # type: bytes
self._logger = getLogger('{}.{}.{}'.format(
self.__class__.__module__, self.__class__.__name__, self.id))
self.__handlers = [
] # type: List[Callable[[Message, BaseConnection], Union[bool, None]]]
self.__closed = False
示例11: __init__
# 需要导入模块: from pyee import EventEmitter [as 别名]
# 或者: from pyee.EventEmitter import __init__ [as 别名]
def __init__(self, url, auto_reconnect=True, auto_reconnect_timeout=0.5, debug=False, headers=None):
EventEmitter.__init__(self)
self.ddpsocket = None
self._ddp_version_index = 0
self._retry_new_version = False
self._is_closing = False
self._is_reconnecting = False
self.url = url
self.auto_reconnect = auto_reconnect
self.auto_reconnect_timeout = auto_reconnect_timeout
self.debug = debug
self.headers = [('Host', self._get_domain_from_url(self.url))].append(headers)
self._session = None
self._uniq_id = 0
self._callbacks = {}
self._init_socket()
示例12: __init__
# 需要导入模块: from pyee import EventEmitter [as 别名]
# 或者: from pyee.EventEmitter import __init__ [as 别名]
def __init__(self):
"""Constructor."""
# run the superclass constructor
EventEmitter.__init__(self)
# Model initialization code
self.participant_id = ""
self.experiment_file = None
self.sensors = []
self.experiment = None
# define important directories for external (not program code) files
homedir = os.environ["HOME"]
drop_home = os.path.join(homedir, "Documents", "drop_data")
self.rootdir = drop_home
self.savedir = os.path.join(drop_home, "recordings")
self.experimentdir = os.path.join(drop_home, "experiments")
self.mediadir = os.path.join(drop_home, "media")
self.plugindir = os.path.join(drop_home, "plugins")
self.dependenciesdir = os.path.join(drop_home, "dependencies")
# check that saving, experiment etc directories are present
utils.dircheck(self.savedir)
utils.dircheck(self.experimentdir)
utils.dircheck(self.mediadir)
utils.dircheck(self.plugindir)
utils.dircheck(self.dependenciesdir)
# put the plugins-directory and dependenciesdir to python path
sys.path.append(self.plugindir)
sys.path.append(self.dependenciesdir)
# temporary? keyboard-contigency list
self.keyboard_contigency = []
# initialize plugin manager
self.pluginmanager = PluginManager(plugin_locator=DropPluginLocator())
self.pluginmanager.setPluginPlaces([self.plugindir])
self.pluginmanager.collectPlugins()
# initialize pygtk-view
self.ec = DPV(self, self.mediadir, self.experimentdir)
self.ec.main()
示例13: __init__
# 需要导入模块: from pyee import EventEmitter [as 别名]
# 或者: from pyee.EventEmitter import __init__ [as 别名]
def __init__(self, verification_token):
EventEmitter.__init__(self)
self.verification_token = verification_token