work: restore shift+spacebar for media play/pause
maybe put in maya config? idk what funiman's preference is
This commit is contained in:
@@ -4,17 +4,34 @@
|
||||
|
||||
import contextlib
|
||||
import importlib
|
||||
from pathlib import Path
|
||||
import sys
|
||||
import logging
|
||||
import sys
|
||||
from pathlib import Path
|
||||
from types import ModuleType
|
||||
from typing import Iterator, Iterable
|
||||
from typing import Iterable, Iterator
|
||||
|
||||
_my_dir = Path(__file__).parent
|
||||
_log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def load_wheel(module_name: str, submodules: Iterable[str]) -> list[ModuleType]:
|
||||
def filename(
|
||||
module_name: str,
|
||||
*,
|
||||
filename_prefix: str = "",
|
||||
) -> Path:
|
||||
"""Returns the filename of the wheel file for this module."""
|
||||
|
||||
if not filename_prefix:
|
||||
filename_prefix = _fname_prefix_from_module_name(module_name)
|
||||
return _wheel_filename(filename_prefix)
|
||||
|
||||
|
||||
def load_wheel(
|
||||
module_name: str,
|
||||
submodules: Iterable[str],
|
||||
*,
|
||||
filename_prefix: str = "",
|
||||
) -> list[ModuleType]:
|
||||
"""Loads modules from a wheel file 'module_name*.whl'.
|
||||
|
||||
Loads `module_name`, and if submodules are given, loads
|
||||
@@ -25,8 +42,7 @@ def load_wheel(module_name: str, submodules: Iterable[str]) -> list[ModuleType]:
|
||||
Returns the loaded modules, so [module, submodule, submodule, ...].
|
||||
"""
|
||||
|
||||
fname_prefix = _fname_prefix_from_module_name(module_name)
|
||||
wheel = _wheel_filename(fname_prefix)
|
||||
wheel = filename(module_name, filename_prefix=filename_prefix)
|
||||
|
||||
loaded_modules: list[ModuleType] = []
|
||||
to_load = [module_name] + [f"{module_name}.{submodule}" for submodule in submodules]
|
||||
@@ -47,9 +63,9 @@ def load_wheel(module_name: str, submodules: Iterable[str]) -> list[ModuleType]:
|
||||
loaded_modules.append(module)
|
||||
_log.info("Loaded %s from %s", modname, module.__file__)
|
||||
|
||||
assert len(loaded_modules) == len(
|
||||
to_load
|
||||
), f"expecting to load {len(to_load)} modules, but only have {len(loaded_modules)}: {loaded_modules}"
|
||||
assert len(loaded_modules) == len(to_load), (
|
||||
f"expecting to load {len(to_load)} modules, but only have {len(loaded_modules)}: {loaded_modules}"
|
||||
)
|
||||
return loaded_modules
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user