Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Enh] Selecting ranges for levels in nested container outputs #25

Merged
merged 4 commits into from
Nov 17, 2023

Conversation

kohlerca
Copy link
Collaborator

Currently, the container_output parameter in the Provenance decorator allows the identification of elements inside nested containers up to a depth level (determined by passing an integer as the argument value).

In some cases, like functions returning a list of lists where the inner lists are the relevant outputs of the function, this would result in a single output node for the function. To provide similar functionality to using container_output=True (where all the elements of a container returned by the function are identified as outputs of the function), this PR adds the feature of specifying ranges in the levels of nested containers by passing a tuple (start_level, end_level).

Therefore, the function outputs are defined as the elements at start_level, and the nested structure is processed until end_level depth. In the case of a list of lists, a tuple (1, 1) will identify each inner list as outputs of the function, and the elements in each inner list will be identified and linked to the parent list, with their indexes.

@kohlerca kohlerca merged commit 785fa8f into main Nov 17, 2023
6 checks passed
@kohlerca kohlerca deleted the enh/container_output_level_range branch November 17, 2023 22:39
@kohlerca kohlerca added the enhancement New feature or request label Nov 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant