Implement configurable API providers from configs.yaml #43
@@ -155,11 +155,11 @@ class WrapperHandler(Generic[WrapperType]):
|
|||||||
assert WrapperHandler.__check(constructors), f"All constructors must be classes. Received: {constructors}"
|
assert WrapperHandler.__check(constructors), f"All constructors must be classes. Received: {constructors}"
|
||||||
|
|
||||||
# Order of wrappers is now determined by the order in filters
|
# Order of wrappers is now determined by the order in filters
|
||||||
filters = filters or [c.__name__ for c in constructors]
|
if filters:
|
||||||
wrappers = [c for name in filters for c in constructors if c.__name__ == name]
|
constructors = [c for name in filters for c in constructors if c.__name__ == name]
|
||||||
|
|
||||||
result: list[WrapperClassType] = []
|
result: list[WrapperClassType] = []
|
||||||
for wrapper_class in wrappers:
|
for wrapper_class in constructors:
|
||||||
if filters and wrapper_class.__name__ not in filters:
|
if filters and wrapper_class.__name__ not in filters:
|
||||||
continue
|
continue
|
||||||
try:
|
try:
|
||||||
@@ -168,4 +168,4 @@ class WrapperHandler(Generic[WrapperType]):
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
logging.warning(f"'{wrapper_class.__name__}' cannot be initialized: {e}")
|
logging.warning(f"'{wrapper_class.__name__}' cannot be initialized: {e}")
|
||||||
|
|
||||||
return WrapperHandler(result, try_per_wrapper, retry_delay)
|
return WrapperHandler(result, try_per_wrapper, retry_delay)
|
||||||
|
|||||||
Reference in New Issue
Block a user