Skip to content

Typing prep #189

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
May 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
311 changes: 162 additions & 149 deletions execnet/gateway_base.py

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions execnet/gateway_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@

class Popen2IOMaster(Popen2IO):
def __init__(self, args, execmodel):
self.popen = p = execmodel.PopenPiped(args)
Popen2IO.__init__(self, p.stdin, p.stdout, execmodel=execmodel)
PIPE = execmodel.subprocess.PIPE
self.popen = p = execmodel.subprocess.Popen(args, stdout=PIPE, stdin=PIPE)
super().__init__(p.stdin, p.stdout, execmodel=execmodel)

def wait(self):
try:
Expand Down
5 changes: 0 additions & 5 deletions execnet/gateway_socket.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,6 @@

from execnet.gateway_bootstrap import HostNotFound

try:
bytes
except NameError:
bytes = str


class SocketIO:
def __init__(self, sock, execmodel):
Expand Down
8 changes: 4 additions & 4 deletions execnet/multi.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
from . import gateway_bootstrap
from . import gateway_io
from .gateway_base import get_execmodel
from .gateway_base import reraise
from .gateway_base import trace
from .gateway_base import WorkerPool
from .xspec import XSpec

NO_ENDMARKER_WANTED = object()
Expand Down Expand Up @@ -174,7 +174,7 @@ def allocate_id(self, spec):
def _register(self, gateway):
assert not hasattr(gateway, "_group")
assert gateway.id
assert id not in self
assert gateway.id not in self
self._gateways.append(gateway)
gateway._group = self

Expand Down Expand Up @@ -289,11 +289,11 @@ def waitclose(self):
if first is None:
first = sys.exc_info()
if first:
reraise(*first)
raise first[1].with_traceback(first[2])


def safe_terminate(execmodel, timeout, list_of_paired_functions):
workerpool = execmodel.WorkerPool()
workerpool = WorkerPool(execmodel)

def termkill(termfunc, killfunc):
termreply = workerpool.spawn(termfunc)
Expand Down
6 changes: 3 additions & 3 deletions execnet/script/shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def clientside():
line = sock.recv(4096)
sys.stdout.write(line)
sys.stdout.flush()
except:
except BaseException:
import traceback

print(traceback.print_exc())
Expand All @@ -43,7 +43,7 @@ def clientside():
class promptagent(Thread):
def __init__(self, clientsock):
print("server side starting")
Thread.__init__(self)
super.__init__()
self.clientsock = clientsock

def run(self):
Expand All @@ -66,7 +66,7 @@ def run(self):
try:
try:
exec(compile(line + "\n", "<remote pyin>", "single"))
except:
except BaseException:
print_exc()
finally:
sys.stdout = oldout
Expand Down
2 changes: 1 addition & 1 deletion execnet/script/socketserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def startserver(serversock, loop=False):
exec_from_one_connection(serversock)
except (KeyboardInterrupt, SystemExit):
raise
except:
except BaseException:
if debug:
import traceback

Expand Down
2 changes: 1 addition & 1 deletion execnet/script/socketserverservice.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def __init__(self, args):
win32evtlogutil.AddSourceToRegistry(
self._svc_display_name_, servicemanager.__file__, "Application"
)
win32serviceutil.ServiceFramework.__init__(self, args)
super.__init__(args)
self.hWaitStop = win32event.CreateEvent(None, 0, 0, None)
self.WAIT_TIME = 1000 # in milliseconds

Expand Down
2 changes: 1 addition & 1 deletion execnet/script/xx.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@

try:
hostport = sys.argv[1]
except:
except BaseException:
hostport = ":8888"
gw = register.ServerGateway(hostport)