You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@burr.apache.org by "agam1092005 (via GitHub)" <gi...@apache.org> on 2025/10/03 06:21:46 UTC

[PR] fix: State.keys() now displays only keys without values (#409) [burr]

agam1092005 opened a new pull request, #585:
URL: https://github.com/apache/burr/pull/585

   ## Fix State.keys() displaying values (#409)
   
   **Problem:** `State.keys()` was showing both keys and values when printed, making it unusable with large objects (JSON responses, dataframes, embeddings).
   
   **Solution:** Added custom `StateKeys` wrapper class that provides clean `__repr__` showing only keys, while maintaining full `KeysView` compatibility (iteration, membership, length).
   
   **Changes:**
   - Added `StateKeys` class with clean string representation
   - Override `State.keys()` to return `StateKeys` wrapper
   - Maintains backward compatibility for all KeysView operations
   
   **Testing:**
   - All existing tests pass
   - Added comprehensive test coverage for new functionality
   - Verified fix resolves the reported issue
   
   Fixes #409


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@burr.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix: State.keys() now displays only keys without values (#409) [burr]

Posted by "agam1092005 (via GitHub)" <gi...@apache.org>.
agam1092005 commented on code in PR #585:
URL: https://github.com/apache/burr/pull/585#discussion_r2404016856


##########
burr/core/state.py:
##########
@@ -460,6 +498,18 @@ def __len__(self) -> int:
     def __iter__(self) -> Iterator[Any]:
         return iter(self._state)
 
+    def keys(self) -> StateKeysView:
+        """Returns a view of the state keys only (without values for cleaner display).
+        
+        This method addresses issue #409 by returning a custom view that displays
+        only the keys when printed, making it usable even when state contains
+        large objects like embeddings or dataframes.
+        
+        Returns:
+            StateKeysView: A view object that shows only keys in its string representation
+        """
+        return StateKeysView(self._state.keys())

Review Comment:
   Thanks for the feedback! The simpler approach is much better. Kindly check latest commit...



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@burr.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix: State.keys() now displays only keys without values (#409) [burr]

Posted by "skrawcz (via GitHub)" <gi...@apache.org>.
skrawcz merged PR #585:
URL: https://github.com/apache/burr/pull/585


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@burr.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix: State.keys() now displays only keys without values (#409) [burr]

Posted by "skrawcz (via GitHub)" <gi...@apache.org>.
skrawcz commented on code in PR #585:
URL: https://github.com/apache/burr/pull/585#discussion_r2403729099


##########
burr/core/state.py:
##########
@@ -460,6 +498,18 @@ def __len__(self) -> int:
     def __iter__(self) -> Iterator[Any]:
         return iter(self._state)
 
+    def keys(self) -> StateKeysView:
+        """Returns a view of the state keys only (without values for cleaner display).
+        
+        This method addresses issue #409 by returning a custom view that displays
+        only the keys when printed, making it usable even when state contains
+        large objects like embeddings or dataframes.
+        
+        Returns:
+            StateKeysView: A view object that shows only keys in its string representation
+        """
+        return StateKeysView(self._state.keys())

Review Comment:
   yeah I'd vote for this simpler option if it works.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@burr.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix: State.keys() now displays only keys without values (#409) [burr]

Posted by "zilto (via GitHub)" <gi...@apache.org>.
zilto commented on code in PR #585:
URL: https://github.com/apache/burr/pull/585#discussion_r2402932780


##########
burr/core/state.py:
##########
@@ -460,6 +498,18 @@ def __len__(self) -> int:
     def __iter__(self) -> Iterator[Any]:
         return iter(self._state)
 
+    def keys(self) -> StateKeysView:
+        """Returns a view of the state keys only (without values for cleaner display).
+        
+        This method addresses issue #409 by returning a custom view that displays
+        only the keys when printed, making it usable even when state contains
+        large objects like embeddings or dataframes.
+        
+        Returns:
+            StateKeysView: A view object that shows only keys in its string representation
+        """
+        return StateKeysView(self._state.keys())

Review Comment:
   I believe returning `list(self._state)` (implicitly `self._state.keys()`) would be sufficient. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@burr.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix: State.keys() now displays only keys without values (#409) [burr]

Posted by "skrawcz (via GitHub)" <gi...@apache.org>.
skrawcz commented on PR #585:
URL: https://github.com/apache/burr/pull/585#issuecomment-3368371057

   @elijahbenizzy any concerns on exposing `.keys()` on state?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@burr.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix: State.keys() now displays only keys without values (#409) [burr]

Posted by "agam1092005 (via GitHub)" <gi...@apache.org>.
agam1092005 commented on PR #585:
URL: https://github.com/apache/burr/pull/585#issuecomment-3370837483

   Kindly check the latest commit and let me know any changes if required


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@burr.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org