Commit 95f8ccb6 authored by Guido van Rossum's avatar Guido van Rossum

Remove space between function/class name and following left

parenthesis.
parent 03867188
...@@ -20,7 +20,7 @@ import thread ...@@ -20,7 +20,7 @@ import thread
if os.name == 'posix': if os.name == 'posix':
class trigger (asyncore.file_dispatcher): class trigger(asyncore.file_dispatcher):
"Wake up a call to select() running in the main thread" "Wake up a call to select() running in the main thread"
...@@ -52,10 +52,10 @@ if os.name == 'posix': ...@@ -52,10 +52,10 @@ if os.name == 'posix':
# new data onto a channel's outgoing data queue at the same time that # new data onto a channel's outgoing data queue at the same time that
# the main thread is trying to remove some] # the main thread is trying to remove some]
def __init__ (self): def __init__(self):
r, w = self._fds = os.pipe() r, w = self._fds = os.pipe()
self.trigger = w self.trigger = w
asyncore.file_dispatcher.__init__ (self, r) asyncore.file_dispatcher.__init__(self, r)
self.lock = thread.allocate_lock() self.lock = thread.allocate_lock()
self.thunks = [] self.thunks = []
self._closed = None self._closed = None
...@@ -73,29 +73,29 @@ if os.name == 'posix': ...@@ -73,29 +73,29 @@ if os.name == 'posix':
for fd in self._fds: for fd in self._fds:
os.close(fd) os.close(fd)
def __repr__ (self): def __repr__(self):
return '<select-trigger (pipe) at %x>' % id(self) return '<select-trigger (pipe) at %x>' % id(self)
def readable (self): def readable(self):
return 1 return 1
def writable (self): def writable(self):
return 0 return 0
def handle_connect (self): def handle_connect(self):
pass pass
def pull_trigger (self, thunk=None): def pull_trigger(self, thunk=None):
if thunk: if thunk:
try: try:
self.lock.acquire() self.lock.acquire()
self.thunks.append (thunk) self.thunks.append(thunk)
finally: finally:
self.lock.release() self.lock.release()
os.write (self.trigger, 'x') os.write(self.trigger, 'x')
def handle_read (self): def handle_read(self):
self.recv (8192) self.recv(8192)
try: try:
self.lock.acquire() self.lock.acquire()
for thunk in self.thunks: for thunk in self.thunks:
...@@ -116,13 +116,13 @@ else: ...@@ -116,13 +116,13 @@ else:
# win32-safe version # win32-safe version
class trigger (asyncore.dispatcher): class trigger(asyncore.dispatcher):
address = ('127.9.9.9', 19999) address = ('127.9.9.9', 19999)
def __init__ (self): def __init__(self):
a = socket.socket (socket.AF_INET, socket.SOCK_STREAM) a = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
w = socket.socket (socket.AF_INET, socket.SOCK_STREAM) w = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
# set TCP_NODELAY to true to avoid buffering # set TCP_NODELAY to true to avoid buffering
w.setsockopt(socket.IPPROTO_TCP, 1, 1) w.setsockopt(socket.IPPROTO_TCP, 1, 1)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment