Skip to content

Commit 02ae0b7

Browse files
committed
Upgrade pre-commit hooks, add configurataion state logging, bump to v1.3.4
Also switch to asynchronous file IO
1 parent cfec59b commit 02ae0b7

File tree

3 files changed

+16
-13
lines changed

3 files changed

+16
-13
lines changed

.github/workflows/tests.yml

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
name: Tests
22

3+
permissions: {}
4+
35
# Controls when the workflow will run
46
on:
57
# Triggers the workflow on push or pull request events but only for the "main" branch

.pre-commit-config.yaml

+5-5
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ repos:
1919
- id: sort-simple-yaml
2020
files: .pre-commit-config.yaml
2121
- repo: https://github.com/psf/black-pre-commit-mirror
22-
rev: 24.10.0
22+
rev: 25.1.0
2323
hooks:
2424
- id: black
2525
- repo: https://github.com/astral-sh/ruff-pre-commit
26-
rev: v0.8.6
26+
rev: v0.9.9
2727
hooks:
2828
- id: ruff
2929
types: [file]
@@ -33,16 +33,16 @@ repos:
3333
hooks:
3434
- id: badgie
3535
- repo: https://github.com/codespell-project/codespell
36-
rev: v2.3.0
36+
rev: v2.4.1
3737
hooks:
3838
- id: codespell
3939
additional_dependencies:
4040
- tomli
4141
- repo: https://github.com/crate-ci/typos
42-
rev: dictgen-v0.3.1
42+
rev: v1.30.0
4343
hooks:
4444
- id: typos
4545
- repo: https://github.com/woodruffw/zizmor-pre-commit
46-
rev: v1.0.0
46+
rev: v1.4.1
4747
hooks:
4848
- id: zizmor

src/fix_lwjgl/__init__.py

+9-8
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# Program that fixes LWJGL java class path data for Minecraft
44
# MIT License
5-
# Copyright (c) 2022-2024 CoolCat467
5+
# Copyright (c) 2022-2025 CoolCat467
66
#
77
# Permission is hereby granted, free of charge, to any person obtaining a copy
88
# of this software and associated documentation files (the "Software"), to deal
@@ -35,7 +35,7 @@
3535

3636
__title__ = "Fix-LWJGL"
3737
__author__ = "CoolCat467"
38-
__version__ = "1.3.3"
38+
__version__ = "1.3.4"
3939
__license__ = "MIT"
4040

4141

@@ -290,9 +290,8 @@ async def download_file(
290290
or b"404: Not Found" in data
291291
):
292292
raise OSError(f'"{filename}" does not exist according to "{url}"!')
293-
# Could have aiofiles dependency and fix this, but I would rather not.
294-
with open(filepath, "wb") as sfile: # noqa: ASYNC230 # sync `open`
295-
sfile.write(data)
293+
async with await trio.open_file(filepath, "wb") as fp:
294+
await fp.write(data)
296295
return filepath
297296

298297

@@ -616,12 +615,14 @@ def run(args: list[str]) -> int:
616615
if config.has_option("main", "lwjgl_base_path"):
617616
base_path = config.get("main", "lwjgl_base_path")
618617
BASE_FOLDER = os.path.expanduser(base_path)
619-
log("Loaded lwjgl base path from config file.")
618+
log(f"Loaded lwjgl base path from config file. ({BASE_FOLDER!r})")
620619
else:
621620
rewrite_config = True
622621
if config.has_option("main", "can_download"):
623622
ALLOWED_TO_DOWNLOAD = config.getboolean("main", "can_download")
624-
log("Loaded if allowed to download from config file.")
623+
log(
624+
f"Loaded if allowed to download from config file. ({ALLOWED_TO_DOWNLOAD!r})",
625+
)
625626
else:
626627
rewrite_config = True
627628
if config.has_option("main", "download_timeout"):
@@ -630,7 +631,7 @@ def run(args: list[str]) -> int:
630631
TIMEOUT = None
631632
else:
632633
TIMEOUT = config.getint("main", "download_timeout")
633-
log("Loaded download timeout from config file.")
634+
log(f"Loaded download timeout from config file. ({TIMEOUT!r})")
634635
else:
635636
rewrite_config = True
636637
else:

0 commit comments

Comments
 (0)