potassco / clorm

🗃️ A Python ORM-like interface for the Clingo Answer Set Programming (ASP) reasoner
https://clorm.readthedocs.io
MIT License
52 stars 5 forks source link

Autocomplete for Predicate.__init__ via `dataclass_transform` #91

Closed florianfischer91 closed 2 years ago

florianfischer91 commented 2 years ago

This adds autocomplete for fields when creating a new instance of a predicate.

grafik grafik

closes #80

daveraja commented 2 years ago

I was initially confused how the __dataclass_transform__ decorator could perform such transform magic since it just returns itself! But then I started looking at the PEP 681 reference that you added and realised that the magic is actually in the static type checkers that know what to do when they see a decorator function with that name. Very clever.