-
Notifications
You must be signed in to change notification settings - Fork 9
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
Add export functionality to TOML in addition to JSON #327
Conversation
@vankesteren I haven't completely finished yet, but it would be nice to get your input on the import/export functionality of |
Agreed! |
maybe load and save instead of load and store, those names are a bit more common |
Okay, I'll change it into load and save then, that sounds good to me as well. |
@vankesteren I have finished this PR. I have edited the images, but I didn't find them all, so I have removed the few that I can't find. I have changed all Exported MetaFrame -> GMF file for consistency, the documentation itself also needs to change some at some point, but for now this is okay as far as I am concerned. |
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.
fix the suggestions and then merge
defaults = config_dict.pop("defaults", None) | ||
privacy = config_dict.pop("privacy", None) | ||
config_version = config_dict.pop("config_version", "1.0") | ||
if config_version not in ["1.0", "1.1"]: | ||
warnings.warn(f"Trying to read configuration file with version {config_version}, " | ||
"this version of metasyn only supports 1.0 and 1.1.") | ||
if privacy is not None: | ||
if defaults is not None: | ||
raise ValueError("Error parsing configuration file: cannot have both [privacy]" | ||
" and [defaults] tables.") | ||
defaults = {"privacy": privacy} |
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.
At some point, we might want to change this to separate reader function for separate config versions.
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.
classes
self.save_json(fp, validate) | ||
return | ||
fp_path = Path(fp) | ||
if fp_path.suffix == ".toml": |
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.
noice
Co-authored-by: Erik-Jan van Kesteren <e.vankesteren1@uu.nl>
Co-authored-by: Erik-Jan van Kesteren <e.vankesteren1@uu.nl>
This also adds a new configuration TOML version: 1.1
Changes include that now defaults can be set for the data_free variables. For example, you don't need to type in the prop_missing for each variable anymore, you can set the default in the [defaults] section. You can also have default distributions now per variable type -> e.g. all continuous variables could by default be assigned the normal distributions.
TODO:
Fixes #323 Fixes #322