core: migrate code to benefit from 3.9 stuff (#401)

for now keeping ruff on 3.8 target version, need to sort out modules as well
This commit is contained in:
karlicoss 2024-10-19 20:55:09 +01:00 committed by GitHub
parent bc7c3ac253
commit d3f9a8e8b6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
43 changed files with 515 additions and 404 deletions

View file

@ -1,6 +1,8 @@
from __future__ import annotations
import sys
import types
from typing import Any, Dict, Optional
from typing import Any
# The idea behind this one is to support accessing "overlaid/shadowed" modules from namespace packages
@ -20,7 +22,7 @@ def import_original_module(
file: str,
*,
star: bool = False,
globals: Optional[Dict[str, Any]] = None,
globals: dict[str, Any] | None = None,
) -> types.ModuleType:
module_to_restore = sys.modules[module_name]