From e4fd06482edee5fc4acf1a33ccf8f35dd0e213b2 Mon Sep 17 00:00:00 2001 From: Doug Hoskisson Date: Wed, 12 Nov 2025 03:35:19 -0800 Subject: [PATCH] Core: don't use union type just to reuse a name (#5246) This is the "followup PR" to address these comments: https://github.com/ArchipelagoMW/Archipelago/pull/5071#discussion_r2117417408 It's better to have a different name for different representations of the data, so that someone reading the code doesn't need to wonder whether it has gone through the transformation or not. --- Main.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Main.py b/Main.py index 892baa8d4f..47a28813fc 100644 --- a/Main.py +++ b/Main.py @@ -326,7 +326,7 @@ def main(args, seed=None, baked_server_options: dict[str, object] | None = None) if current_sphere: spheres.append(dict(current_sphere)) - multidata: NetUtils.MultiData | bytes = { + multidata: NetUtils.MultiData = { "slot_data": slot_data, "slot_info": slot_info, "connect_names": {name: (0, player) for player, name in multiworld.player_name.items()}, @@ -350,11 +350,11 @@ def main(args, seed=None, baked_server_options: dict[str, object] | None = None) for key in ("slot_data", "er_hint_data"): multidata[key] = convert_to_base_types(multidata[key]) - multidata = zlib.compress(restricted_dumps(multidata), 9) + serialized_multidata = zlib.compress(restricted_dumps(multidata), 9) with open(os.path.join(temp_dir, f'{outfilebase}.archipelago'), 'wb') as f: f.write(bytes([3])) # version of format - f.write(multidata) + f.write(serialized_multidata) output_file_futures.append(pool.submit(write_multidata)) if not check_accessibility_task.result():