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 support for type checkers using @dataclass_transform from PEP 681… #26

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

Conversation

NiklasKappel
Copy link

@NiklasKappel NiklasKappel commented Feb 1, 2024

… and a typed factory function for descriptors

Works on my machine (TM), stolen from attrs and decently elegant IMO.

Example usage:

from zninit import ZnInit, desc

class Human(ZnInit):
    name: str = desc()
    age: int = desc(23)


fabian = Human(name="Fabian", age=25)

reveal_type(fabian.name)  # Revealed type is 'str'
reveal_type(fabian.age)  # Revealed type is 'int'

@coveralls
Copy link

coveralls commented Feb 1, 2024

Pull Request Test Coverage Report for Build 8347650118

Details

  • 18 of 19 (94.74%) changed or added relevant lines in 4 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.1%) to 99.728%

Changes Missing Coverage Covered Lines Changed/Added Lines %
zninit/descriptor/desc.py 4 5 80.0%
Totals Coverage Status
Change from base Build 6968333371: -0.1%
Covered Lines: 733
Relevant Lines: 735

💛 - Coveralls

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.

None yet

2 participants