File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import inspect
22import sys
3+ from importlib .resources import files
34from pathlib import Path
45
56import yaml
@@ -248,12 +249,8 @@ def get_all_subclasses(cls):
248249 return sorted (get_all_subclasses (CatalogGame ))
249250
250251
251- _CATALOG_YAML = Path (__file__ ).parent / "catalog.yml"
252-
253-
254- def _load_catalog_from_yaml (path : Path ) -> dict [str , dict ]:
255- if not path .exists ():
256- raise FileNotFoundError (f"Catalog YAML not found: { path } " )
252+ def _load_catalog_from_yaml () -> dict [str , dict ]:
253+ path = files (__package__ ) / "catalog.yml"
257254 with path .open ("r" , encoding = "utf-8" ) as f :
258255 return yaml .safe_load (f ) or {}
259256
@@ -318,7 +315,7 @@ def _generate_contrib_game_classes(catalog: dict[str, dict]) -> None:
318315
319316
320317# Generate classes at import time
321- _catalog_data = _load_catalog_from_yaml (_CATALOG_YAML )
318+ _catalog_data = _load_catalog_from_yaml ()
322319_generate_contrib_game_classes (_catalog_data )
323320# _load_coded_games()
324321
You can’t perform that action at this time.
0 commit comments