File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 495495 },
496496 {
497497 "cell_type" : " code" ,
498- "execution_count" : 15 ,
498+ "execution_count" : 14 ,
499499 "id" : " 6db7a29a" ,
500500 "metadata" : {},
501501 "outputs" : [
509509 " Game(title='Two person Prisoner's Dilemma game')"
510510 ]
511511 },
512- "execution_count" : 15 ,
512+ "execution_count" : 14 ,
513513 "metadata" : {},
514514 "output_type" : " execute_result"
515515 }
535535 },
536536 {
537537 "cell_type" : " code" ,
538- "execution_count" : 16 ,
538+ "execution_count" : 15 ,
539539 "id" : " f58eaa77" ,
540540 "metadata" : {},
541541 "outputs" : [],
553553 },
554554 {
555555 "cell_type" : " code" ,
556- "execution_count" : 17 ,
556+ "execution_count" : 16 ,
557557 "id" : " 4119a2ac" ,
558558 "metadata" : {},
559559 "outputs" : [],
Original file line number Diff line number Diff line change 1+ from . import catalog
12from .catalog import games
23
3- # Dynamically import all catalog games
4+ # Ensure catalog module is fully imported including all YAML-generated classes exist
45_all_games = games ()
56_game_classes = {}
67
78for game_name in _all_games :
8- # Import each game class from catalog module
9- from . import catalog
10- _game_classes [game_name ] = getattr (catalog , game_name )
9+ try :
10+ _game_classes [game_name ] = getattr (catalog , game_name )
11+ except AttributeError as e :
12+ raise ImportError (
13+ f"Catalog game '{ game_name } ' listed but not found in catalog module"
14+ ) from e
1115
1216# Add to module namespace
1317globals ().update (_game_classes )
1418
1519# Build __all__ dynamically
16- __all__ = ["games" ] + list (_all_games ) # type: ignore[assignment]
17-
18- # from .catalog import (
19- # OneShotTrust,
20- # PrisonersDilemma,
21- # TwoStageMatchingPennies,
22- # games,
23- # )
24-
25- # __all__ = [
26- # "games",
27- # "PrisonersDilemma",
28- # "TwoStageMatchingPennies",
29- # "OneShotTrust",
30- # ]
20+ __all__ = ["games" , * list (_all_games )]
You can’t perform that action at this time.
0 commit comments