We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 37b1e2b commit a9dc597Copy full SHA for a9dc597
1 file changed
src/pygambit/catalog/__init__.py
@@ -1,13 +1,16 @@
1
-from .catalog import (
2
- PrisonersDilemma,
3
- PrisonersDilemmaTestgame,
4
- TwoStageMatchingPennies,
5
- games,
6
-)
7
-
8
-__all__ = [
9
- "games",
10
- "PrisonersDilemma",
11
- "TwoStageMatchingPennies",
12
- "PrisonersDilemmaTestgame"
13
-]
+from .catalog import games
+
+# Dynamically import all catalog games
+_all_games = games()
+_game_classes = {}
+for game_name in _all_games:
+ # Import each game class from catalog module
+ from . import catalog
+ _game_classes[game_name] = getattr(catalog, game_name)
+# Add to module namespace
+globals().update(_game_classes)
14
15
+# Build __all__ dynamically
16
+__all__ = ["games"] + list(_all_games) # type: ignore[assignment]
0 commit comments