From f69ff2e56a4b0c5762b323329a6658fd91bd2242 Mon Sep 17 00:00:00 2001 From: Jarno Westhof Date: Mon, 14 Jul 2025 21:15:40 +0200 Subject: [PATCH] Implemented fix for itterating enum flags on python 3.10 --- worlds/satisfactory/ItemData.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/worlds/satisfactory/ItemData.py b/worlds/satisfactory/ItemData.py index 92b9a029fb..0356086fac 100644 --- a/worlds/satisfactory/ItemData.py +++ b/worlds/satisfactory/ItemData.py @@ -33,6 +33,15 @@ class ItemGroups(IntFlag): ConveyorMk6 = 1 << 28 NeverExclude = 1 << 29 +# Workaround for Python 3.10 support. Iterating Flag instances was only added in Python 3.11. +if getattr(ItemGroups.Parts, "__iter__", None) is None: + def __iter__(self: ItemGroups): + for flag in ItemGroups: + if flag in self: + yield flag + ItemGroups.__iter__ = __iter__ # type: ignore + del __iter__ + class ItemData(NamedTuple): """Represents an item in the pool, it could be a resource bundle, production recipe, trap, etc."""