Skip to content

Commit 5c8c41f

Browse files
committed
Pre-commit update
Apply to files, update scripts for new formatting and ignore generated and manually aligned code
1 parent 3d19e29 commit 5c8c41f

File tree

12 files changed

+59
-43
lines changed

12 files changed

+59
-43
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ repos:
1717
- id: fix-byte-order-marker
1818
- id: detect-private-key
1919
- repo: https://github.com/astral-sh/ruff-pre-commit
20-
rev: v0.7.0
20+
rev: v0.8.0
2121
hooks:
2222
- id: ruff
2323
args: [--fix-only, --exit-non-zero-on-fix]

build_libtcod.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,7 @@ def walk_sources(directory: str) -> Iterator[str]:
233233
234234
This module is auto-generated by `build_libtcod.py`.
235235
"""
236+
236237
from tcod.color import Color
237238
238239
'''
@@ -366,7 +367,7 @@ def write_library_constants() -> None:
366367
f.write(f"{name[5:]} = {color!r}\n")
367368

368369
all_names_merged = ",\n ".join(f'"{name}"' for name in all_names)
369-
f.write(f"\n__all__ = [\n {all_names_merged},\n]\n")
370+
f.write(f"\n__all__ = [ # noqa: RUF022\n {all_names_merged},\n]\n")
370371
update_module_all(Path("tcod/libtcodpy.py"), all_names_merged)
371372

372373
with Path("tcod/event_constants.py").open("w", encoding="utf-8") as f:
@@ -384,7 +385,7 @@ def write_library_constants() -> None:
384385
f.write("\n# --- SDL wheel ---\n")
385386
f.write("{}\n_REVERSE_WHEEL_TABLE = {}\n".format(*parse_sdl_attrs("SDL_MOUSEWHEEL", all_names)))
386387
all_names_merged = ",\n ".join(f'"{name}"' for name in all_names)
387-
f.write(f"\n__all__ = [\n {all_names_merged},\n]\n")
388+
f.write(f"\n__all__ = [ # noqa: RUF022\n {all_names_merged},\n]\n")
388389

389390
event_py = Path("tcod/event.py").read_text(encoding="utf-8")
390391

pyproject.toml

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -178,20 +178,18 @@ select = [
178178
"D", # pydocstyle
179179
]
180180
ignore = [
181-
"E501", # line-too-long
182-
"S101", # assert
183-
"S301", # suspicious-pickle-usage
184-
"S311", # suspicious-non-cryptographic-random-usage
185-
"ANN101", # missing-type-self
186-
"ANN102", # missing-type-cls
187-
"D203", # one-blank-line-before-class
188-
"D204", # one-blank-line-after-class
189-
"D213", # multi-line-summary-second-line
190-
"D407", # dashed-underline-after-section
191-
"D408", # section-underline-after-name
192-
"D409", # section-underline-matches-section-length
193-
"D206", # indent-with-spaces
194-
"W191", # tab-indentation
181+
"E501", # line-too-long
182+
"S101", # assert
183+
"S301", # suspicious-pickle-usage
184+
"S311", # suspicious-non-cryptographic-random-usage
185+
"D203", # one-blank-line-before-class
186+
"D204", # one-blank-line-after-class
187+
"D213", # multi-line-summary-second-line
188+
"D407", # dashed-underline-after-section
189+
"D408", # section-underline-after-name
190+
"D409", # section-underline-matches-section-length
191+
"D206", # indent-with-spaces
192+
"W191", # tab-indentation
195193
]
196194

197195
[tool.ruff.lint.pydocstyle] # https://docs.astral.sh/ruff/settings/#lintpydocstyle

tcod/__init__.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,22 +19,22 @@
1919
from tcod.version import __version__
2020

2121
__all__ = [
22-
"__version__",
22+
"Console",
2323
"__sdl_version__",
24-
"lib",
25-
"ffi",
24+
"__version__",
2625
"bsp",
2726
"color",
2827
"console",
2928
"context",
3029
"event",
31-
"tileset",
30+
"ffi",
3231
"image",
32+
"lib",
3333
"los",
3434
"map",
3535
"noise",
3636
"path",
3737
"random",
3838
"tileset",
39-
"Console",
39+
"tileset",
4040
]

tcod/cffi.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,4 +76,4 @@ def _libtcod_log_watcher(message: Any, userdata: None) -> None: # noqa: ANN401
7676
lib.TCOD_set_log_callback(lib._libtcod_log_watcher, ffi.NULL)
7777
lib.TCOD_set_log_level(0)
7878

79-
__all__ = ["ffi", "lib", "__sdl_version__"]
79+
__all__ = ["__sdl_version__", "ffi", "lib"]

tcod/constants.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,7 @@
503503
white = Color(255, 255, 255)
504504
yellow = Color(255, 255, 0)
505505

506-
__all__ = [
506+
__all__ = [ # noqa: RUF022
507507
"FOV_BASIC",
508508
"FOV_DIAMOND",
509509
"FOV_PERMISSIVE_0",

tcod/context.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -44,24 +44,24 @@
4444
from tcod.cffi import ffi, lib
4545

4646
__all__ = (
47-
"Context",
48-
"new",
49-
"new_window",
50-
"new_terminal",
51-
"SDL_WINDOW_FULLSCREEN",
52-
"SDL_WINDOW_FULLSCREEN_DESKTOP",
53-
"SDL_WINDOW_HIDDEN",
54-
"SDL_WINDOW_BORDERLESS",
55-
"SDL_WINDOW_RESIZABLE",
56-
"SDL_WINDOW_MINIMIZED",
57-
"SDL_WINDOW_MAXIMIZED",
58-
"SDL_WINDOW_INPUT_GRABBED",
59-
"SDL_WINDOW_ALLOW_HIGHDPI",
6047
"RENDERER_OPENGL",
6148
"RENDERER_OPENGL2",
6249
"RENDERER_SDL",
6350
"RENDERER_SDL2",
6451
"RENDERER_XTERM",
52+
"SDL_WINDOW_ALLOW_HIGHDPI",
53+
"SDL_WINDOW_BORDERLESS",
54+
"SDL_WINDOW_FULLSCREEN",
55+
"SDL_WINDOW_FULLSCREEN_DESKTOP",
56+
"SDL_WINDOW_HIDDEN",
57+
"SDL_WINDOW_INPUT_GRABBED",
58+
"SDL_WINDOW_MAXIMIZED",
59+
"SDL_WINDOW_MINIMIZED",
60+
"SDL_WINDOW_RESIZABLE",
61+
"Context",
62+
"new",
63+
"new_terminal",
64+
"new_window",
6565
)
6666

6767
_Event = TypeVar("_Event", bound=tcod.event.Event)

tcod/event.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2818,7 +2818,7 @@ def __getattr__(name: str) -> int:
28182818
return value
28192819

28202820

2821-
__all__ = [ # noqa: F405
2821+
__all__ = [ # noqa: F405 RUF022
28222822
"Modifier",
28232823
"Point",
28242824
"BUTTON_LEFT",

tcod/event_constants.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,24 @@
539539
1027: "MOUSEWHEEL",
540540
}
541541

542-
__all__ = [
542+
__all__ = [ # noqa: RUF022
543+
"KMOD_NONE",
544+
"KMOD_LSHIFT",
545+
"KMOD_RSHIFT",
546+
"KMOD_SHIFT",
547+
"KMOD_LCTRL",
548+
"KMOD_RCTRL",
549+
"KMOD_CTRL",
550+
"KMOD_LALT",
551+
"KMOD_RALT",
552+
"KMOD_ALT",
553+
"KMOD_LGUI",
554+
"KMOD_RGUI",
555+
"KMOD_GUI",
556+
"KMOD_NUM",
557+
"KMOD_CAPS",
558+
"KMOD_MODE",
559+
"KMOD_SCROLL",
543560
"MOUSEWHEEL_NORMAL",
544561
"MOUSEWHEEL_FLIPPED",
545562
"MOUSEWHEEL",

tcod/libtcodpy.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4281,7 +4281,7 @@ def __getattr__(name: str) -> Color:
42814281
raise AttributeError(msg) from None
42824282

42834283

4284-
__all__ = [ # noqa: F405
4284+
__all__ = [ # noqa: F405 RUF022
42854285
"Color",
42864286
"Bsp",
42874287
"NB_FOV_ALGORITHMS",

0 commit comments

Comments
 (0)