Skip to content
This repository has been archived by the owner on Nov 15, 2024. It is now read-only.

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 subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants