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


Python basic.LineOnlyReceiver方法代码示例

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


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

示例1: lineLengthExceeded

# 需要导入模块: from twisted.protocols import basic [as 别名]
# 或者: from twisted.protocols.basic import LineOnlyReceiver [as 别名]
def lineLengthExceeded(self, buffer):
        """
        Drop the connection when a server response exceeds the maximum line
        length (L{LineOnlyReceiver.MAX_LENGTH}).

        @type buffer: L{bytes}
        @param buffer: A received line which exceeds the maximum line length.
        """
        # XXX - We need to be smarter about this
        if self._waiting is not None:
            waiting, self._waiting = self._waiting, None
            waiting.errback(LineTooLong())
        self.transport.loseConnection()


    # POP3 Client state logic - don't touch this. 
开发者ID:proxysh,项目名称:Safejumper-for-Desktop,代码行数:18,代码来源:pop3client.py

示例2: test_lineReceivedNotImplemented

# 需要导入模块: from twisted.protocols import basic [as 别名]
# 或者: from twisted.protocols.basic import LineOnlyReceiver [as 别名]
def test_lineReceivedNotImplemented(self):
        """
        When L{LineOnlyReceiver.lineReceived} is not overridden in a subclass,
        calling it raises C{NotImplementedError}.
        """
        proto = basic.LineOnlyReceiver()
        self.assertRaises(NotImplementedError, proto.lineReceived, 'foo') 
开发者ID:proxysh,项目名称:Safejumper-for-Desktop,代码行数:9,代码来源:test_basic.py

示例3: __str__

# 需要导入模块: from twisted.protocols import basic [as 别名]
# 或者: from twisted.protocols.basic import LineOnlyReceiver [as 别名]
def __str__(self):
        return repr(self)


# LineOnlyReceiver is mutable, so can't use pyrsistent 
开发者ID:ClusterHQ,项目名称:flocker,代码行数:7,代码来源:runner.py

示例4: test_greaterThanMaximumLineLength

# 需要导入模块: from twisted.protocols import basic [as 别名]
# 或者: from twisted.protocols.basic import LineOnlyReceiver [as 别名]
def test_greaterThanMaximumLineLength(self):
        """
        C{LineOnlyReceiver} disconnects the transport if it receives a
        line longer than its C{MAX_LENGTH} + len(delimiter).
        """
        proto = LineOnlyTester()
        transport = proto_helpers.StringTransport()
        proto.makeConnection(transport)
        proto.dataReceived(b'x' * (proto.MAX_LENGTH
                                   + len(proto.delimiter) + 1) + b'\r\nr')
        self.assertTrue(transport.disconnecting) 
开发者ID:wistbean,项目名称:learn_python3_spider,代码行数:13,代码来源:test_basic.py

示例5: __init__

# 需要导入模块: from twisted.protocols import basic [as 别名]
# 或者: from twisted.protocols.basic import LineOnlyReceiver [as 别名]
def __init__(self):
        #basic.LineOnlyReceiver.__init__(self)
        self._matcher = deferral.GenericDeferrer(max_id=2**30, func=lambda id, method, params: self.sendLine(json.dumps({
            'jsonrpc': '2.0',
            'method': method,
            'params': params,
            'id': id,
        })))
        self.other = Proxy(self._matcher) 
开发者ID:donSchoe,项目名称:p2pool-n,代码行数:11,代码来源:jsonrpc.py

示例6: failResponse

# 需要导入模块: from twisted.protocols import basic [as 别名]
# 或者: from twisted.protocols.basic import LineOnlyReceiver [as 别名]
def failResponse(self, message=''):
        self.sendLine('-ERR ' + str(message))

#    def sendLine(self, line):
#        print 'S:', repr(line)
#        basic.LineOnlyReceiver.sendLine(self, line) 
开发者ID:kuri65536,项目名称:python-for-android,代码行数:8,代码来源:pop3.py


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