Skip to content
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

[pre-commit.ci] pre-commit autoupdate #256

Merged
merged 2 commits into from
Mar 13, 2024
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
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ repos:
hooks:
- id: check-yaml
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.2.2
rev: v0.3.2
hooks:
- id: ruff
args: [ --fix ]
Expand All @@ -26,7 +26,7 @@ repos:
args: ["--ignore", "D001"]

- repo: https://github.com/pre-commit/mirrors-mypy
rev: 'v1.8.0'
rev: 'v1.9.0'
hooks:
- id: mypy
additional_dependencies:
Expand Down
1 change: 1 addition & 0 deletions doc/example/popen_read_multiple.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

reading results from possibly blocking code running in sub processes.
"""

import execnet

NUM_PROCESSES = 5
Expand Down
1 change: 1 addition & 0 deletions doc/example/redirect_remote_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
- setting a callback for receiving channel data

"""

import execnet

gw = execnet.makegateway()
Expand Down
1 change: 1 addition & 0 deletions doc/example/svn-sync-repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
uses execnet.

"""

import os
import pathlib
import subprocess
Expand Down
1 change: 1 addition & 0 deletions doc/example/sysinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

(c) Holger Krekel, MIT license
"""

import optparse
import re
import sys
Expand Down
1 change: 1 addition & 0 deletions src/execnet/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

(c) 2012, Holger Krekel and others
"""

from ._version import version as __version__
from .gateway_base import DataFormatError
from .gateway_base import RemoteError
Expand Down
8 changes: 3 additions & 5 deletions src/execnet/gateway.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
gateway code for initiating popen, socket and ssh connections.
(c) 2004-2013, Holger Krekel and others
"""

from __future__ import annotations

import inspect
Expand Down Expand Up @@ -48,9 +49,7 @@ def __repr__(self) -> str:
except AttributeError:
r = "uninitialized"
i = "no"
return "<{} id={!r} {}, {} model, {} active channels>".format(
self.__class__.__name__, self.id, r, self.execmodel.backend, i
)
return f"<{self.__class__.__name__} id={self.id!r} {r}, {self.execmodel.backend} model, {i} active channels>"

def exit(self) -> None:
"""trigger gateway exit. Defer waiting for finishing
Expand Down Expand Up @@ -166,8 +165,7 @@ def __repr__(self) -> str:

if TYPE_CHECKING:

def __getattr__(self, name: str) -> Any:
...
def __getattr__(self, name: str) -> Any: ...


RemoteStatus = RInfo
Expand Down
43 changes: 16 additions & 27 deletions src/execnet/gateway_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
- Ronny Pfannschmidt
- many others
"""

from __future__ import annotations

import abc
Expand All @@ -32,51 +33,39 @@


class WriteIO(Protocol):
def write(self, data: bytes, /) -> None:
...
def write(self, data: bytes, /) -> None: ...


class ReadIO(Protocol):
def read(self, numbytes: int, /) -> bytes:
...
def read(self, numbytes: int, /) -> bytes: ...


class IO(Protocol):
execmodel: ExecModel

def read(self, numbytes: int, /) -> bytes:
...
def read(self, numbytes: int, /) -> bytes: ...

def write(self, data: bytes, /) -> None:
...
def write(self, data: bytes, /) -> None: ...

def close_read(self) -> None:
...
def close_read(self) -> None: ...

def close_write(self) -> None:
...
def close_write(self) -> None: ...

def wait(self) -> int | None:
...
def wait(self) -> int | None: ...

def kill(self) -> None:
...
def kill(self) -> None: ...


class Event(Protocol):
"""Protocol for types which look like threading.Event."""

def is_set(self) -> bool:
...
def is_set(self) -> bool: ...

def set(self) -> None:
...
def set(self) -> None: ...

def clear(self) -> None:
...
def clear(self) -> None: ...

def wait(self, timeout: float | None = None) -> bool:
...
def wait(self, timeout: float | None = None) -> bool: ...


class ExecModel(metaclass=abc.ABCMeta):
Expand Down Expand Up @@ -973,9 +962,9 @@ def reconfigure(

class ChannelFactory:
def __init__(self, gateway: BaseGateway, startcount: int = 1) -> None:
self._channels: weakref.WeakValueDictionary[
int, Channel
] = weakref.WeakValueDictionary()
self._channels: weakref.WeakValueDictionary[int, Channel] = (
weakref.WeakValueDictionary()
)
# Channel ID => (callback, end marker, strconfig)
self._callbacks: dict[
int, tuple[Callable[[Any], Any], object, tuple[bool, bool]]
Expand Down
1 change: 1 addition & 0 deletions src/execnet/gateway_bootstrap.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
code to initialize the remote side of a gateway once the io is created
"""

from __future__ import annotations

import inspect
Expand Down
1 change: 1 addition & 0 deletions src/execnet/gateway_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

creates io instances used for gateway io
"""

from __future__ import annotations

import shlex
Expand Down
1 change: 1 addition & 0 deletions src/execnet/multi.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

(c) 2008-2014, Holger Krekel and others
"""

from __future__ import annotations

import atexit
Expand Down
1 change: 1 addition & 0 deletions src/execnet/rsync.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

(c) 2006-2009, Armin Rigo, Holger Krekel, Maciej Fijalkowski
"""

from __future__ import annotations

import os
Expand Down
1 change: 1 addition & 0 deletions src/execnet/rsync_remote.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
(c) 2006-2013, Armin Rigo, Holger Krekel, Maciej Fijalkowski
"""

from __future__ import annotations

from typing import TYPE_CHECKING
Expand Down
3 changes: 2 additions & 1 deletion src/execnet/script/quitserver.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
"""

send a "quit" signal to a remote server
send a "quit" signal to a remote server

"""

from __future__ import annotations

import socket
Expand Down
1 change: 1 addition & 0 deletions src/execnet/script/shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

for injection into startserver.py
"""

import os
import select
import socket
Expand Down
9 changes: 5 additions & 4 deletions src/execnet/script/socketserver.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
#! /usr/bin/env python
"""
start socket based minimal readline exec server
start socket based minimal readline exec server

it can exeuted in 2 modes of operation
it can exeuted in 2 modes of operation

1. as normal script, that listens for new connections
1. as normal script, that listens for new connections

2. via existing_gateway.remote_exec (as imported module)
2. via existing_gateway.remote_exec (as imported module)

"""

# this part of the program only executes on the server side
#
from __future__ import annotations
Expand Down
1 change: 1 addition & 0 deletions src/execnet/script/socketserverservice.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
python socketserverservice.py register
net start ExecNetSocketServer
"""

import sys
import threading

Expand Down
1 change: 1 addition & 0 deletions src/execnet/xspec.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
(c) 2008-2013, holger krekel
"""

from __future__ import annotations


Expand Down
1 change: 1 addition & 0 deletions testing/test_channel.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
mostly functional tests of gateways.
"""

from __future__ import annotations

import time
Expand Down
1 change: 1 addition & 0 deletions testing/test_gateway.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
mostly functional tests of gateways.
"""

from __future__ import annotations

import os
Expand Down
3 changes: 2 additions & 1 deletion testing/test_multi.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
tests for multi channels and gateway Groups
tests for multi channels and gateway Groups
"""

from __future__ import annotations

import gc
Expand Down
Loading