Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d55f4d1

Browse files
committed
*** empty log message ***
1 parent 9e80d6f commit d55f4d1

5 files changed

Lines changed: 12 additions & 13 deletions

File tree

Demo/sockets/gopher.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ def browse_textfile(selector, host, port):
200200
x = None
201201
try:
202202
p = os.popen('${PAGER-more}', 'w')
203-
x = SaveLines().init(p)
203+
x = SaveLines(p)
204204
get_alt_textfile(selector, host, port, x.writeln)
205205
except IOError, msg:
206206
print 'IOError:', msg
@@ -209,7 +209,7 @@ def browse_textfile(selector, host, port):
209209
f = open_savefile()
210210
if not f:
211211
return
212-
x = SaveLines().init(f)
212+
x = SaveLines(f)
213213
try:
214214
get_alt_textfile(selector, host, port, x.writeln)
215215
print 'Done.'
@@ -252,7 +252,7 @@ def browse_binary(selector, host, port):
252252
f = open_savefile()
253253
if not f:
254254
return
255-
x = SaveWithProgress().init(f)
255+
x = SaveWithProgress(f)
256256
get_alt_binary(selector, host, port, x.write, 8*1024)
257257
x.close()
258258

@@ -268,9 +268,8 @@ def browse_sound(selector, host, port):
268268

269269
# Class used to save lines, appending a newline to each line
270270
class SaveLines:
271-
def init(self, f):
271+
def __init__(self, f):
272272
self.f = f
273-
return self
274273
def writeln(self, line):
275274
self.f.write(line + '\n')
276275
def close(self):
@@ -280,9 +279,8 @@ def close(self):
280279

281280
# Class used to save data while showing progress
282281
class SaveWithProgress:
283-
def init(self, f):
282+
def __init__(self, f):
284283
self.f = f
285-
return self
286284
def write(self, data):
287285
sys.stdout.write('#')
288286
sys.stdout.flush()

Demo/sockets/radio.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,6 @@
99
s.bind('', MYPORT)
1010

1111
while 1:
12-
data = s.recv(1500)
12+
data, wherefrom = s.recvfrom(1500, 0)
13+
sys.stderr.write(`wherefrom` + '\n')
1314
sys.stdout.write(data)

Demo/stdwin/jukebox.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545

4646
# Global variables
4747

48-
class struct(): pass # Class to define featureless structures
48+
class struct: pass # Class to define featureless structures
4949

5050
G = struct() # oHlds writable global variables
5151

Demo/stdwin/lpwin.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,8 @@ def main():
8686
mainloop.register(win)
8787
mainloop.mainloop()
8888

89-
def lpdispatch(type, win, detail):
89+
def lpdispatch(event):
90+
type, win, detail = event
9091
if type == WE_CLOSE or type == WE_CHAR and detail in ('q', 'Q'):
9192
mainloop.unregister(win)
9293
elif type == WE_DRAW:

Demo/stdwin/python.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ def do_exec(win):
375375
save_stdout = sys.stdout
376376
save_stderr = sys.stderr
377377
try:
378-
sys.stdin = sys.stdout = sys.stderr = IOWindow().init(win)
378+
sys.stdin = sys.stdout = sys.stderr = IOWindow(win)
379379
win.busy = 1
380380
try:
381381
exec(command, win.globals)
@@ -404,9 +404,8 @@ def do_exec(win):
404404
#
405405
class IOWindow:
406406
#
407-
def init(self, win):
407+
def __init__(self, win):
408408
self.win = win
409-
return self
410409
#
411410
def readline(self, *unused_args):
412411
n = len(inputwindows)

0 commit comments

Comments
 (0)