diff --git a/pyencrypt/encrypt.py b/pyencrypt/encrypt.py index 2d58a70..1ee4534 100644 --- a/pyencrypt/encrypt.py +++ b/pyencrypt/encrypt.py @@ -33,8 +33,6 @@ def _encrypt_file( def can_encrypt(path: Path) -> bool: if path.name in NOT_ALLOWED_ENCRYPT_FILES: return False - if "management/commands/" in path.as_posix(): - return False if path.suffix != ".py": return False return True diff --git a/pyencrypt/loader.py b/pyencrypt/loader.py index 069010e..597078b 100644 --- a/pyencrypt/loader.py +++ b/pyencrypt/loader.py @@ -73,8 +73,9 @@ def get_data(self, path: _Path) -> bytes: class EncryptFileFinder(abc.MetaPathFinder, Base): + @classmethod def find_spec( - self, fullname: str, path: Sequence[_Path], target: types.ModuleType = None + cls, fullname: str, path: Sequence[_Path], target: types.ModuleType = None ) -> ModuleSpec: if path: if isinstance(path, _NamespacePath): @@ -94,4 +95,4 @@ def find_spec( # TODO: generate randomly AES Class -sys.meta_path.insert(0, EncryptFileFinder()) +sys.meta_path.insert(0, EncryptFileFinder)