-
Notifications
You must be signed in to change notification settings - Fork 5
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
Allow PROPERTIES
to set a default value, and Modules to auto-initialise their DF columns to these values
#1436
Allow PROPERTIES
to set a default value, and Modules to auto-initialise their DF columns to these values
#1436
Conversation
…set of Categories, and add class typehints to Property and Module
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @willGraham01. Looks all sensible to me - have made a few minor suggestions regarding some of the type hints added, and one suggestion of adding a comment to clarify something that I initially misunderstood.
Checks are failing due to some syntax in files that are not affected by this PR. Review comments are addressed so happy to either wait for this to be fixed, or merge in now. |
Yeah this should be fixed by #1459
Shouldn't matter either way as we're already failing on |
Concerns #1428 | Cherry-pick of the global functionality that was proposed in #1429
Introduces the functionality needed for us to remove a lot of repeated code in the
initialise_population
method forModule
s.Property
s can now have a default value set when they are created (falling back on the currently-provided defaults inPANDAS_TYPE_DEFAULT_TYPE_MAP
if not provided) which will be used to fill the corresponding column in the population dataframe duringinitialise_population
.Module
s that just want to set their own property columns ininitialise_population
can then directly inherit this implementation without needing to explicitly implement it themselves. IfModule
s want to run additional steps in this method, they can callsuper().initialise_population
first, and then provide their specific instructions afterwards. And finally, if aModule
wants to do something completely different at this stage, they can just overwrite the method as normal and avoid callingsuper()
.As @tamuri suggested, we'll introduce the changes proposed in #1429 incrementally. This does mean we'll be supporting both methods of setting the property columns in the dataframe for a while, but gives us some granularity for bug-fixing/tracing.