Commit 926e22dc authored by Denis Bilenko's avatar Denis Bilenko

pep8

parent a4df5df6
...@@ -33,7 +33,6 @@ else: ...@@ -33,7 +33,6 @@ else:
from types import UnboundMethodType from types import UnboundMethodType
class NA(object): class NA(object):
def __repr__(self): def __repr__(self):
...@@ -41,7 +40,6 @@ else: ...@@ -41,7 +40,6 @@ else:
NA = NA() NA = NA()
class SocketAdapter(object): class SocketAdapter(object):
"""Socket-like API on top of a file descriptor. """Socket-like API on top of a file descriptor.
...@@ -159,7 +157,6 @@ else: ...@@ -159,7 +157,6 @@ else:
if SocketAdapter__del__: if SocketAdapter__del__:
SocketAdapter.__del__ = UnboundMethodType(SocketAdapter__del__, None, SocketAdapter) SocketAdapter.__del__ = UnboundMethodType(SocketAdapter__del__, None, SocketAdapter)
class FileObjectPosix(_fileobject): class FileObjectPosix(_fileobject):
def __init__(self, fobj, mode='rb', bufsize=-1, close=True): def __init__(self, fobj, mode='rb', bufsize=-1, close=True):
......
...@@ -7,6 +7,7 @@ try: ...@@ -7,6 +7,7 @@ try:
from gevent._util import set_exc_info from gevent._util import set_exc_info
except ImportError, ex: except ImportError, ex:
sys.stderr.write('Failed to import set_exc_info: %s\n' % ex) sys.stderr.write('Failed to import set_exc_info: %s\n' % ex)
def set_exc_info(*args): def set_exc_info(*args):
pass pass
......
...@@ -204,11 +204,9 @@ class Popen(object): ...@@ -204,11 +204,9 @@ class Popen(object):
return (None if stdout is None else stdout.value or '', return (None if stdout is None else stdout.value or '',
None if stderr is None else stderr.value or '') None if stderr is None else stderr.value or '')
def poll(self): def poll(self):
return self._internal_poll() return self._internal_poll()
if mswindows: if mswindows:
# #
# Windows methods # Windows methods
...@@ -269,14 +267,12 @@ class Popen(object): ...@@ -269,14 +267,12 @@ class Popen(object):
c2pread, c2pwrite, c2pread, c2pwrite,
errread, errwrite) errread, errwrite)
def _make_inheritable(self, handle): def _make_inheritable(self, handle):
"""Return a duplicate of handle, which is inheritable""" """Return a duplicate of handle, which is inheritable"""
return _subprocess.DuplicateHandle(_subprocess.GetCurrentProcess(), return _subprocess.DuplicateHandle(_subprocess.GetCurrentProcess(),
handle, _subprocess.GetCurrentProcess(), 0, 1, handle, _subprocess.GetCurrentProcess(), 0, 1,
_subprocess.DUPLICATE_SAME_ACCESS) _subprocess.DUPLICATE_SAME_ACCESS)
def _find_w9xpopen(self): def _find_w9xpopen(self):
"""Find and return absolut path to w9xpopen.exe""" """Find and return absolut path to w9xpopen.exe"""
w9xpopen = os.path.join( w9xpopen = os.path.join(
...@@ -293,7 +289,6 @@ class Popen(object): ...@@ -293,7 +289,6 @@ class Popen(object):
"shell or platform.") "shell or platform.")
return w9xpopen return w9xpopen
def _execute_child(self, args, executable, preexec_fn, close_fds, def _execute_child(self, args, executable, preexec_fn, close_fds,
cwd, env, universal_newlines, cwd, env, universal_newlines,
startupinfo, creationflags, shell, startupinfo, creationflags, shell,
...@@ -318,7 +313,7 @@ class Popen(object): ...@@ -318,7 +313,7 @@ class Popen(object):
startupinfo.dwFlags |= _subprocess.STARTF_USESHOWWINDOW startupinfo.dwFlags |= _subprocess.STARTF_USESHOWWINDOW
startupinfo.wShowWindow = _subprocess.SW_HIDE startupinfo.wShowWindow = _subprocess.SW_HIDE
comspec = os.environ.get("COMSPEC", "cmd.exe") comspec = os.environ.get("COMSPEC", "cmd.exe")
args = '{} /c "{}"'.format (comspec, args) args = '{} /c "{}"'.format(comspec, args)
if (_subprocess.GetVersion() >= 0x80000000 or if (_subprocess.GetVersion() >= 0x80000000 or
os.path.basename(comspec).lower() == "command.com"): os.path.basename(comspec).lower() == "command.com"):
# Win9x, or using command.com on NT. We need to # Win9x, or using command.com on NT. We need to
...@@ -379,7 +374,6 @@ class Popen(object): ...@@ -379,7 +374,6 @@ class Popen(object):
self.returncode = _subprocess.GetExitCodeProcess(self._handle) self.returncode = _subprocess.GetExitCodeProcess(self._handle)
return self.returncode return self.returncode
def wait(self): def wait(self):
"""Wait for child process to terminate. Returns returncode """Wait for child process to terminate. Returns returncode
attribute.""" attribute."""
...@@ -455,7 +449,6 @@ class Popen(object): ...@@ -455,7 +449,6 @@ class Popen(object):
c2pread, c2pwrite, c2pread, c2pwrite,
errread, errwrite) errread, errwrite)
def _set_cloexec_flag(self, fd, cloexec=True): def _set_cloexec_flag(self, fd, cloexec=True):
try: try:
cloexec_flag = fcntl.FD_CLOEXEC cloexec_flag = fcntl.FD_CLOEXEC
...@@ -468,7 +461,6 @@ class Popen(object): ...@@ -468,7 +461,6 @@ class Popen(object):
else: else:
fcntl.fcntl(fd, fcntl.F_SETFD, old & ~cloexec_flag) fcntl.fcntl(fd, fcntl.F_SETFD, old & ~cloexec_flag)
def _close_fds(self, but): def _close_fds(self, but):
if hasattr(os, 'closerange'): if hasattr(os, 'closerange'):
os.closerange(3, but) os.closerange(3, but)
...@@ -482,7 +474,6 @@ class Popen(object): ...@@ -482,7 +474,6 @@ class Popen(object):
except: except:
pass pass
def _execute_child(self, args, executable, preexec_fn, close_fds, def _execute_child(self, args, executable, preexec_fn, close_fds,
cwd, env, universal_newlines, cwd, env, universal_newlines,
startupinfo, creationflags, shell, startupinfo, creationflags, shell,
...@@ -618,7 +609,6 @@ class Popen(object): ...@@ -618,7 +609,6 @@ class Popen(object):
os.close(fd) os.close(fd)
raise child_exception raise child_exception
def _handle_exitstatus(self, sts): def _handle_exitstatus(self, sts):
if os.WIFSIGNALED(sts): if os.WIFSIGNALED(sts):
self.returncode = -os.WTERMSIG(sts) self.returncode = -os.WTERMSIG(sts)
...@@ -628,14 +618,12 @@ class Popen(object): ...@@ -628,14 +618,12 @@ class Popen(object):
# Should never happen # Should never happen
raise RuntimeError("Unknown child exit status!") raise RuntimeError("Unknown child exit status!")
def _internal_poll(self): def _internal_poll(self):
"""Check if child process has terminated. Returns returncode """Check if child process has terminated. Returns returncode
attribute. attribute.
""" """
return self.returncode return self.returncode
def wait(self): def wait(self):
"""Wait for child process to terminate. Returns returncode """Wait for child process to terminate. Returns returncode
attribute.""" attribute."""
...@@ -643,7 +631,6 @@ class Popen(object): ...@@ -643,7 +631,6 @@ class Popen(object):
self._event.wait() self._event.wait()
return self.returncode return self.returncode
def send_signal(self, sig): def send_signal(self, sig):
"""Send a signal to the process """Send a signal to the process
""" """
......
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