|
12 | 12 |
|
13 | 13 | import discord |
14 | 14 | from quart import Quart |
15 | | -from schema import Schema, SchemaError |
16 | 15 |
|
17 | 16 | from src.log import logger |
18 | 17 |
|
@@ -40,8 +39,7 @@ def check_func(module: ModuleType, func: Callable, max_args: int, types: dict[st |
40 | 39 | # check_typing(module, func, types) # temporarily disabled due to unwanted behavior # noqa: ERA001 |
41 | 40 |
|
42 | 41 |
|
43 | | -# noinspection DuplicatedCode |
44 | | -def validate_module(module: ModuleType, config: dict[str, Any] | None = None) -> None: |
| 42 | +def validate_module(module: ModuleType, config: dict[str, Any] | None = None) -> None: # pyright: ignore [reportUnusedParameter] # noqa: ARG001 |
45 | 43 | """Validate the module to ensure it has the required functions and attributes to be loaded as an extension. |
46 | 44 |
|
47 | 45 | :param module: The module to validate |
@@ -77,26 +75,6 @@ def validate_module(module: ModuleType, config: dict[str, Any] | None = None) -> |
77 | 75 | assert "enabled" in module.default, ( |
78 | 76 | f"Extension {module.__name__} does not have an enabled key in its default configuration" |
79 | 77 | ) |
80 | | - if hasattr(module, "schema"): |
81 | | - assert isinstance( |
82 | | - module.schema, |
83 | | - Schema | dict, |
84 | | - ), f"Extension {module.__name__} has a schema of type {type(module.schema)} instead of Schema or dict" |
85 | | - |
86 | | - if isinstance(module.schema, dict): |
87 | | - module.schema = Schema(module.schema) |
88 | | - if config: |
89 | | - module.schema.validate(config) |
90 | | - else: |
91 | | - try: |
92 | | - module.schema.validate(module.default) |
93 | | - except SchemaError as e: |
94 | | - warnings.warn( |
95 | | - f"Default configuration for extension {module.__name__} does not match schema: {e}", |
96 | | - stacklevel=1, |
97 | | - ) |
98 | | - else: |
99 | | - warnings.warn(f"Extension {module.__name__} does not have a schema", stacklevel=1) |
100 | 78 |
|
101 | 79 |
|
102 | 80 | def unzip_extensions() -> None: |
|
0 commit comments