當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。