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

Fixes dataloader to use the correct type hinting #1261

Merged
merged 3 commits into from
Dec 17, 2024

Conversation

elijahbenizzy
Copy link
Collaborator

This makes it work with future.annotations. See #1259.

This makes it work with __future__.annotations. See #1259.
@elijahbenizzy elijahbenizzy force-pushed the future-annotations branch 2 times, most recently from 8691e43 to 20bcab8 Compare December 17, 2024 20:42
…s the output type

Note we only allow dict[str, ...], nothing else. Also updates tests to
work with 3.8 -- we actually remove a few as 3.8 is past EOL now.
@elijahbenizzy elijahbenizzy marked this pull request as ready for review December 17, 2024 21:32
@elijahbenizzy elijahbenizzy merged commit 6444b21 into main Dec 17, 2024
2 of 24 checks passed
Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❌ Changes requested. Reviewed everything up to b5be596 in 35 seconds

More details
  • Looked at 196 lines of code in 4 files
  • Skipped 0 files when reviewing.
  • Skipped posting 2 drafted comments based on config settings.
1. hamilton/function_modifiers/adapters.py:738
  • Draft comment:
    When using typing.get_type_hints, the absence of a return annotation should be checked with if return_annotation is None: instead of inspect.Signature.empty.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable:
    The comment is relevant to the change made in the diff. The change involves using typing.get_type_hints(fn).get("return") instead of inspect.signature(fn).return_annotation. The comment suggests a different way to check for the absence of a return annotation, which is relevant to the change. However, the comment does not provide strong evidence that the suggested method is necessary or better than the current implementation.
    I might be missing the context of why inspect.Signature.empty was used initially and whether None is a better check in this specific context. The comment does not provide evidence or reasoning for why the change is necessary.
    The comment could be suggesting a more idiomatic or correct way to handle the absence of a return annotation when using typing.get_type_hints. However, without evidence or reasoning, it's hard to determine if this is a necessary change.
    The comment is about the change made in the diff, but it lacks strong evidence or reasoning for why the suggested change is necessary. Therefore, the comment should be deleted.
2. tests/function_modifiers/test_adapters.py:699
  • Draft comment:
    The logic for determining tuple_ and dict_ based on the Python version is repeated in multiple files. Consider extracting this logic into a utility function or module to adhere to the DRY principle.
  • Reason this comment was not posted:
    Marked as duplicate.

Workflow ID: wflow_dQokVE7PlJrhO2nk


Want Ellipsis to fix these issues? Tag @ellipsis-dev in a comment. You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

@elijahbenizzy elijahbenizzy deleted the future-annotations branch December 17, 2024 21:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants