Skip to content

Commit

Permalink
Add pyupgrade (#103)
Browse files Browse the repository at this point in the history
  • Loading branch information
ssbarnea authored Nov 11, 2024
1 parent 4f996e7 commit f2b48b6
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tox.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ on:
workflow_call:

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true

permissions: # needed for tox.yml workflow
Expand Down
8 changes: 7 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
---
repos:
- repo: https://github.com/asottile/pyupgrade
# keep it after flake8
rev: v3.19.0
hooks:
- id: pyupgrade
args: ["--py310-plus"]
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.7.2"
rev: "v0.7.3"
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
Expand Down
6 changes: 3 additions & 3 deletions src/tendo/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from ._version import __version__

__author__ = "Sorin Sbarnea"
__copyright__ = "Copyright 2010-2022, Sorin Sbarnea"
__copyright__ = "Copyright 2010-2024, Sorin Sbarnea"
__email__ = "[email protected]"
__status__ = "Production"
__all__ = (
Expand All @@ -20,5 +20,5 @@
)


if sys.hexversion < 0x03080000:
sys.exit("Python 3.8 or newer is required by tendo module.")
if sys.hexversion < 0x030A0000:
sys.exit("Python 3.10 or newer is required by tendo module.")
4 changes: 2 additions & 2 deletions src/tendo/tee.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def filelogger(msg):
sys.exc_info()[1]
import traceback

print(" ****** ERROR: Exception: %s\nencoding = %s" % (e, encoding))
print(f" ****** ERROR: Exception: {e}\nencoding = {encoding}")
traceback.print_exc(file=sys.stderr)
sys.exit(-1)

Expand Down Expand Up @@ -239,7 +239,7 @@ def test_1(self):
self.assertEqual(
value,
resulted_value,
"Returned <%s>, expected <%s>" % (resulted_value, value),
f"Returned <{resulted_value}>, expected <{value}>",
)
# ret = os.system(resulted_value)
# if not ret==0:
Expand Down
4 changes: 3 additions & 1 deletion src/tendo/unicode.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,9 @@ def open(filename, mode="r", bufsize=-1, fallback_encoding="utf_8"):
import traceback

logging.warning(
"Calling unicode.open(%s,%s,%s) that may be wrong." % (filename, mode, bufsize),
"Calling unicode.open({},{},{}) that may be wrong.".format(
filename, mode, bufsize
),
)
traceback.print_exc(file=sys.stderr)

Expand Down

0 comments on commit f2b48b6

Please sign in to comment.