Skip to content

Commit

Permalink
fix(proxy-list): Initialize empty proxy lists
Browse files Browse the repository at this point in the history
  • Loading branch information
Jo-Byr committed Jan 9, 2025
1 parent 897fb6a commit d78de7b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions trame_simput/core/proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,17 @@ def __init__(
if _prop_name.startswith("_"):
continue

_size = _prop_def.get("size", None)
_init_def = _prop_def.get("initial", None)
_is_proxy = _prop_def.get("type", None) == "proxy"
_proxy_type = _prop_def.get("proxyType", None)
if _prop_name in kwargs:
self.set_property(_prop_name, kwargs[_prop_name])
elif isinstance(_init_def, dict):
logger.error("Don't know how to deal with domain yet: %s", _init_def)
elif _size is not None and isinstance(_size, int) and _size > 0 and _is_proxy and _proxy_type is not None:
_init_def = [self._proxy_manager.create(_proxy_type).id for _ in range(_size)]
self.set_property(_prop_name, _init_def)
else:
self.set_property(_prop_name, _init_def)

Expand Down

0 comments on commit d78de7b

Please sign in to comment.