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 charging function #702

Merged
merged 1 commit into from
May 25, 2024

Conversation

dementive
Copy link
Contributor

  • Removed the else from the top level of the charging() function, the logic is the same but slightly easier to read now.

  • Use if not x.exists() in the charging() function before opening the file instead of FileNotFoundError exceptions, makes the function a lot easier to read.

  • Close the power_supply_type_path after reading the supply_type as it is not used later.

  • Remove else: continue from the end of the charging() function for loop, this didn't actually do anything.

I tested the charging() function on my laptop plugged in and plugged out and it is still working as expected with these changes.

* Removed the `else` from the top level of the charging() function, the logic is the same but slightly easier to read now.

* Use os.path.exists() in the charging() function before opening the file instead of FileNotFoundError exceptions, makes the function a lot easier to read.

* Close the power_supply_type_path after reading the supply_type as it is not used later.

* Remove `else: continue` from the end of the charging() function for loop, this didn't actually do anything.

I tested the charging() function on my laptop plugged in and plugged out and it is still working as expected with these changes.
@AdnanHodzic AdnanHodzic merged commit 3f6d7a3 into AdnanHodzic:master May 25, 2024
2 checks passed
@AdnanHodzic
Copy link
Owner

LGTM! Thank you for your contribution, you will be credited for your work as part of future release.

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.

None yet

2 participants