@@ -35,7 +35,7 @@ def handle(self):
3535 if received == '' :
3636 print ("=== socket closed ===" )
3737 break
38- print ("received: {}" .format (received ))
38+ print ("received: {0 }" .format (received ))
3939
4040 # We may receive two messages at once. Take the part up to the
4141 # matching "]" (recognized by finding "][").
@@ -49,7 +49,7 @@ def handle(self):
4949 used = todo [:splitidx + 1 ]
5050 todo = todo [splitidx + 1 :]
5151 if used != received :
52- print ("using: {}" .format (used ))
52+ print ("using: {0 }" .format (used ))
5353
5454 try :
5555 decoded = json .loads (used )
@@ -70,112 +70,112 @@ def handle(self):
7070 # replying to the request.
7171 cmd = '["ex","call append(\\ "$\\ ",\\ "added1\\ ")"]'
7272 cmd += '["ex","call append(\\ "$\\ ",\\ "added2\\ ")"]'
73- print ("sending: {}" .format (cmd ))
73+ print ("sending: {0 }" .format (cmd ))
7474 self .request .sendall (cmd .encode ('utf-8' ))
7575 response = "ok"
7676 elif decoded [1 ] == 'do normal' :
7777 # Send a normal command.
7878 cmd = '["normal","G$s more\u001b "]'
79- print ("sending: {}" .format (cmd ))
79+ print ("sending: {0 }" .format (cmd ))
8080 self .request .sendall (cmd .encode ('utf-8' ))
8181 response = "ok"
8282 elif decoded [1 ] == 'eval-works' :
8383 # Send an eval request. We ignore the response.
8484 cmd = '["expr","\\ "foo\\ " . 123", -1]'
85- print ("sending: {}" .format (cmd ))
85+ print ("sending: {0 }" .format (cmd ))
8686 self .request .sendall (cmd .encode ('utf-8' ))
8787 response = "ok"
8888 elif decoded [1 ] == 'eval-fails' :
8989 # Send an eval request that will fail.
9090 cmd = '["expr","xxx", -2]'
91- print ("sending: {}" .format (cmd ))
91+ print ("sending: {0 }" .format (cmd ))
9292 self .request .sendall (cmd .encode ('utf-8' ))
9393 response = "ok"
9494 elif decoded [1 ] == 'eval-error' :
9595 # Send an eval request that works but the result can't
9696 # be encoded.
9797 cmd = '["expr","function(\\ "tr\\ ")", -3]'
98- print ("sending: {}" .format (cmd ))
98+ print ("sending: {0 }" .format (cmd ))
9999 self .request .sendall (cmd .encode ('utf-8' ))
100100 response = "ok"
101101 elif decoded [1 ] == 'eval-bad' :
102102 # Send an eval request missing the third argument.
103103 cmd = '["expr","xxx"]'
104- print ("sending: {}" .format (cmd ))
104+ print ("sending: {0 }" .format (cmd ))
105105 self .request .sendall (cmd .encode ('utf-8' ))
106106 response = "ok"
107107 elif decoded [1 ] == 'malformed1' :
108108 cmd = '["ex",":"]wrong!["ex","smi"]'
109- print ("sending: {}" .format (cmd ))
109+ print ("sending: {0 }" .format (cmd ))
110110 self .request .sendall (cmd .encode ('utf-8' ))
111111 response = "ok"
112112 elif decoded [1 ] == 'malformed2' :
113113 cmd = '"unterminated string'
114- print ("sending: {}" .format (cmd ))
114+ print ("sending: {0 }" .format (cmd ))
115115 self .request .sendall (cmd .encode ('utf-8' ))
116116 response = "ok"
117117 # Need to wait for Vim to give up, otherwise the double
118118 # quote in the "ok" response terminates the string.
119119 time .sleep (0.2 )
120120 elif decoded [1 ] == 'malformed3' :
121121 cmd = '["ex","missing ]"'
122- print ("sending: {}" .format (cmd ))
122+ print ("sending: {0 }" .format (cmd ))
123123 self .request .sendall (cmd .encode ('utf-8' ))
124124 response = "ok"
125125 # Need to wait for Vim to give up, otherwise the ]
126126 # in the "ok" response terminates the list.
127127 time .sleep (0.2 )
128128 elif decoded [1 ] == 'split' :
129129 cmd = '["ex","let '
130- print ("sending: {}" .format (cmd ))
130+ print ("sending: {0 }" .format (cmd ))
131131 self .request .sendall (cmd .encode ('utf-8' ))
132132 time .sleep (0.01 )
133133 cmd = 'g:split = 123"]'
134- print ("sending: {}" .format (cmd ))
134+ print ("sending: {0 }" .format (cmd ))
135135 self .request .sendall (cmd .encode ('utf-8' ))
136136 response = "ok"
137137 elif decoded [1 ] == 'an expr' :
138138 # Send an expr request.
139139 cmd = '["expr","setline(\\ "$\\ ", [\\ "one\\ ",\\ "two\\ ",\\ "three\\ "])"]'
140- print ("sending: {}" .format (cmd ))
140+ print ("sending: {0 }" .format (cmd ))
141141 self .request .sendall (cmd .encode ('utf-8' ))
142142 response = "ok"
143143 elif decoded [1 ] == 'call-func' :
144144 cmd = '["call","MyFunction",[1,2,3], 0]'
145- print ("sending: {}" .format (cmd ))
145+ print ("sending: {0 }" .format (cmd ))
146146 self .request .sendall (cmd .encode ('utf-8' ))
147147 response = "ok"
148148 elif decoded [1 ] == 'redraw' :
149149 cmd = '["redraw",""]'
150- print ("sending: {}" .format (cmd ))
150+ print ("sending: {0 }" .format (cmd ))
151151 self .request .sendall (cmd .encode ('utf-8' ))
152152 response = "ok"
153153 elif decoded [1 ] == 'redraw!' :
154154 cmd = '["redraw","force"]'
155- print ("sending: {}" .format (cmd ))
155+ print ("sending: {0 }" .format (cmd ))
156156 self .request .sendall (cmd .encode ('utf-8' ))
157157 response = "ok"
158158 elif decoded [1 ] == 'empty-request' :
159159 cmd = '[]'
160- print ("sending: {}" .format (cmd ))
160+ print ("sending: {0 }" .format (cmd ))
161161 self .request .sendall (cmd .encode ('utf-8' ))
162162 response = "ok"
163163 elif decoded [1 ] == 'eval-result' :
164164 # Send back the last received eval result.
165165 response = last_eval
166166 elif decoded [1 ] == 'call me' :
167167 cmd = '[0,"we called you"]'
168- print ("sending: {}" .format (cmd ))
168+ print ("sending: {0 }" .format (cmd ))
169169 self .request .sendall (cmd .encode ('utf-8' ))
170170 response = "ok"
171171 elif decoded [1 ] == 'call me again' :
172172 cmd = '[0,"we did call you"]'
173- print ("sending: {}" .format (cmd ))
173+ print ("sending: {0 }" .format (cmd ))
174174 self .request .sendall (cmd .encode ('utf-8' ))
175175 response = ""
176176 elif decoded [1 ] == 'send zero' :
177177 cmd = '[0,"zero index"]'
178- print ("sending: {}" .format (cmd ))
178+ print ("sending: {0 }" .format (cmd ))
179179 self .request .sendall (cmd .encode ('utf-8' ))
180180 response = "sent zero"
181181 elif decoded [1 ] == 'close me' :
@@ -199,7 +199,7 @@ def handle(self):
199199 print ("no response" )
200200 else :
201201 encoded = json .dumps ([decoded [0 ], response ])
202- print ("sending: {}" .format (encoded ))
202+ print ("sending: {0 }" .format (encoded ))
203203 self .request .sendall (encoded .encode ('utf-8' ))
204204
205205 # Negative numbers are used for "eval" responses.
@@ -212,7 +212,7 @@ class ThreadedTCPServer(socketserver.ThreadingMixIn, socketserver.TCPServer):
212212def writePortInFile (port ):
213213 # Write the port number in Xportnr, so that the test knows it.
214214 f = open ("Xportnr" , "w" )
215- f .write ("{}" .format (port ))
215+ f .write ("{0 }" .format (port ))
216216 f .close ()
217217
218218if __name__ == "__main__" :
@@ -238,7 +238,7 @@ def writePortInFile(port):
238238
239239 writePortInFile (port )
240240
241- print ("Listening on port {}" .format (port ))
241+ print ("Listening on port {0 }" .format (port ))
242242
243243 # Main thread terminates, but the server continues running
244244 # until server.shutdown() is called.
0 commit comments