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

fix warnings in dataset transform + privateattr check #8570

Merged
merged 11 commits into from Mar 14, 2024

Conversation

eelcovdw
Copy link
Contributor

@eelcovdw eelcovdw commented Mar 12, 2024

Description

  • SyftObject.__annotations__ is now a dict[str, str], so check_type throws a warning. changed to use typing.get_type_hints to get annotations instead
  • Added new SyftObject property SyftObject.__validate_private_attrs__: ClassVar[bool] = True that can be disabled for user-defined classes (like policies). Because:
    • typing.get_type_hints only works if all annotations are defined in locals/globals.
    • User-defined classes do not have imported annotations (like typing.Any) saved
    • In this case UserOutputPolicy.__annotations__ will contain "Any", which throws an error in get_type_hints
    • Solution: we do not check type hints for user-defined code
  • Asset transform printing unneccessary a warning when shape in CreateAsset

Affected Dependencies

How has this been tested?

  • Describe the tests that you ran to verify your changes.
  • Provide instructions so we can reproduce.
  • List any relevant details for your test configuration.

Checklist

@teo-milea teo-milea self-requested a review March 12, 2024 10:35
Copy link
Member

@teo-milea teo-milea left a comment

Choose a reason for hiding this comment

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

LGTM!

@eelcovdw
Copy link
Contributor Author

merging this after #8553

@eelcovdw eelcovdw enabled auto-merge March 14, 2024 08:12
@eelcovdw eelcovdw merged commit 2b2d9c2 into dev Mar 14, 2024
35 checks passed
@eelcovdw eelcovdw deleted the eelco/pydantic-warnings branch March 14, 2024 08:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants