-
Notifications
You must be signed in to change notification settings - Fork 49
Description
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 bycls(**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 offield(repr=False, ...)may be necessary -
ForumTopic
-
ForumPost
-
Classroom
-
Session
-
PartialProject
-
Comment
-
ReceivedRequest
-
CloudActivity
-
User
-
BackpackAsset
-
Studio
-
Activity