MetaCoreEngineV2/rplibs/__init__.py
2026-01-13 17:06:06 +08:00

30 lines
878 B
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"""
rplibs 包内置了一个 vendored six.py但其内部不会自动在 sys.modules
中注册子模块名(如 rplibs.six.moves在 Python 3.12 下直接
`import rplibs.six.moves` 会失败。这里手动注入一个 module 别名,
让现有 RenderPipeline 的导入语句继续可用。
"""
import sys
import types
from . import six as _six
# 复制 six.moves 的属性到一个 ModuleType挂到 sys.modules。
# 为避免访问不存在的旧模块(如 _dummy_thread引发异常改为用 __getattr__ 延迟转发。
_moves_mod = types.ModuleType(__name__ + ".six.moves")
def __getattr__(name):
return getattr(_six.moves, name)
def __dir__():
return dir(_six.moves)
_moves_mod.__getattr__ = __getattr__
_moves_mod.__dir__ = __dir__
sys.modules[__name__ + ".six"] = _six
sys.modules[__name__ + ".six.moves"] = _moves_mod
__all__ = ["six"]