Skip to content
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

Define a class to hold all the contents of the config.yaml file #134

Open
Kiel-SFU opened this issue Feb 15, 2022 · 0 comments
Open

Define a class to hold all the contents of the config.yaml file #134

Kiel-SFU opened this issue Feb 15, 2022 · 0 comments
Labels
enhancement New feature or request

Comments

@Kiel-SFU
Copy link
Collaborator

Kiel-SFU commented Feb 15, 2022

Currently, the /config/config.yaml file is called upon using many "functions.get_from_yaml()" calls throughout the codebase. For example:
regions = functions.get_from_yaml('regions_dict')

continent = functions.get_from_yaml('continent')

do_something_with_regions(regions)

do_something_with_continent(continent)

It seems like a good idea to instead add all of the /config/config.yaml values to a class in the functions.py file. This class can then be instantiated as an object in every script file that requires information from the .yaml file. Then, instead of calling the example, we could do something like:
settings = functions.YamlValues()

do_something_with_regions(settings.regions)

do_something_with_continent(settings.continent)

Where settings is the object that has member variables including "regions" and "continent". "settings" is instantiated from the class YamlValues(), which initializes itself in functions with the appropriate member variables.

The end result of this change would be cutting down on a lot of calls of functions.get_from_yaml() at the beginning of almost every function. It would also resolve this comment: #133 (review)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant