当前位置: 首页>>代码示例>>Python>>正文


Python blinker.Signal方法代码示例

本文整理汇总了Python中blinker.Signal方法的典型用法代码示例。如果您正苦于以下问题:Python blinker.Signal方法的具体用法?Python blinker.Signal怎么用?Python blinker.Signal使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在blinker的用法示例。


在下文中一共展示了blinker.Signal方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: import blinker [as 别名]
# 或者: from blinker import Signal [as 别名]
def __init__(self, url, secret=None, cxn_cls=Connection, **kwargs):
				self.url = url
				self.secret = secret
				self.state = self.DISCONNECTED
				self.cxn_cls = cxn_cls
				self.cxn = None
				self.cxn_kwargs = kwargs
				self.cxns = 0
				self.created = threading.Event()
				self.plugins = []
				self.plugin_idx = {}
				self.txns = {}
				self.txn_q = []
				self._connected = None
				self._disconnected = None
				self._created = None

		# Signal fired when `Session` has been connected. 
开发者ID:AstroPrint,项目名称:AstroBox,代码行数:20,代码来源:janus.py

示例2: add

# 需要导入模块: import blinker [as 别名]
# 或者: from blinker import Signal [as 别名]
def add(self, signal_name, receiver, sender=ANY):
        """
        增加订阅者

        e.g.::

            def callback_function_for_app(sender, **kwargs):
                pass
            def callback_function_for_all(sender, **kwargs):
                pass
            my_signal = signal('test')
            observer.add(my_signal, callback_function_for_app, 'APP')
            observer.add(my_signal, callback_function_for_all)

        :param signal_name: 订阅的主题, 信号
        :param receiver: 订阅者回调方法
        :param sender: ANY, 'ANY' 面向所有发布者(默认), 'APP', current_app._get_current_object() 当前 APP
        :return:
        """
        if isinstance(signal_name, Signal) and hasattr(receiver, '__call__'):
            self._observers.append({
                'signal_name': signal_name,
                'receiver': receiver,
                'sender': sender,
            }) 
开发者ID:fufuok,项目名称:FF.PyAdmin,代码行数:27,代码来源:observer.py

示例3: __init__

# 需要导入模块: import blinker [as 别名]
# 或者: from blinker import Signal [as 别名]
def __init__(self, host='localhost', port=9091, *, tls=False, user='',
                 password='', path='/transmission/rpc', enabled=True):
        self.host = host
        self.port = port
        self.path = path
        self.tls = tls
        self.user = user
        self.password = password
        self._headers = {'content-type': 'application/json'}
        self._session = None
        self._enabled_event = asyncio.Event()
        self.enabled = enabled
        self._request_lock = asyncio.Lock()
        self._connecting_lock = asyncio.Lock()
        self._connection_tested = False
        self._connection_exception = None
        self._timeout = TIMEOUT
        self._version = None
        self._rpcversion = None
        self._rpcversionmin = None
        self._on_connecting = Signal()
        self._on_connected = Signal()
        self._on_disconnected = Signal()
        self._on_error = Signal() 
开发者ID:rndusr,项目名称:stig,代码行数:26,代码来源:rpc.py

示例4: on

# 需要导入模块: import blinker [as 别名]
# 或者: from blinker import Signal [as 别名]
def on(self, signal, callback, autoremove=True):
        """
        Register `callback` for `signal`

        signal: 'connecting', 'connected', 'disconnected' or 'error'
        callback: a callable that receives this instance as a positional
                  argument and, in case of the 'error' signal, the exception as
                  a keyword argument with the name 'error'

        Callbacks are automatically unsubscribed when they are
        garbage-collected.
        """
        try:
            sig = getattr(self, '_on_' + signal)
        except AttributeError:
            raise ValueError('Unknown signal: {!r}'.format(signal))
        else:
            if not isinstance(sig, Signal):
                raise ValueError('Unknown signal: {!r}'.format(signal))
            else:
                log.debug('Registering %r for %r event', callback, signal)
                sig.connect(callback, weak=autoremove) 
开发者ID:rndusr,项目名称:stig,代码行数:24,代码来源:rpc.py

示例5: __init__

# 需要导入模块: import blinker [as 别名]
# 或者: from blinker import Signal [as 别名]
def __init__(self, srvapi, interval=1):
        self._session_stats_updated = False
        self._tcounts_updated = False
        self._reset_session_stats()
        self._reset_tcounts()
        self._on_update = blinker.Signal()

        self._poller_stats = RequestPoller(srvapi.rpc.session_stats,
                                           interval=interval)
        self._poller_stats.on_response(self._handle_session_stats)
        self._poller_stats.on_error(lambda e: log.debug('Ignoring exception: %r', e),
                                    autoremove=False)

        # 'session-stats' provides some counters, but not enough, so we
        # request a minimalistic torrent list.
        self._poller_tcount = RequestPoller(srvapi.torrent.torrents,
                                            keys=('rate-down', 'rate-up', 'status'),
                                            interval=interval)
        self._poller_tcount.on_response(self._handle_torrent_list) 
开发者ID:rndusr,项目名称:stig,代码行数:21,代码来源:api_status.py

示例6: __init__

