core: migrate code to benefit from 3.9 stuff

for now keeping ruff on 3.8 target version, need to sort out modules as well
This commit is contained in:
Dima Gerasimov 2024-10-19 20:19:07 +01:00
parent d1511929a8
commit 721fd98dca
37 changed files with 413 additions and 302 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]