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
Improve config file usage #128
Comments
I asked ChatGPT to do the same but like how matplotlib rc_params are set To allow a user to temporarily update config attributes in a way similar to how matplotlib's rcParams are set, you can modify the Config class to use a context manager. Here's an example of how you can do this:
With this modified Config class, you can use the update method as a context manager to temporarily update multiple config values at once. The original values will be restored when the context manager is exited. Here's an example of how you might use the update method:
Well that's cool, I didn't know about context manager. Maybe I'll try it. |
I would like to make changes to the way the config file is used, like as the ability to change the config values temporarily (adjust the defaults inside a single script)
Here is what ChatGPT says I could do:
To allow a user to temporarily update config attributes without modifying the config file, you can modify the Config class to store the temporary updates in a separate dictionary. Here's an example of how you can do this:
With this modified Config class, you can use the set method to temporarily update a config value by setting the temporary argument to True. The temporary update will be stored in the temp_updates dictionary, and the get method will return the temporary value if it exists.
To reset all temporary updates and restore the original config values, you can use the reset method. This will clear the temp_updates dictionary.
Here's an example of how you might use these new methods:
There, that might give you a starting place.
The text was updated successfully, but these errors were encountered: