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.
Collaborator
Author
Burke-Daniel
requested changes
Jul 29, 2021
Contributor
Burke-Daniel
left a comment
There was a problem hiding this comment.
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()) |
Contributor
There was a problem hiding this comment.
Probably won't want this in here, as I believe this will get called whenever this module gets imported
Collaborator
Author
There was a problem hiding this comment.
Hey man I changed it.
examples/config/config_parser.py
Outdated
Comment on lines
19
to
29
| 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"]) | ||
|
|
Contributor
There was a problem hiding this comment.
This is a nice little test, but so this only runs with this module is ran explicity, should put this above:
if __name__ == '__main__':
...
Collaborator
Author
There was a problem hiding this comment.
Thanks for pointing that out.
examples/config/config_parser.py
Outdated
| print(platform.system()) | ||
|
|
||
| class parser: | ||
| def __init__(self,filepath): |
Contributor
There was a problem hiding this comment.
Good practice to put spaces between comma and next parameter:
def __init__(self, filepath):
This is a small update to the config parser, after Daniel's feedback on the initial one
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

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.