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

Improve Python Function signature annotation #5149

Merged
merged 2 commits into from
Nov 8, 2023

Conversation

klecki
Copy link
Contributor

@klecki klecki commented Nov 7, 2023

Category: Bug fix, New feature

Description:

The return type of the function parameter passed to Python Function
operators requires to be a Tuple (instead of generic Sequence) in case
of multiple outputs (matching typical Python semantics).
List return values are not considered as multiple outputs from the function
(as opposed to External Souce).
A None annotation has to be added explicitly for no output variants.

Default num_outputs (equal to 1) overload is added so we can have a DataNode
return type directly.

Tests are reworked and extended.

Additional information:

Affected modules and functionalities:

Python Function annotations.

Key points relevant for the review:

Tests:

  • Existing tests apply
  • New tests added
    • Python tests
    • GTests
    • Benchmark
    • Other
  • N/A

Checklist

Documentation

  • Existing documentation applies
  • Documentation updated
    • Signatures
    • Docstring
    • Doxygen
    • RST
    • Jupyter
    • Other
  • N/A

DALI team only

Requirements

  • Implements new requirements
  • Affects existing requirements
  • N/A

REQ IDs: N/A

JIRA TASK: N/A

The return type requires a Tuple (instead of generic Sequence),
a None has to be added explicitly for no output variants.

Default num_outputs (equal to 1) overload is added so we can have a
DataNode return type directly.

Tests are reworked and extended.

Signed-off-by: Krzysztof Lecki <klecki@nvidia.com>
Signed-off-by: Krzysztof Lecki <klecki@nvidia.com>
@stiepan stiepan self-assigned this Nov 7, 2023
@klecki
Copy link
Contributor Author

klecki commented Nov 7, 2023

!build

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [10633687]: BUILD STARTED

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [10633687]: BUILD PASSED

@klecki klecki merged commit 2aff84c into NVIDIA:main Nov 8, 2023
5 checks passed
@klecki klecki deleted the adjust-python-function-again branch November 8, 2023 12:01
@klecki klecki added the signatures Python API signatures and type hints label Nov 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
signatures Python API signatures and type hints
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants