diff --git a/README.md b/README.md index 98d0b14..39210dc 100644 --- a/README.md +++ b/README.md @@ -158,6 +158,7 @@ import potato_util.sanitizer as sanitizer_utils import potato_util.validator as validator_utils import potato_util.http as http_utils import potato_util.crypto.jwt as jwt_utils +import potato_util.io as io_utils logger = logging.getLogger(__name__) @@ -328,6 +329,14 @@ def main() -> None: except jwt.InvalidTokenError: logger.error("JWT token is invalid!") + logger.info("-" * 80) + + # IO utils: + logger.info("[IO UTILITIES]") + io_utils.create_dir("test_dir", warn_mode="ALWAYS") + io_utils.remove_dir("test_dir", warn_mode="ALWAYS") + logger.info("-" * 80) + return diff --git a/examples/simple/main.py b/examples/simple/main.py index a30c01e..1ca96b0 100755 --- a/examples/simple/main.py +++ b/examples/simple/main.py @@ -18,6 +18,7 @@ import potato_util.validator as validator_utils import potato_util.http as http_utils import potato_util.crypto.jwt as jwt_utils +import potato_util.io as io_utils logger = logging.getLogger(__name__) @@ -188,6 +189,14 @@ def main() -> None: except jwt.InvalidTokenError: logger.error("JWT token is invalid!") + logger.info("-" * 80) + + # IO utils: + logger.info("[IO UTILITIES]") + io_utils.create_dir("test_dir", warn_mode="ALWAYS") + io_utils.remove_dir("test_dir", warn_mode="ALWAYS") + logger.info("-" * 80) + return diff --git a/src/potato_util/io/__init__.py b/src/potato_util/io/__init__.py index e843e61..1ede3e4 100644 --- a/src/potato_util/io/__init__.py +++ b/src/potato_util/io/__init__.py @@ -4,8 +4,7 @@ from ._sync import * -_async_package_name = "aiofiles" -_async_spec = importlib.util.find_spec(_async_package_name) - -if _async_spec is not None: +if (importlib.util.find_spec("aiofiles") is not None) and ( + importlib.util.find_spec("aioshutil") is not None +): from ._async import *