# 需要导入模块: import blinker [as 别名]
# 或者: from blinker import Signal [as 别名]
def __init__(self, name, owningNode, direction, **kwargs):
        """
        :param name: Pin name
        :type name: string
        :param owningNode: Owning Node
        :type owningNode: :py:class:`PyFlow.Core.NodeBase.NodeBase`
        :param direction: PinDirection , can be input or output
        :type direction: :py:class:`PyFlow.Core.Common.PinDirection`
        """
        super(AnyPin, self).__init__(name, owningNode, direction, **kwargs)
        self.typeChanged = Signal(str)
        self.dataTypeBeenSet = Signal()
        self.setDefaultValue(None)
        self._isAny = True
        # if True, setType and setDefault will work only once
        self.singleInit = False
        self.checkForErrors = True
        self.enableOptions(PinOptions.ChangeTypeOnConnection)
        self._defaultSupportedDataTypes = self._supportedDataTypes = tuple([pin.__name__ for pin in getAllPinClasses() if pin.IsValuePin()])
        self.canChange = True
        self._super = None
        self.prevDataType = None
        self._lastError2 = None 
开发者ID:wonderworks-software,项目名称:PyFlow,代码行数:25,代码来源:AnyPin.py

示例7: __init__

# 需要导入模块: import blinker [as 别名]
# 或者: from blinker import Signal [as 别名]
def __init__(self, name, manager, parentGraph=None, category='', uid=None, *args, **kwargs):
        super(GraphBase, self).__init__(*args, **kwargs)
        self.graphManager = manager
        self._isRoot = False

        self.nameChanged = Signal(str)
        self.categoryChanged = Signal(str)

        self.__name = name
        self.__category = category

        self._parentGraph = None
        self.childGraphs = set()

        self.parentGraph = parentGraph

        self._nodes = {}
        self._vars = {}
        self.uid = uuid.uuid4() if uid is None else uid

        manager.add(self) 
开发者ID:wonderworks-software,项目名称:PyFlow,代码行数:23,代码来源:GraphBase.py

示例8: on_message

# 需要导入模块: import blinker [as 别名]
# 或者: from blinker import Signal [as 别名]
def on_message(self):
        """Emitted when a message frame is received.

        The signal sender is the connection and the ``message`` is sent as an
        argument.
        """
        return blinker.Signal(doc='Emitted when a message frame is received.') 
开发者ID:wtolson,项目名称:gnsq,代码行数:9,代码来源:nsqd.py

示例9: on_response

# 需要导入模块: import blinker [as 别名]
# 或者: from blinker import Signal [as 别名]
def on_response(self):
        """Emitted when a response frame is received.

        The signal sender is the connection and the ``response`` is sent as an
        argument.
        """
        return blinker.Signal(doc='Emitted when a response frame is received.') 
开发者ID:wtolson,项目名称:gnsq,代码行数:9,代码来源:nsqd.py

示例10: on_error

# 需要导入模块: import blinker [as 别名]
# 或者: from blinker import Signal [as 别名]
def on_error(self):
        """Emitted when an error frame is received.

        The signal sender is the connection and the ``error`` is sent as an
        argument.
        """
        return blinker.Signal(doc='Emitted when a error frame is received.') 
开发者ID:wtolson,项目名称:gnsq,代码行数:9,代码来源:nsqd.py

示例11: on_finish

# 需要导入模块: import blinker [as 别名]
# 或者: from blinker import Signal [as 别名]
def on_finish(self):
        """Emitted after :meth:`finish`.

        Sent after a message owned by this connection is successfully finished.
        The signal sender is the connection and the ``message_id`` is sent as an
        argument.
        """
        return blinker.Signal(doc='Emitted after the a message is finished.') 
开发者ID:wtolson,项目名称:gnsq,代码行数:10,代码来源:nsqd.py

示例12: on_requeue

# 需要导入模块: import blinker [as 别名]
# 或者: from blinker import Signal [as 别名]
def on_requeue(self):
        """Emitted after :meth:`requeue`.

        Sent after a message owned by this connection is requeued. The signal
        sender is the connection and the ``message_id``, ``timeout`` and
        ``backoff`` flag are sent as arguments.
        """
        return blinker.Signal(doc='Emitted after the a message is requeued.') 
开发者ID:wtolson,项目名称:gnsq,代码行数:10,代码来源:nsqd.py

示例13: on_close

# 需要导入模块: import blinker [as 别名]
# 或者: from blinker import Signal [as 别名]
def on_close(self):
        """Emitted after :meth:`close_stream`.

        Sent after the connection socket has closed. The signal sender is the
        connection.
        """
        return blinker.Signal(doc='Emitted after the connection is closed.') 
开发者ID:wtolson,项目名称:gnsq,代码行数:9,代码来源:nsqd.py

示例14: on_response

# 需要导入模块: import blinker [as 别名]
# 或者: from blinker import Signal [as 别名]
def on_response(self):
        """Emitted when a response is received.

        The signal sender is the consumer and the ` ` is sent as an
        argument.
        """
        return blinker.Signal(doc='Emitted when a response is received.') 
开发者ID:wtolson,项目名称:gnsq,代码行数:9,代码来源:producer.py

示例15: on_error

# 需要导入模块: import blinker [as 别名]
# 或者: from blinker import Signal [as 别名]
def on_error(self):
        """Emitted when an error is received.

        The signal sender is the consumer and the ``error`` is sent as an
        argument.
        """
        return blinker.Signal(doc='Emitted when a error is received.') 
开发者ID:wtolson,项目名称:gnsq,代码行数:9,代码来源:producer.py


注:本文中的blinker.Signal方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。