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

Use ruff in place of black and reorder-python-imports #239

Merged
merged 3 commits into from
Jan 30, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 6 additions & 8 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@ repos:
rev: v2.2.6
hooks:
- id: codespell
- repo: https://github.com/psf/black
rev: 23.11.0
hooks:
- id: black
- repo: https://github.com/asottile/blacken-docs
rev: 1.16.0
hooks:
Expand All @@ -23,11 +19,13 @@ repos:
hooks:
- id: pyupgrade
args: [--py37-plus]
- repo: https://github.com/asottile/reorder-python-imports
rev: v3.12.0
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.14
hooks:
- id: reorder-python-imports
args: ['--application-directories=execnet', --py37-plus]
- id: ruff
args: [ --fix ]
exclude: "^doc/"
- id: ruff-format
- repo: https://github.com/PyCQA/doc8
rev: 'v1.1.1'
hooks:
Expand Down
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ testing = [
[project.urls]
Homepage = "https://execnet.readthedocs.io/en/latest/"

[tool.ruff.lint]
ignore = ["E741"]

[tool.hatch.version]
source = "vcs"

Expand Down
5 changes: 3 additions & 2 deletions src/execnet/gateway_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,7 @@ class GatewayReceivedTerminate(Exception):

def geterrortext(excinfo, format_exception=traceback.format_exception, sysex=sysex):
try:
l = format_exception(*excinfo)
l = format_exception(*excinfo) # noqa:E741
errortext = "".join(l)
except sysex:
raise
Expand Down Expand Up @@ -633,6 +633,7 @@ class TimeoutError(IOError):

class Channel:
"Communication channel between two Python Interpreter execution points."

RemoteError = RemoteError
TimeoutError = TimeoutError
_INTERNALWAKEUP = 1000
Expand Down Expand Up @@ -1543,7 +1544,7 @@ def _save_integral(self, i, short_op, long_op):
def save_int(self, i):
self._save_integral(i, opcode.INT, opcode.LONGINT)

def save_long(self, l):
def save_long(self, l): # noqa:E741
self._save_integral(l, opcode.LONG, opcode.LONGLONG)

def save_float(self, flt):
Expand Down
3 changes: 1 addition & 2 deletions src/execnet/gateway_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

creates io instances used for gateway io
"""
import os
import shlex
import sys

Expand Down Expand Up @@ -228,4 +227,4 @@ def control(data):


if __name__ == "__channelexec__":
serve_proxy_io(channel) # type: ignore[name-defined]
serve_proxy_io(channel) # type: ignore[name-defined] # noqa:F821
2 changes: 1 addition & 1 deletion src/execnet/rsync_remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,4 +114,4 @@ def receive_directory_structure(path, relcomponents):


if __name__ == "__channelexec__":
serve_rsync(channel) # type: ignore[name-defined]
serve_rsync(channel) # type: ignore[name-defined] # noqa:F821
2 changes: 1 addition & 1 deletion src/execnet/script/shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def clientside():
while 1:
r, w, e = select.select(inputlist, [], [])
if sys.stdin in r:
line = raw_input()
line = raw_input() # noqa:F821
sock.sendall(line + "\n")
if sock in r:
line = sock.recv(4096)
Expand Down
3 changes: 1 addition & 2 deletions testing/test_threadpool.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import os
import sys

import pytest
from execnet.gateway_base import WorkerPool
Expand Down Expand Up @@ -61,7 +60,7 @@ def first():


def test_waitfinish_on_reply(pool):
l = []
l = [] # noqa:E741
reply = pool.spawn(lambda: l.append(1))
reply.waitfinish()
assert l == [1]
Expand Down