Skip to content

Commit

Permalink
☢ improve behaviour of ignoring mod.* (now still loads mod)
Browse files Browse the repository at this point in the history
  • Loading branch information
Joshix-1 committed May 24, 2024
1 parent 5b45e96 commit a8c19a7
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions an_website/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,10 @@
perf8 = None # pylint: disable=invalid-name

IGNORED_MODULES: Final[set[str]] = {
"patches.*",
"static.*",
"templates.*",
} | (set() if sys.flags.dev_mode else {"example.*"})
"patches",
"static",
"templates",
} | (set() if sys.flags.dev_mode else {"example"})

LOGGER: Final = logging.getLogger(__name__)

Expand All @@ -111,7 +111,6 @@ def get_module_infos() -> str | tuple[ModuleInfo, ...]:
for potential_module in os.listdir(DIR):
if (
potential_module.startswith("_")
or f"{potential_module}.*" in IGNORED_MODULES
or potential_module in IGNORED_MODULES
or not os.path.isdir(os.path.join(DIR, potential_module))
):
Expand All @@ -132,6 +131,9 @@ def get_module_infos() -> str | tuple[ModuleInfo, ...]:
)
continue

if f"{potential_module}.*" in IGNORED_MODULES:
continue

for potential_file in os.listdir(os.path.join(DIR, potential_module)):
module_name = f"{potential_module}.{potential_file[:-3]}"
if (
Expand Down Expand Up @@ -303,7 +305,7 @@ def ignore_modules(config: BetterConfigParser) -> None:
"""Read ignored modules from the config."""
IGNORED_MODULES.update(
config.getset(
"GENERAL", "IGNORED_MODULES", fallback={"element_web_link.*"}
"GENERAL", "IGNORED_MODULES", fallback={"element_web_link"}
)
)

Expand Down

0 comments on commit a8c19a7

Please sign in to comment.