Skip to content

Conversation

@ShairYousuf
Copy link
Collaborator

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.

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.
@ShairYousuf
Copy link
Collaborator Author

image
This was the YAML file I used to test.

Copy link
Contributor

@Burke-Daniel Burke-Daniel left a 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

import yaml
import platform

print(platform.system())
Copy link
Contributor

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

Copy link
Collaborator Author

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.

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"])

Copy link
Contributor

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__':
...

Copy link
Collaborator Author

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.

print(platform.system())

class parser:
def __init__(self,filepath):
Copy link
Contributor

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):

Copy link
Collaborator Author

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants