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

Refactor/clean-up parts of the code #71

Merged
merged 1 commit into from
Oct 24, 2024

Conversation

kingsleyadam
Copy link
Owner

This runs a refactor/clean-up on a few parts of the code.

  • Update get_device_by_class to get_devices_by_class to be consistent with other functions.
  • Add new get_devices() public function to allow any external code to fetch the list of devices. Use this in tests.
  • Move _config, _devices to init of the FreeAtHome class.
  • Move the _function_to_device_mappingto a newconst.py` file to clean-up and reduce the size of the FreeAtHome class.
  • Use a dictionary to map Function to Base in the new const.py file instead of a list. This enforces a function can only be defined once, but a device class can be assigned to multiple functions.

@kingsleyadam
Copy link
Owner Author

kingsleyadam commented Oct 24, 2024

Fyi @derjoerg on the changes to Function to Class mapping for any future functions.

@derjoerg
Copy link
Contributor

@kingsleyadam
From a first look I really like the simple and clean approach.

@kingsleyadam kingsleyadam merged commit 9ee4c11 into main Oct 24, 2024
8 checks passed
@kingsleyadam kingsleyadam deleted the u/kingsleyadam/refactorCleanupCode branch October 24, 2024 09:09
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.

2 participants