Load the extensions from the list and bind it to the environment. Returns a dict of instantiated extensions.
(
environment: "Environment",
extensions: t.Sequence[t.Union[str, t.Type["Extension"]]],
)
| 106 | |
| 107 | |
| 108 | def load_extensions( |
| 109 | environment: "Environment", |
| 110 | extensions: t.Sequence[t.Union[str, t.Type["Extension"]]], |
| 111 | ) -> t.Dict[str, "Extension"]: |
| 112 | """Load the extensions from the list and bind it to the environment. |
| 113 | Returns a dict of instantiated extensions. |
| 114 | """ |
| 115 | result = {} |
| 116 | |
| 117 | for extension in extensions: |
| 118 | if isinstance(extension, str): |
| 119 | extension = t.cast(t.Type["Extension"], import_string(extension)) |
| 120 | |
| 121 | result[extension.identifier] = extension(environment) |
| 122 | |
| 123 | return result |
| 124 | |
| 125 | |
| 126 | def _environment_config_check(environment: _env_bound) -> _env_bound: |
no test coverage detected