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

add typing support for fields #767

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

NiklasKappel
Copy link

Node constructors already work with the addition of 'dataclass_transform' in ZnInit.

For the field specifier functions we could lie about the return type. If they don't take arguments (e.g. outs) that's easy, because we just annotate a return type of Any. Otherwise, they seem to forward all arguments to the __init__ of ZnInit's Descriptor, so we could use the exact same type hints as for the desc factory function.

This way we would need boilerplate type stubs for all functions in fields.py. I don't know if it is possible to add type hints for the constructor (__init__ or __new__??) of Descriptor directly and propagate that through the inheritance chain.

Copy link

codecov bot commented Feb 12, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 86.82%. Comparing base (6698c4a) to head (637ae0d).
Report is 4 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #767      +/-   ##
==========================================
- Coverage   91.01%   86.82%   -4.19%     
==========================================
  Files          25       25              
  Lines        2047     2057      +10     
  Branches      974      979       +5     
==========================================
- Hits         1863     1786      -77     
- Misses        184      271      +87     
Flag Coverage Δ
fulltest 86.82% <ø> (+0.06%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@NiklasKappel NiklasKappel changed the title DRAFT: add typing support for outs and params add typing support for outs and params Feb 13, 2024
@NiklasKappel NiklasKappel changed the title add typing support for outs and params add typing support for fields Feb 13, 2024
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