🎉 feat(lazy_load.py): add LazyLoadDictBase class to provide lazy loading of a dictionary of all types
🐛 fix(lazy_load.py): implement _build_dict() and get_type_dict() methods to avoid NotImplementedError
This commit is contained in:
parent
7b2827f198
commit
3442521f64
1 changed files with 15 additions and 0 deletions
15
src/backend/langflow/utils/lazy_load.py
Normal file
15
src/backend/langflow/utils/lazy_load.py
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
class LazyLoadDictBase:
|
||||||
|
def __init__(self):
|
||||||
|
self._all_types_dict = None
|
||||||
|
|
||||||
|
@property
|
||||||
|
def all_types_dict(self):
|
||||||
|
if self._all_types_dict is None:
|
||||||
|
self._all_types_dict = self._build_dict()
|
||||||
|
return self._all_types_dict
|
||||||
|
|
||||||
|
def _build_dict(self):
|
||||||
|
raise NotImplementedError
|
||||||
|
|
||||||
|
def get_type_dict(self):
|
||||||
|
raise NotImplementedError
|
||||||
Loading…
Add table
Add a link
Reference in a new issue