-
Notifications
You must be signed in to change notification settings - Fork 1
The config parser #7
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
base: master
Are you sure you want to change the base?
Conversation
The parser should be able to read a yaml config file, currently no feature has been made on what it will do after that. Currently it just prints the settings.
Burke-Daniel
left a comment
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.
Couple small things, and I'll get you to look at my Device class MR, and then probably make some changes to this based off of how the configuration looks over there
examples/config/config_parser.py
Outdated
| import yaml | ||
| import platform | ||
|
|
||
| print(platform.system()) |
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.
Probably won't want this in here, as I believe this will get called whenever this module gets imported
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.
Hey man I changed it.
examples/config/config_parser.py
Outdated
| config = parser("device_config_test.yaml") | ||
| data=config.file_reader() | ||
| devices=data["devices"] | ||
| found=False | ||
| for device in devices: | ||
| if device==platform.system(): | ||
| config.settings_return(devices[device]) | ||
| found=True | ||
| if found==False: | ||
| config.settings_return(data["devices"]["default"]) | ||
|
|
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.
This is a nice little test, but so this only runs with this module is ran explicity, should put this above:
if __name__ == '__main__':
...
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.
Thanks for pointing that out.
examples/config/config_parser.py
Outdated
| print(platform.system()) | ||
|
|
||
| class parser: | ||
| def __init__(self,filepath): |
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.
Good practice to put spaces between comma and next parameter:
def __init__(self, filepath):
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.
Thanks!!
This is a small update to the config parser, after Daniel's feedback on the initial one

The parser should be able to read a YAML config file, currently, no feature has been made on what it will do after that. Currently, it just prints the settings.
Looking for feedback and what to do next.