Amulet-Core
Amulet-Core copied to clipboard
Level wrapper load_root method
The Problem
I don't particularly like the way data is loaded by the level wrapper classes.
Currently in the __init__
function they load the root data so that it can be queried.
This means that if the level does not exist it tries and fails to load that data.
Feature Description
It would make more sense if the __init__
function simply initialised variables to their default state and did not actually load any data.
There would be a public method (perhaps load_root
) that would load this data.
This would mean that the full subclass chain of __init__
can run without worrying if the subclass default attribute has been set.
It also does not having to try and except loading the data.
Once the class has been initialised the calling code can call load_root
to make the root data available for inspection or just open
which would load the root data and open the database for editing. Alternatively create_and_open
could be called to initialise the data and open it.
Edit: load_metadata
might be a better name