ASEM000 / pytreeclass

Visualize, create, and operate on pytrees in the most intuitive way possible.
https://pytreeclass.rtfd.io/en/latest
Apache License 2.0
42 stars 2 forks source link

Field edits #64

Closed ASEM000 closed 1 year ago

ASEM000 commented 1 year ago

This PR changes the way to define keyword-only or positional only arguments and remove factory for mutable types.

>>> import pytreeclass as pytc
>>> class Tree(pytc.TreeClass):
...     x: int = pytc.field(default=0)
...     # positional only field for all fields before it
...     _: pytc.POS_ONLY
...     # keyword only field for all fields after it
...     __: pytc.KW_ONLY
...     y: int = pytc.field(default=0)
codecov[bot] commented 1 year ago

Codecov Report

Patch coverage: 100.00% and project coverage change: -0.01 :warning:

Comparison is base (2ddb9d9) 98.44% compared to head (df1fe66) 98.44%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #64 +/- ## ========================================== - Coverage 98.44% 98.44% -0.01% ========================================== Files 13 13 Lines 2378 2377 -1 ========================================== - Hits 2341 2340 -1 Misses 37 37 ``` | [Impacted Files](https://app.codecov.io/gh/ASEM000/PyTreeClass/pull/64?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Mahmoud+Asem) | Coverage Δ | | |---|---|---| | [pytreeclass/\_\_init\_\_.py](https://app.codecov.io/gh/ASEM000/PyTreeClass/pull/64?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Mahmoud+Asem#diff-cHl0cmVlY2xhc3MvX19pbml0X18ucHk=) | `100.00% <100.00%> (ø)` | | | [pytreeclass/\_src/code\_build.py](https://app.codecov.io/gh/ASEM000/PyTreeClass/pull/64?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Mahmoud+Asem#diff-cHl0cmVlY2xhc3MvX3NyYy9jb2RlX2J1aWxkLnB5) | `100.00% <100.00%> (ø)` | | | [pytreeclass/\_src/tree\_base.py](https://app.codecov.io/gh/ASEM000/PyTreeClass/pull/64?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Mahmoud+Asem#diff-cHl0cmVlY2xhc3MvX3NyYy90cmVlX2Jhc2UucHk=) | `100.00% <100.00%> (ø)` | | | [tests/test\_treeclass.py](https://app.codecov.io/gh/ASEM000/PyTreeClass/pull/64?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Mahmoud+Asem#diff-dGVzdHMvdGVzdF90cmVlY2xhc3MucHk=) | `99.10% <100.00%> (+0.01%)` | :arrow_up: |

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.