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

really drop python<=3.8 support #154

Merged
merged 2 commits into from
Sep 18, 2024
Merged
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
12 changes: 5 additions & 7 deletions src/pyproject_api/_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
See https://tox.readthedocs.io/en/rewrite/development.html#code-style-guide
"""

from __future__ import print_function

import importlib
import json
import locale
Expand All @@ -31,12 +29,12 @@ def __init__(self, backend_module, backend_obj):
def __call__(self, name, *args, **kwargs):
on_object = self if name.startswith("_") else self.backend
if not hasattr(on_object, name):
msg = "{!r} has no attribute {!r}".format(on_object, name)
msg = f"{on_object!r} has no attribute {name!r}"
raise MissingCommand(msg)
return getattr(on_object, name)(*args, **kwargs)

def __str__(self):
return "{}(backend={})".format(self.__class__.__name__, self.backend)
return f"{self.__class__.__name__}(backend={self.backend})"

def _exit(self): # noqa: PLR6301
return 0
Expand Down Expand Up @@ -69,7 +67,7 @@ def run(argv): # noqa: C901, PLR0912, PLR0915
print("failed to start backend", file=sys.stderr)
raise
else:
print("started backend {}".format(backend_proxy), file=sys.stdout)
print(f"started backend {backend_proxy}", file=sys.stdout)
finally:
flush() # pragma: no branch
while True:
Expand All @@ -85,7 +83,7 @@ def run(argv): # noqa: C901, PLR0912, PLR0915
result_file = parsed_message["result"]
except Exception: # noqa: BLE001
# ignore messages that are not valid JSON and contain a valid result path
print("Backend: incorrect request to backend: {}".format(content), file=sys.stderr)
print(f"Backend: incorrect request to backend: {content}", file=sys.stderr)
flush()
else:
result = {}
Expand All @@ -111,7 +109,7 @@ def run(argv): # noqa: C901, PLR0912, PLR0915
traceback.print_exc()
finally:
# used as done marker by frontend
print("Backend: Wrote response {} to {}".format(result, result_file))
print(f"Backend: Wrote response {result} to {result_file}")
flush() # pragma: no branch
if reuse_process is False: # pragma: no branch # no test for reuse process in root test env
break
Expand Down