From 8908b7695bd690b365933ce7f99fcbcd2c51ae2d Mon Sep 17 00:00:00 2001 From: Vu Anh Date: Sat, 22 Jun 2024 17:01:11 +0700 Subject: [PATCH] update --- underthesea/__init__.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/underthesea/__init__.py b/underthesea/__init__.py index fd9f1379..2a9be1a8 100644 --- a/underthesea/__init__.py +++ b/underthesea/__init__.py @@ -49,6 +49,7 @@ 'dependency_parse': 'underthesea.pipeline.dependency_parse' } + @lru_cache(maxsize=None) def get_optional_import(module_name, object_name): try: @@ -57,6 +58,7 @@ def get_optional_import(module_name, object_name): except ImportError: return None + for name, module in optional_imports.items(): globals()[name] = get_optional_import(module, name)