You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, when working on scratchattach, code completion is a problem. Sometimes, misremembering the name of an attribute can cause issues - e.g. setting Session.session_id instead of Session.id. This could be partially solved/easily checked if there is good code completion available. This is the problem addressed in #381
As a solution to the code completion issue regarding many object attributes and to improved readability, using dataclasses could be a good idea. This is one of the alternatives listed in #381, and is probably the easiest and cleanest way of doing so.
Notes:
any processing upon initialisation is to move to the __post_init__ method
using self.__dict__.update(**entries) could be partially replaced by cls(**entries) - this will cause errors for unrecognised attribute names, which is a good thing
These would be quite large changes so testing might be necessary
dataclasses' built-in repr() functionality might be better for use compared to some existing __repr__ methods. However, if one is to use this, a lot of field(repr=False, ...) may be necessary
Activity
TheCommCraft commentedon Jun 3, 2025
I changed it for ForumTopic
TheCommCraft commentedon Jun 4, 2025
Now also for ForumPost
faretek1 commentedon Jun 7, 2025
Now also for Classroom
faretek1 commentedon Jun 7, 2025
Warning
Now also for Session
faretek1 commentedon Jun 7, 2025
dataclasses with inheritance would cause problems if some of the attributes are non-default
https://medium.com/@aniscampos/python-dataclass-inheritance-finally-686eaf60fbb5
Either we could use
kw_only, or we could just make everything have default values.This concerns
PartialProjectandProjectTheCommCraft commentedon Aug 4, 2025
Now for User
faretek1 commentedon Aug 5, 2025
🔥
faretek1 commentedon Sep 20, 2025
i will try to do comment now
done in 10ed59c
faretek1 commentedon Oct 11, 2025
doing studio
feat: studio dataclass
feat: studio dataclass
TheCommCraft commentedon Feb 6, 2026
Now, only BackpackAsset is left.
faretek1 commentedon May 3, 2026
i did backpackasset finally
refactor: backpackasset dataclass