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

add `alias` in `Field` #50

Closed ASEM000 closed 1 year ago

ASEM000 commented 1 year ago

Ref: [1] https://www.attrs.org/en/stable/init.html#private-attributes-and-aliases [2] https://discuss.python.org/t/add-alias-as-a-field-parameter-for-dataclasses/22988 [3] https://docs.python.org/3/library/typing.html?highlight=dataclass_transform#typing.dataclass_transform

alias defines the field name in the constructor but not the body

  ...
  def __init__(self, alias_name):
    self.name = alias_name
codecov[bot] commented 1 year ago

Codecov Report

Patch coverage: 100.00% and project coverage change: +0.03 :tada:

Comparison is base (ddf2851) 99.56% compared to head (f28bb10) 99.60%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #50 +/- ## ========================================== + Coverage 99.56% 99.60% +0.03% ========================================== Files 14 14 Lines 2767 2783 +16 ========================================== + Hits 2755 2772 +17 + Misses 12 11 -1 ``` | [Impacted Files](https://codecov.io/gh/ASEM000/PyTreeClass/pull/50?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Mahmoud+Asem) | Coverage Δ | | |---|---|---| | [pytreeclass/\_src/tree\_decorator.py](https://codecov.io/gh/ASEM000/PyTreeClass/pull/50?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Mahmoud+Asem#diff-cHl0cmVlY2xhc3MvX3NyYy90cmVlX2RlY29yYXRvci5weQ==) | `100.00% <100.00%> (+0.43%)` | :arrow_up: | | [tests/test\_treeclass.py](https://codecov.io/gh/ASEM000/PyTreeClass/pull/50?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Mahmoud+Asem#diff-dGVzdHMvdGVzdF90cmVlY2xhc3MucHk=) | `99.15% <100.00%> (+0.01%)` | :arrow_up: | Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Mahmoud+Asem). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Mahmoud+Asem)

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