Added Context Manager ObservableResultCollector
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user