pyimporter.py
# Source Generated with Decompyle++
# File: pyimporter.pyc (Python 3.13)
import C_file
class PyImporter(object):
ext = '.py'
def __init__(self, path):
import redirect
self._path = path
self._npkimporter = redirect.NpkImporter(path)
def find_module(self, fullname, path = (None,)):
oldfullname = fullname
if path is not None:
path = self._path
fullname = fullname.replace('.', '/')
pkg_name = fullname + '/__init__' + PyImporter.ext
if C_file.find_file(pkg_name, path):
return self
None += PyImporter.ext
if C_file.find_file(fullname, path):
return self
return None._npkimporter.find_module(oldfullname, path)
def load_module(self, fullname):
is_pkg = True
mod_path = fullname.replace('.', '/') + '/__init__'
mod_name = fullname
if not C_file.find_file(mod_path + PyImporter.ext, self._path):
is_pkg = False
mod_path = fullname.replace('.', '/')
mod_name = fullname
data = C_file.get_file(mod_path + PyImporter.ext, self._path)
data = data.replace('\r\n', '\n')
data = compile(data, fullname, 'exec')
path = None
if is_pkg:
path = [
self._path]
m = C_file.new_module(mod_name, data, path)
return m
import sys
sys.path_hooks[len(sys.path_hooks) - 1] = PyImporter
sys.path_importer_cache.clear()
return None