comparison tests/test-batching.py @ 51700:7f0cb9ee0534

Backout accidental publication of a large range of revisions I accidentally published 25e7f9dcad0f::bd1483fd7088, this is the inverse.
author Raphaël Gomès <rgomes@octobus.net>
date Tue, 23 Jul 2024 10:02:46 +0200
parents 493034cc3265
children ca7bde5dbafb
comparison
equal deleted inserted replaced
51699:bd1483fd7088 51700:7f0cb9ee0534
53 e.close() 53 e.close()
54 54
55 55
56 # usage of "thing" interface 56 # usage of "thing" interface
57 def use(it): 57 def use(it):
58
58 # Direct call to base method shared between client and server. 59 # Direct call to base method shared between client and server.
59 bprint(it.hello()) 60 bprint(it.hello())
60 61
61 # Direct calls to proxied methods. They cause individual roundtrips. 62 # Direct calls to proxied methods. They cause individual roundtrips.
62 bprint(it.foo(b"Un", two=b"Deux")) 63 bprint(it.foo(b"Un", two=b"Deux"))
102 .replace(b'::', b':') 103 .replace(b'::', b':')
103 ) 104 )
104 105
105 106
106 # server side 107 # server side
107
108 108
109 # equivalent of wireproto's global functions 109 # equivalent of wireproto's global functions
110 class server: 110 class server:
111 def __init__(self, local): 111 def __init__(self, local):
112 self.local = local 112 self.local = local
154 154
155 myserver = server(mylocal) 155 myserver = server(mylocal)
156 156
157 # local side 157 # local side
158 158
159
160 # equivalent of wireproto.encode/decodelist, that is, type-specific marshalling 159 # equivalent of wireproto.encode/decodelist, that is, type-specific marshalling
161 # here we just transform the strings a bit to check we're properly en-/decoding 160 # here we just transform the strings a bit to check we're properly en-/decoding
162 def mangle(s): 161 def mangle(s):
163 return b''.join(pycompat.bytechr(ord(c) + 1) for c in pycompat.bytestr(s)) 162 return b''.join(pycompat.bytechr(ord(c) + 1) for c in pycompat.bytestr(s))
164 163