python_corona_simulation icon indicating copy to clipboard operation
python_corona_simulation copied to clipboard

implemented read_from_file(filename) in config.py

Open raymond-van opened this issue 4 years ago • 2 comments

I noticed read_from_file(path) was on your TODO list so I went ahead and implemented it. We can now easily create custom configurations for more unique simulations.

read_from_file reads through the plaintext file custom_config.txt and parses each line and sets the corresponding configuration variable.

Great work on this repo and sorry on behalf of my fellow students for bombarding your repo with endless PRs.

raymond-van avatar Jul 24 '21 19:07 raymond-van

Thanks Raymond, for adding functionality. I've been closing PRs left and right since not much actual functionality is added or they break things (although I've learned a thing or two glossing through them).

I like your implementation, but was thinking to implement the config through python's configparser from the stdlib.

If you like and have the time, could you consider adapting your PR to reflect this? Not much change should be needed and it will give some more functionality like sections which could be of use later. If you don't have the time, don't worry, in that case I'll update your PR later in the week.

Cheers

paulvangentcom avatar Jul 24 '21 19:07 paulvangentcom

Hey Paul,

Thanks for getting back!

I gave it a go at implementing read_from_file using configparser. I replaced the custom_config.txt file with an .ini file that contains sections. The code in read_from_file is essentially the same, just reworked so that it works with .ini files.

Let me know if this is what you were looking for. If not, I’ll try to fix it when I get the chance.

raymond-van avatar Jul 24 '21 21:07 raymond-van