Skip to content

Commit

Permalink
Merge pull request #48 from Dunedan/update-ci-dependencies
Browse files Browse the repository at this point in the history
Update Github actions and pre-commit hooks
  • Loading branch information
Dunedan authored Dec 2, 2024
2 parents 8755e03 + 25568ca commit c19e2db
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 14 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
- uses: pre-commit/[email protected]
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- uses: pre-commit/[email protected]
2 changes: 1 addition & 1 deletion .github/workflows/unittests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- name: Install tox
Expand Down
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
rev: v5.0.0
hooks:
- id: check-added-large-files
- id: check-case-conflict
Expand All @@ -23,7 +23,7 @@ repos:
- id: forbid-tabs

- repo: https://github.com/igorshubovych/markdownlint-cli
rev: v0.39.0
rev: v0.43.0
hooks:
- id: markdownlint

Expand All @@ -42,7 +42,7 @@ repos:
exclude: ^ejabberd_example.yml$

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.4.5
rev: v0.8.0
hooks:
- id: ruff
args:
Expand Down
4 changes: 1 addition & 3 deletions xpartamupp/echelon.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,9 +288,7 @@ def _verify_game(game_report):
jid for jid, state in game_report["playerStates"].items() if state == "won"
]
# We only support 1v1s right now.
if len(winning_jids) > 1 or len(dict.keys(game_report["playerStates"])) != 2:
return False
return True
return len(winning_jids) == 1 and len(dict.keys(game_report["playerStates"])) == 2

def _rate_game(self, game):
"""Update player ratings based on game outcome.
Expand Down
2 changes: 1 addition & 1 deletion xpartamupp/elo.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def get_rating_adjustment(rating, opponent_rating, games_played, _opponent_games
"""
if rating < -2199 or opponent_rating < -2199:
raise ValueError(
"Too small rating given: rating: %i, opponent rating: %i" % (rating, opponent_rating)
f"Too small rating given: rating: {rating}, opponent rating: {opponent_rating}"
)

rating_k_factor = (
Expand Down
6 changes: 2 additions & 4 deletions xpartamupp/stanzas.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,7 @@ def get_game(self):
data = {}

if game is not None:
for key, item in game.items():
data[key] = item
data = dict(game.items())
return data


Expand Down Expand Up @@ -119,8 +118,7 @@ def get_game(self):
data = {}

if game is not None:
for key, item in game.items():
data[key] = item
data = dict(game.items())
return data


Expand Down

0 comments on commit c19e2db

Please sign in to comment.