eric6/DebugClients/Python/AsyncFile.py

branch
multi_processing
changeset 7802
eefe954f01e8
parent 7646
39e3db2b4936
parent 7760
fcd3322bf6ed
child 7853
35dcac32984a
equal deleted inserted replaced
7646:39e3db2b4936 7802:eefe954f01e8
172 @return the bytes read 172 @return the bytes read
173 @rtype str 173 @rtype str
174 """ 174 """
175 self.__checkMode('r') 175 self.__checkMode('r')
176 176
177 buf = input() 177 buf = input() # secok
178 if size >= 0: 178 if size >= 0:
179 buf = buf[:size] 179 buf = buf[:size]
180 return buf 180 return buf
181 181
182 def readCommand(self): 182 def readCommand(self):
270 @return one line read 270 @return one line read
271 @rtype str 271 @rtype str
272 """ 272 """
273 self.__checkMode('r') 273 self.__checkMode('r')
274 274
275 line = input() + '\n' 275 line = input() + '\n' # secok
276 if sizehint >= 0: 276 if sizehint >= 0:
277 line = line[:sizehint] 277 line = line[:sizehint]
278 return line 278 return line
279 279
280 def seekable(self): 280 def seekable(self):
331 def write(self, s): 331 def write(self, s):
332 """ 332 """
333 Public method to write a string to the file. 333 Public method to write a string to the file.
334 334
335 @param s text to be written 335 @param s text to be written
336 @type str 336 @type str, bytes or bytearray
337 """ 337 """
338 self.__checkMode('w') 338 self.__checkMode('w')
339
340 if isinstance(s, (bytes, bytearray)):
341 # convert to string to send it
342 s = repr(s)
339 343
340 cmd = prepareJsonCommand("ClientOutput", { 344 cmd = prepareJsonCommand("ClientOutput", {
341 "text": s, 345 "text": s,
342 "debuggerId": "", 346 "debuggerId": "",
343 }) 347 })

eric ide

mercurial