Added Context Manager ObservableResultCollector

This commit is contained in:
2025-12-09 22:50:13 +01:00
parent d8b1ef2e2c
commit dbb2ecec33
5 changed files with 358 additions and 6 deletions

View File

@@ -14,6 +14,9 @@ class ProxyObject:
def __hasattr__(self, item):
return item in self._props
def as_dict(self):
return self._props.copy()
def __repr__(self):
if "key" in self._props:
return f"ProxyObject(key={self._props["key"]})"
@@ -37,10 +40,10 @@ class ProxyObject:
for prop_name, path in self._mappings.items():
attrs = path.split(".")
current = self._obj
# Check if path ends with wildcard
has_wildcard_in_path = attrs[-1] == "*"
# Navigate to the target object
for attr in attrs:
if attr == "*":
@@ -49,7 +52,7 @@ class ProxyObject:
current = getattr(current, attr)
else:
break
# Handle wildcard cases
if prop_name == "*" or has_wildcard_in_path:
# Copy all properties from current object