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


Python PosixReactorBase.__init__方法代码示例

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


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

示例1: __init__

# 需要导入模块: from twisted.internet.posixbase import PosixReactorBase [as 别名]
# 或者: from twisted.internet.posixbase.PosixReactorBase import __init__ [as 别名]
def __init__(self, io_loop=None):
        if not io_loop:
            io_loop = tornado.ioloop.IOLoop.current()
        self._io_loop = io_loop
        self._readers = {}  # map of reader objects to fd
        self._writers = {}  # map of writer objects to fd
        self._fds = {}  # a map of fd to a (reader, writer) tuple
        self._delayedCalls = {}
        PosixReactorBase.__init__(self)
        self.addSystemEventTrigger('during', 'shutdown', self.crash)

        # IOLoop.start() bypasses some of the reactor initialization.
        # Fire off the necessary events if they weren't already triggered
        # by reactor.run().
        def start_if_necessary():
            if not self._started:
                self.fireSystemEvent('startup')
        self._io_loop.add_callback(start_if_necessary)

    # IReactorTime 
开发者ID:tao12345666333,项目名称:tornado-zh,代码行数:22,代码来源:twisted.py

示例2: __init__

# 需要导入模块: from twisted.internet.posixbase import PosixReactorBase [as 别名]
# 或者: from twisted.internet.posixbase.PosixReactorBase import __init__ [as 别名]
def __init__(self, io_loop=None):
        if not io_loop:
            io_loop = tornado.ioloop.IOLoop.instance()
        self._io_loop = io_loop
        self._readers = {}  # map of reader objects to fd
        self._writers = {}  # map of writer objects to fd
        self._fds = {}  # a map of fd to a (reader, writer) tuple
        self._delayedCalls = {}
        PosixReactorBase.__init__(self)

        # IOLoop.start() bypasses some of the reactor initialization.
        # Fire off the necessary events if they weren't already triggered
        # by reactor.run().
        def start_if_necessary():
            if not self._started:
                self.fireSystemEvent('startup')
        self._io_loop.add_callback(start_if_necessary)

    # IReactorTime 
开发者ID:omererdem,项目名称:honeything,代码行数:21,代码来源:twisted.py

示例3: __init__

# 需要导入模块: from twisted.internet.posixbase import PosixReactorBase [as 别名]
# 或者: from twisted.internet.posixbase.PosixReactorBase import __init__ [as 别名]
def __init__(self):
        self._reads = {}
        self._writes = {}
        self._timer=QTimer()
        self._timer.setSingleShot(True)
        if QCoreApplication.startingUp():
            self.qApp=QCoreApplication([])
            self._ownApp=True
        else:
            self.qApp = QCoreApplication.instance()
            self._ownApp=False
        self._blockApp = None
        self._readWriteQ=[]
        
        """ some debugging instrumentation """
        self._doSomethingCount=0
        
        PosixReactorBase.__init__(self) 
开发者ID:eliben,项目名称:code-for-blog,代码行数:20,代码来源:qt4reactor.py

示例4: __init__

# 需要导入模块: from twisted.internet.posixbase import PosixReactorBase [as 别名]
# 或者: from twisted.internet.posixbase.PosixReactorBase import __init__ [as 别名]
def __init__(self, reactor, seconds, f, *args, **kw):
        self._reactor = reactor
        self._func = functools.partial(f, *args, **kw)
        self._time = self._reactor.seconds() + seconds
        self._timeout = self._reactor._io_loop.add_timeout(self._time,
                                                           self._called)
        self._active = True 
开发者ID:tao12345666333,项目名称:tornado-zh,代码行数:9,代码来源:twisted.py

示例5: __init__

# 需要导入模块: from twisted.internet.posixbase import PosixReactorBase [as 别名]
# 或者: from twisted.internet.posixbase.PosixReactorBase import __init__ [as 别名]
def __init__(self, runLoop=None, runner=None):
        self._fdmap = {}
        self._idmap = {}
        if runner is None:
            runner = CFRunLoopRun
        self._runner = runner

        if runLoop is None:
            runLoop = CFRunLoopGetMain()
        self._cfrunloop = runLoop
        PosixReactorBase.__init__(self) 
开发者ID:proxysh,项目名称:Safejumper-for-Desktop,代码行数:13,代码来源:cfreactor.py

示例6: __init__

# 需要导入模块: from twisted.internet.posixbase import PosixReactorBase [as 别名]
# 或者: from twisted.internet.posixbase.PosixReactorBase import __init__ [as 别名]
def __init__(self):
        self._readers = {}
        self._writers = {}
        PosixReactorBase.__init__(self) 
开发者ID:proxysh,项目名称:Safejumper-for-Desktop,代码行数:6,代码来源:test_posixbase.py

示例7: test_listenWithIsDeprecated

# 需要导入模块: from twisted.internet.posixbase import PosixReactorBase [as 别名]
# 或者: from twisted.internet.posixbase.PosixReactorBase import __init__ [as 别名]
def test_listenWithIsDeprecated(self):
        """
        L{PosixReactorBase} implements the deprecated L{IReactorArbitrary}, and
        L{PosixReactorBase.listenWith} is a part of that interface. To avoid
        unnecessary deprecation warnings when importing posixbase, the
        L{twisted.internet.interfaces._IReactorArbitrary} alias that doesn't
        have the deprecation warning is imported, and instead
        L{PosixReactorBase.listenWith} generates its own deprecation warning.
        """
        class fakePort:
            def __init__(self, *args, **kw):
                pass

            def startListening(self):
                pass

        reactor = TrivialReactor()
        reactor.listenWith(fakePort)

        warnings = self.flushWarnings([self.test_listenWithIsDeprecated])
        self.assertEquals(len(warnings), 1)
        self.assertEquals(warnings[0]['category'], DeprecationWarning)
        self.assertEquals(
            "listenWith is deprecated since Twisted 10.1.  "
            "See IReactorFDSet.",
            warnings[0]['message']) 
开发者ID:kuri65536,项目名称:python-for-android,代码行数:28,代码来源:test_posixbase.py

示例8: test_connectWithIsDeprecated

# 需要导入模块: from twisted.internet.posixbase import PosixReactorBase [as 别名]
# 或者: from twisted.internet.posixbase.PosixReactorBase import __init__ [as 别名]
def test_connectWithIsDeprecated(self):
        """
        L{PosixReactorBase} implements the deprecated L{IReactorArbitrary}, and
        L{PosixReactorBase.connectWith} is a part of that interface. To avoid
        unnecessary deprecation warnings when importing posixbase, the
        L{twisted.internet.interfaces._IReactorArbitrary} alias that doesn't
        have the deprecation warning is imported, and instead
        L{PosixReactorBase.connectWith} generates its own deprecation warning.
        """
        class fakeConnector:
            def __init__(self, *args, **kw):
                pass

            def connect(self):
                pass

        reactor = TrivialReactor()
        reactor.connectWith(fakeConnector)

        warnings = self.flushWarnings([self.test_connectWithIsDeprecated])
        self.assertEquals(len(warnings), 1)
        self.assertEquals(warnings[0]['category'], DeprecationWarning)
        self.assertEquals(
            "connectWith is deprecated since Twisted 10.1.  "
            "See IReactorFDSet.",
            warnings[0]['message']) 
开发者ID:kuri65536,项目名称:python-for-android,代码行数:28,代码来源:test_posixbase.py


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