Open
Conversation
Implements #474 by replacing the `return_protocoldagresults` boolean parameter with a new `return_as` parameter that accepts three string options: - 'ProtocolResult' (default): Returns aggregated ProtocolResult combining all successful ProtocolDAGResults via Transformation.gather() - 'ProtocolResults': Returns a list of individual ProtocolResults, one for each successful ProtocolDAGResult by calling gather([pdr]) on each - 'ProtocolDAGResults': Returns the raw list of ProtocolDAGResults Changes: - Updated get_transformation_results() with new return_as parameter - Updated get_network_results() with new return_as parameter - Updated _get_network_results() helper to pass return_as - Added deprecation warning for return_protocoldagresults parameter - Added comprehensive tests for new functionality and backward compatibility - Updated type hints to reflect new return types The old return_protocoldagresults parameter is maintained for backward compatibility but deprecated with a warning.
Improves the API design by using a StrEnum instead of magic strings for the return_as parameter, providing better IDE support, type safety, and discoverability. Changes: - Added ResultFormat StrEnum with three values: - PROTOCOL_RESULT: Aggregated result (default) - PROTOCOL_RESULTS: Individual results per ProtocolDAGResult - PROTOCOL_DAG_RESULTS: Raw ProtocolDAGResults - Updated method signatures to accept ResultFormat | Literal[str] - Updated internal logic to handle both enum and string values - Exported ResultFormat from both interface and top-level modules - Updated docstrings to document enum usage - Added comprehensive tests using enum values - Maintained backward compatibility with string values Users can now use: - client.get_transformation_results(tf, return_as=ResultFormat.PROTOCOL_RESULTS) - client.get_transformation_results(tf, return_as='ProtocolResults') Both work identically, but the enum provides better developer experience with autocomplete and type checking.
- Applied black formatting to client.py and test_client.py - Added `from __future__ import annotations` to fix Sphinx autodoc issues with complex type hints (Literal and union types) This ensures the docs build correctly and code follows project style.
Added blank lines before bullet lists in docstrings to fix reStructuredText parsing errors in Sphinx documentation build. This resolves the 'Unexpected indentation' and 'Block quote ends without a blank line' errors from the docs build.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements #474 by replacing the
return_protocoldagresultsboolean parameter with a newreturn_asparameter that accepts three string options:Changes:
The old return_protocoldagresults parameter is maintained for backward compatibility but deprecated with a warning.