Skip to content

Commit 68e43e5

Browse files
authored
Merge pull request #31 from apple1417/master
upgrade python to 3.12
2 parents 455a346 + 0d0cbce commit 68e43e5

File tree

8 files changed

+87
-68
lines changed

8 files changed

+87
-68
lines changed

.cruft.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"template": "[email protected]:bl-sdk/common_dotfiles.git",
3-
"commit": "fb06ff8c773806b3f8cc69dbda60c0a7b481c6de",
3+
"commit": "e5fa8d6e372d18cb22415511cc02831cc706e061",
44
"checkout": null,
55
"context": {
66
"cookiecutter": {

.github/workflows/build.yml

+8-15
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ env:
1717
XWIN_VERSION: xwin-0.5.0-x86_64-unknown-linux-musl
1818
XWIN_DOWNLOAD: https://github.com/Jake-Shadle/xwin/releases/download/0.5.0/xwin-0.5.0-x86_64-unknown-linux-musl.tar.gz
1919
# Python settings
20-
PYTHON_VERSION: "3.11.5"
20+
PYTHON_VERSION: "3.12.1"
2121

2222
jobs:
2323
cache-clang:
@@ -322,19 +322,6 @@ jobs:
322322
- name: Check spelling
323323
uses: crate-ci/typos@master
324324

325-
black:
326-
runs-on: ubuntu-latest
327-
328-
steps:
329-
- name: Checkout repository
330-
uses: actions/checkout@v3
331-
332-
- name: Check formatting
333-
uses: psf/black@stable
334-
with:
335-
options: --check --verbose
336-
src: ./stubs
337-
338325
pyright:
339326
runs-on: ubuntu-latest
340327

@@ -356,7 +343,13 @@ jobs:
356343
- name: Checkout repository
357344
uses: actions/checkout@v3
358345

359-
- name: Run Ruff
346+
- name: Run Ruff Linting
347+
uses: chartboost/ruff-action@v1
348+
with:
349+
src: ./stubs
350+
351+
- name: Run Ruff Formatting
360352
uses: chartboost/ruff-action@v1
361353
with:
362354
src: ./stubs
355+
args: format --check

pyproject.toml

+26-6
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,11 @@
1-
[tool.black]
2-
target-version = ["py311"]
3-
line-length = 100
4-
51
[tool.pyright]
6-
pythonVersion = "3.11"
2+
pythonVersion = "3.12"
73
typeCheckingMode = "strict"
84

95
include = ["stubs"]
106

117
[tool.ruff]
12-
target-version = "py311"
8+
target-version = "py312"
139
line-length = 100
1410
select = [
1511
"F",
@@ -23,13 +19,17 @@ select = [
2319
"YTT",
2420
"ANN",
2521
"ASYNC",
22+
"S",
2623
"BLE",
2724
"B",
2825
"A",
2926
"COM",
3027
"C4",
28+
"DTZ",
29+
"T10",
3130
"FA",
3231
"ISC",
32+
"ICN",
3333
"G",
3434
"PIE",
3535
"PYI",
@@ -39,11 +39,19 @@ select = [
3939
"SLOT",
4040
"SIM",
4141
"TID",
42+
"TCH",
43+
"INT",
4244
"ARG",
4345
"PTH",
46+
"TD",
47+
"FIX",
48+
"ERA",
4449
"PGH",
50+
"PL",
4551
"FLY",
4652
"PERF",
53+
"FURB",
54+
"LOG",
4755
"RUF",
4856
]
4957
ignore = [
@@ -67,11 +75,23 @@ ignore = [
6775
"ANN101",
6876
"ANN102",
6977
"ANN401",
78+
"S101",
79+
"S603",
80+
"S607",
7081
"PYI011",
7182
"PYI021",
7283
"PYI029",
7384
"PYI044",
7485
"PGH003",
86+
"PLR0904",
87+
"PLR0911",
88+
"PLR0912",
89+
"PLR0913",
90+
"PLR0915",
91+
"PLR6301",
92+
"PLW0603",
93+
"PLW2901",
94+
"FURB140",
7595
]
7696

7797
[tool.ruff.per-file-ignores]

stubs/unrealsdk/commands/__init__.pyi

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from __future__ import annotations
22

33
from collections.abc import Callable
4-
from typing import Final, TypeAlias
4+
from typing import Final
55

66
__all__: tuple[str, ...] = (
77
"NEXT_LINE",
@@ -12,7 +12,7 @@ __all__: tuple[str, ...] = (
1212

1313
NEXT_LINE: Final[str] = ...
1414

15-
_CommandCallback: TypeAlias = Callable[[str, int], None]
15+
type _CommandCallback = Callable[[str, int], None]
1616

1717
def add_command(cmd: str, callback: _CommandCallback) -> None:
1818
"""

stubs/unrealsdk/hooks/__init__.pyi

+11-9
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1+
# ruff: noqa: D205, FIX004
2+
13
from __future__ import annotations
24

35
from collections.abc import Callable
46
from enum import EnumMeta
57
from types import EllipsisType
6-
from typing import Any, ClassVar, Literal, TypeAlias, overload
8+
from typing import Any, ClassVar, Literal, overload
79

810
from unrealsdk.unreal import BoundFunction, UObject, WrappedStruct
911

@@ -22,7 +24,7 @@ class Block:
2224
"""
2325
A sentinel used to indicate a hook should block execution of the unrealscript
2426
function.
25-
""" # noqa: D205
27+
"""
2628

2729
# HACK: Pybind enums are completely normal classes, they don't inherit from the standard library
2830
# enums, which means we're not allowed to use them in Literal type hints.
@@ -67,17 +69,17 @@ class Unset:
6769
"""
6870
A sentinel used to indicate a return value override is unset - i.e. the actual
6971
return value will be used.
70-
""" # noqa: D205
72+
"""
7173

72-
_HookBlockSignal: TypeAlias = None | EllipsisType | Block | type[Block]
73-
_PreHookCallback: TypeAlias = Callable[
74+
type _HookBlockSignal = None | EllipsisType | Block | type[Block]
75+
type _PreHookCallback = Callable[
7476
[UObject, WrappedStruct, Any, BoundFunction],
7577
_HookBlockSignal | tuple[_HookBlockSignal, Any],
7678
]
77-
_PostHookCallback: TypeAlias = Callable[[UObject, WrappedStruct, Any, BoundFunction], None]
79+
type _PostHookCallback = Callable[[UObject, WrappedStruct, Any, BoundFunction], None]
7880

79-
_PreHookType: TypeAlias = Literal[Type.PRE]
80-
_PostHookType: TypeAlias = Literal[Type.POST, Type.POST_UNCONDITIONAL]
81+
type _PreHookType = Literal[Type.PRE]
82+
type _PostHookType = Literal[Type.POST, Type.POST_UNCONDITIONAL]
8183

8284
@overload
8385
def add_hook(
@@ -170,7 +172,7 @@ def log_all_calls(should_log: bool) -> None:
170172
171173
Args:
172174
should_log: True to turn on logging all calls, false to turn it off.
173-
""" # noqa: D205
175+
"""
174176

175177
def remove_hook(func: str, type: Type, identifier: str) -> bool:
176178
"""

stubs/unrealsdk/logging/__init__.pyi

+7-5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# ruff: noqa: D205
2+
13
from __future__ import annotations
24

35
from typing import Any, ClassVar
@@ -87,7 +89,7 @@ def dev_warning(*args: Any, **kwargs: Any) -> None:
8789
Args:
8890
*args: Forwarded to print().
8991
**kwargs: Forwarded to print().
90-
""" # noqa: D205
92+
"""
9193

9294
def error(*args: Any, **kwargs: Any) -> None:
9395
"""
@@ -97,7 +99,7 @@ def error(*args: Any, **kwargs: Any) -> None:
9799
Args:
98100
*args: Forwarded to print().
99101
**kwargs: Forwarded to print().
100-
""" # noqa: D205
102+
"""
101103

102104
def info(*args: Any, **kwargs: Any) -> None:
103105
"""
@@ -107,7 +109,7 @@ def info(*args: Any, **kwargs: Any) -> None:
107109
Args:
108110
*args: Forwarded to print().
109111
**kwargs: Forwarded to print().
110-
""" # noqa: D205
112+
"""
111113

112114
def is_console_ready() -> bool:
113115
"""
@@ -127,7 +129,7 @@ def misc(*args: Any, **kwargs: Any) -> None:
127129
Args:
128130
*args: Forwarded to print().
129131
**kwargs: Forwarded to print().
130-
""" # noqa: D205
132+
"""
131133

132134
def set_console_level(level: Level) -> bool:
133135
"""
@@ -149,4 +151,4 @@ def warning(*args: Any, **kwargs: Any) -> None:
149151
Args:
150152
*args: Forwarded to print().
151153
**kwargs: Forwarded to print().
152-
""" # noqa: D205
154+
"""

stubs/unrealsdk/unreal/__init__.pyi

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# ruff: noqa: D205
2+
13
from __future__ import annotations
24

35
from ._bound_function import BoundFunction
@@ -80,4 +82,4 @@ def dir_includes_unreal(should_include: bool) -> None:
8082
8183
Args:
8284
should_include: True if to include dynamic properties, false to not.
83-
""" # noqa: D205
85+
"""

0 commit comments

Comments
 (0)