Skip to content
This repository was archived by the owner on Mar 1, 2026. It is now read-only.

Commit 2ae0202

Browse files
committed
Update dev-dependencies
1 parent 3a2b5e8 commit 2ae0202

File tree

6 files changed

+186
-97
lines changed

6 files changed

+186
-97
lines changed

decompile_ts4.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,29 +15,29 @@ function progress {
1515

1616
source_dir=$TS4_DECOMPRESSED_SOURCE
1717

18-
files=$(find $source_dir -name '*.pyc')
18+
files=$(find "$source_dir" -name '*.pyc')
1919
files_total=$(echo "$files" | wc -l)
2020
files_done=0
2121

2222
for file in $files
2323
do
2424
out_dir="$script_dir/ts4/$(dirname ${file#$source_dir})/"
25-
mkdir -p $out_dir
26-
uv run decompyle3 -o $out_dir $file &
25+
mkdir -p "$out_dir"
26+
uv run uncompyle6 -o "$out_dir" "$file" &
2727

28-
progress $(($files_done*100/$files_total))
28+
progress $((files_done*100/files_total))
2929

3030
if [[ $(jobs -r | wc -l) -ge 10 ]]; then
3131
wait -fn
3232
files_done=$((files_done+1))
33-
progress $(($files_done*100/$files_total))
33+
progress $((files_done*100/files_total))
3434
fi
3535
done
3636

3737
while [[ $(jobs -r | wc -l) -gt 0 ]]; do
3838
wait -fn
3939
files_done=$((files_done+1))
40-
progress $(($files_done*100/$files_total))
40+
progress $((files_done*100/files_total))
4141
done
4242

4343
echo ""

pyproject.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ email = "jovan.gerodetti@titannano.de>"
1212

1313
[tool.uv]
1414
dev-dependencies = [
15-
"ruff~=0.4.7",
16-
"decompyle3~=3.9.1",
17-
"pylint~=2.6.0",
18-
"python-lsp-server[rope]~=1.7.4",
19-
"pylsp-mypy~=0.6.7",
15+
"ruff>=0.11.0",
16+
"pylint>=2.6.0",
17+
"python-lsp-server[rope]>=1.7.4",
18+
"pylsp-mypy>=0.6.7",
19+
"uncompyle6>=3.9.2",
2020
]
2121

2222
[tool.ruff.lint]

src/control_any_sim/canys_interactions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ def _run_interaction_gen(self: Self, timeline: Timeline) -> bool:
195195
return False
196196

197197
@classmethod
198-
def _must_be_selectable(cls: type[C], sim_info: SimInfo) -> bool:
198+
def _must_be_selectable(cls, sim_info: SimInfo) -> bool:
199199
return services.active_household_id() == sim_info.household_id
200200

201201

src/control_any_sim/util/game_events.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from __future__ import annotations
44

55
import traceback
6-
from typing import TYPE_CHECKING, Any, Callable, ClassVar, TypeVar
6+
from typing import TYPE_CHECKING, Callable, ClassVar, TypeVar
77

88
import services
99
from server.client import Client
@@ -43,20 +43,20 @@ class GameEvents:
4343
travel_sim_out_handlers: ClassVar[list[OnTravelSimOut]] = []
4444

4545
@classmethod
46-
def on_zone_teardown(cls: type[C], handler: OnZoneTeardown) -> None:
46+
def on_zone_teardown(cls, handler: OnZoneTeardown) -> None:
4747
"""Add a listener for the zone_teardown event."""
4848
cls.zone_teardown_handlers.append(handler)
4949

5050
@classmethod
51-
def remove_zone_teardown(cls: type[C], handler: OnZoneTeardown) -> None:
51+
def remove_zone_teardown(cls, handler: OnZoneTeardown) -> None:
5252
"""Remove a listener for the zone_teardown event."""
5353
if handler not in cls.zone_teardown_handlers:
5454
return
5555

5656
cls.zone_teardown_handlers.remove(handler)
5757

5858
@classmethod
59-
def emit_zone_teardown(cls: type[C], current_zone: Zone, client: Client) -> None:
59+
def emit_zone_teardown(cls, current_zone: Zone, client: Client) -> None:
6060
"""Emit a zone teardown event."""
6161
Logger.log(
6262
f"registered zone teardown handlers: {len(cls.zone_teardown_handlers)}",
@@ -66,13 +66,13 @@ def emit_zone_teardown(cls: type[C], current_zone: Zone, client: Client) -> None
6666
handler(current_zone, client)
6767

6868
@classmethod
69-
def on_zone_spin_up(cls: type[C], handler: OnZoneSpinUp) -> None:
69+
def on_zone_spin_up(cls, handler: OnZoneSpinUp) -> None:
7070
"""Add a listener for the zone_spin_up event."""
7171
cls.zone_spin_up_handlers.append(handler)
7272

7373
@classmethod
7474
def emit_zone_spin_up(
75-
cls: type[C],
75+
cls,
7676
current_zone: Zone,
7777
household_id: int,
7878
active_sim_id: int,
@@ -82,12 +82,12 @@ def emit_zone_spin_up(
8282
handler(current_zone, household_id, active_sim_id)
8383

8484
@classmethod
85-
def on_add_sim(cls: type[C], handler: OnAddSim) -> None:
85+
def on_add_sim(cls, handler: OnAddSim) -> None:
8686
"""Add a listener for the add_sim event."""
8787
cls.add_sim_handlers.append(handler)
8888

8989
@classmethod
90-
def emit_add_sim(cls: type[C], sim: Sim) -> None:
90+
def emit_add_sim(cls, sim: Sim) -> None:
9191
"""Emit the add sim event."""
9292
for handler in cls.add_sim_handlers:
9393
handler(sim)
@@ -99,28 +99,28 @@ def on_active_sim_changed(handler: OnActiveSimChanged) -> None:
9999

100100
@classmethod
101101
def on_loading_screen_animation_finished(
102-
cls: type[C],
102+
cls,
103103
handler: OnLoadingScreenAnimationFinished,
104104
) -> None:
105105
"""Add a listener for the loading_screen_animation_finished event."""
106106
cls.loading_screen_animation_finished_handlers.append(handler)
107107

108108
@classmethod
109109
def emit_loading_screen_animation_finished(
110-
cls: type[C],
110+
cls,
111111
current_zone: Zone,
112112
) -> None:
113113
"""Emit the loading screen finished event."""
114114
for handler in cls.loading_screen_animation_finished_handlers:
115115
handler(current_zone)
116116

117117
@classmethod
118-
def on_travel_sim_out(cls: type[C], handler: OnTravelSimOut) -> None:
118+
def on_travel_sim_out(cls, handler: OnTravelSimOut) -> None:
119119
"""Add a listener for the travel_sim_out event."""
120120
cls.travel_sim_out_handlers.append(handler)
121121

122122
@classmethod
123-
def emit_travel_sim_out(cls: type[C], sim_info: SimInfo) -> None:
123+
def emit_travel_sim_out(cls, sim_info: SimInfo) -> None:
124124
"""Emit the travel sim out event."""
125125
for handler in cls.travel_sim_out_handlers:
126126
handler(sim_info)
@@ -133,10 +133,10 @@ def on_post_spawn_sim(handler: OnPostSpawnSim) -> None:
133133

134134
@inject_method_to(Zone, "on_teardown")
135135
def canys_zone_on_teardown(
136-
original: Callable[[Zone, Client], Any],
136+
original: Callable[[Zone, Client], None],
137137
self: Zone,
138138
client: Client,
139-
) -> Any: # noqa: ANN401
139+
) -> None:
140140
"""Wrap around the Zone::on_teardown method to emit the coresponding event."""
141141
try:
142142
Logger.log("Zone.on_teardown event occurred")

src/control_any_sim/util/serialize.py

Lines changed: 35 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,25 @@
55
import json
66
from typing import Any, Callable, TypeVar
77

8+
from typing_extensions import Self
9+
810
C = TypeVar("C")
911

1012

1113
def dict_to_obj(cls: type[C]) -> Callable[[dict[str, Any]], C]:
12-
"""Convert a dict into an object."""
14+
"""
15+
Convert a dict into an object.
16+
17+
Returns
18+
-------
19+
A function that converts an object into a dictionary.
20+
21+
"""
1322

1423
def hook(our_dict: dict[str, Any]) -> C:
15-
if "__class__" in our_dict:
16-
del our_dict["__class__"]
24+
our_dict.pop("__class__", None)
1725

18-
if "__module__" in our_dict:
19-
del our_dict["__module__"]
26+
our_dict.pop("__module__", None)
2027

2128
# Use dictionary unpacking to initialize the object
2229
return cls(**our_dict)
@@ -28,8 +35,12 @@ def object_to_dict(obj: object) -> dict[str, Any]:
2835
"""
2936
Convert object to dict.
3037
31-
Takes in a custom object and returns a dictionary representation
32-
of the object.
38+
Takes in a custom object
39+
40+
Returns
41+
-------
42+
A dictionary representation of the object.
43+
3344
"""
3445
return obj.__dict__
3546

@@ -38,10 +49,24 @@ class Serializable:
3849
"""Class that can be serialized to JSON."""
3950

4051
def serialize(self: object) -> str:
41-
"""Serialize an object into a JSON string."""
52+
"""
53+
Serialize an object into a JSON string.
54+
55+
Returns
56+
-------
57+
A JSON string of the serialized data.
58+
59+
"""
4260
return json.dumps(self, default=object_to_dict, indent=4, sort_keys=True)
4361

4462
@classmethod
45-
def deserialize(cls: type[C], data: str) -> C:
46-
"""Deserialize an object from a JSON string."""
63+
def deserialize(cls, data: str) -> Self:
64+
"""
65+
Deserialize an object from a JSON string.
66+
67+
Returns
68+
-------
69+
A new instance of Self.
70+
71+
"""
4772
return json.loads(data, object_hook=dict_to_obj(cls))

0 commit comments

Comments
 (0)