diff --git a/pyencrypt/loader.py b/pyencrypt/loader.py index a4f6bc2..acf37c2 100644 --- a/pyencrypt/loader.py +++ b/pyencrypt/loader.py @@ -81,15 +81,11 @@ def find_spec( cls, fullname: str, path: Sequence[_Path], target: types.ModuleType = None ) -> ModuleSpec: if path: + filename = "{}{}".format(fullname.rsplit(".", 1)[-1], ENCRYPT_SUFFIX) if isinstance(path, _NamespacePath): - file_path = ( - Path(path._path[0]) - / f'{fullname.rsplit(".", 1)[-1]}{ENCRYPT_SUFFIX}' - ) + file_path = Path(path._path[0]) / filename else: - file_path = ( - Path(path[0]) / f'{fullname.rsplit(".", 1)[-1]}{ENCRYPT_SUFFIX}' - ) + file_path = Path(path[0]) / filename else: for p in sys.path: file_path = Path(p) / f"{fullname}{ENCRYPT_SUFFIX}"