mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2025-12-12 01:00:29 +08:00
fixed deprecated find_module()
This commit is contained in:
parent
3a13f83fbb
commit
78898ba325
@ -22,6 +22,7 @@
|
||||
|
||||
import pkgutil
|
||||
import functools
|
||||
import importlib.util
|
||||
import importlib.machinery
|
||||
|
||||
import Xlib.keysymdef
|
||||
@ -87,10 +88,11 @@ def _get_keysyms() -> dict[str, int]:
|
||||
for (finder, module_name, _) in pkgutil.walk_packages(Xlib.keysymdef.__path__):
|
||||
if not isinstance(finder, importlib.machinery.FileFinder):
|
||||
continue
|
||||
loader = finder.find_module(module_name)
|
||||
if loader is None:
|
||||
spec = finder.find_spec(module_name)
|
||||
if spec is None or spec.loader is None:
|
||||
continue
|
||||
module = loader.load_module(module_name)
|
||||
module = importlib.util.module_from_spec(spec)
|
||||
spec.loader.exec_module(module)
|
||||
for keysym_name in dir(module):
|
||||
if keysym_name.startswith("XK_"):
|
||||
short_name = keysym_name[3:]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user