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


Python interfaces.IProcessTransport方法代码示例

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


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

示例1: spawnProcess

# 需要导入模块: from twisted.internet import interfaces [as 别名]
# 或者: from twisted.internet.interfaces import IProcessTransport [as 别名]
def spawnProcess(self, processProtocol, executable, args=(), env={},
                     path=None, uid=None, gid=None, usePTY=0, childFDs=None):
        """
        @ivar processProtocol: Stores the protocol passed to the reactor.
        @return: An L{IProcessTransport} provider.
        """
        self.processProtocol = processProtocol
        self.executable = executable
        self.args = args
        self.env = env
        self.path = path
        self.uid = uid
        self.gid = gid
        self.usePTY = usePTY
        self.childFDs = childFDs

        self.processTransport = MemoryProcessTransport()
        self.processProtocol.makeConnection(self.processTransport)
        return self.processTransport 
开发者ID:proxysh,项目名称:Safejumper-for-Desktop,代码行数:21,代码来源:test_endpoints.py

示例2: test_cleanReactorKillsProcesses

# 需要导入模块: from twisted.internet import interfaces [as 别名]
# 或者: from twisted.internet.interfaces import IProcessTransport [as 别名]
def test_cleanReactorKillsProcesses(self):
        """
        The Janitor will kill processes during reactor cleanup.
        """
        @implementer(IProcessTransport)
        class StubProcessTransport(object):
            """
            A stub L{IProcessTransport} provider which records signals.
            @ivar signals: The signals passed to L{signalProcess}.
            """

            def __init__(self):
                self.signals = []

            def signalProcess(self, signal):
                """
                Append C{signal} to C{self.signals}.
                """
                self.signals.append(signal)

        pt = StubProcessTransport()
        reactor = StubReactor([], [pt])
        jan = _Janitor(None, None, reactor=reactor)
        jan._cleanReactor()
        self.assertEqual(pt.signals, ["KILL"]) 
开发者ID:proxysh,项目名称:Safejumper-for-Desktop,代码行数:27,代码来源:test_util.py

示例3: test_cleanReactorKillsProcesses

# 需要导入模块: from twisted.internet import interfaces [as 别名]
# 或者: from twisted.internet.interfaces import IProcessTransport [as 别名]
def test_cleanReactorKillsProcesses(self):
        """
        The Janitor will kill processes during reactor cleanup.
        """
        class StubProcessTransport(object):
            """
            A stub L{IProcessTransport} provider which records signals.
            @ivar signals: The signals passed to L{signalProcess}.
            """
            implements(IProcessTransport)

            def __init__(self):
                self.signals = []

            def signalProcess(self, signal):
                """
                Append C{signal} to C{self.signals}.
                """
                self.signals.append(signal)

        pt = StubProcessTransport()
        reactor = StubReactor([], [pt])
        jan = _Janitor(None, None, reactor=reactor)
        jan._cleanReactor()
        self.assertEquals(pt.signals, ["KILL"]) 
开发者ID:kuri65536,项目名称:python-for-android,代码行数:27,代码来源:test_util.py

示例4: makeConnection

# 需要导入模块: from twisted.internet import interfaces [as 别名]
# 或者: from twisted.internet.interfaces import IProcessTransport [as 别名]
def makeConnection(self, process):
        """
        Call L{IProtocol} provider's makeConnection method with an
        L{ITransport} provider.

        @param process: An L{IProcessTransport} provider.
        """
        self.transport = _ProcessEndpointTransport(process)
        return self.protocol.makeConnection(self.transport) 
开发者ID:proxysh,项目名称:Safejumper-for-Desktop,代码行数:11,代码来源:endpoints.py

示例5: waitForOneProcess

# 需要导入模块: from twisted.internet import interfaces [as 别名]
# 或者: from twisted.internet.interfaces import IProcessTransport [as 别名]
def waitForOneProcess(self, amount=10.0):
        """
        Wait for an L{IProcessTransport} to be created by advancing the clock.
        If none are created in the specified amount of time, raise an
        AssertionError.
        """
        self.advance(amount)
        if self.processTransports:
            return self.processTransports.pop(0)
        else:
            raise AssertionError(
                "There were no process transports available.  Calls: " +
                repr(self.calls)
            ) 
开发者ID:apple,项目名称:ccs-calendarserver,代码行数:16,代码来源:test_caldav.py


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