Skip to content

Fix path migration - #5

Merged
FutureTense merged 7 commits into
FutureTense:mainfrom
raman325:fix_path_migration
Dec 9, 2020
Merged

Fix path migration#5
FutureTense merged 7 commits into
FutureTense:mainfrom
raman325:fix_path_migration

Conversation

@raman325

@raman325 raman325 commented Dec 9, 2020

Copy link
Copy Markdown
Collaborator

Proposed change

Path migration logic is broken for users with python < 3.9. This new logic supports all Python versions

EDIT: Also added pyproject.toml to configure isort, black, etc. properly because the new CI action is not sorting dependencies correctly

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New feature (which adds functionality)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

  • This PR fixes or closes issue: fixes #
  • This PR is related to issue:

* refactor, bug fixes, and improvements

New Features
- cleanup packages folder on entry removal

Changes
- switch to using relative path for CONF_PATH to reduce changes of error (existing config entries will be updated automatically)

Bug Fixes
- Switch _generate_package from async to sync because it does I/O on the filesystem
- fix output file not being opened with context manager (so never closed)
- fix sensor creation loop to only create necessary sensors instead of sensors for all code slots
- fix CodeSlotsData sensor (now a DataUpdateCoordinator) logic for OZW integrations

Code Cleanup/Improvements
- move CodeSlotsData logic into DataUpdateCoordinator since that's what it is being used for
- reduce polling frequency significantly by only polling any time a slot is set or cleared with a backup hourly polling in case updates are made outside of KeyMaster (this will significantly improve battery life over current implementation with the same level of accuracy)
- Update config entry using update method instead of directly manipulating attributes
- use slugify when fixing CONF_NAME
- use os.path.join to create paths for better OS compatibility
- switch to using f-strings
- only attempt cleanup of packages directory if it exists
- always rely on entry.data so that options is only used to capture options updates
- simplify code and reduced repeat logic by moving things into common functions
- raise Exceptions in services when there is a failure (this will be shown in UI)
- use more list comprehensions
- switch while loops to for loops
- added typing
- gitignore venv
- improve debug messaging

* fix typo

* refactor, bug fixes, and improvements

New Features
- cleanup packages folder on entry removal

Changes
- switch to using relative path for CONF_PATH to reduce changes of error (existing config entries will be updated automatically)

Bug Fixes
- Switch _generate_package from async to sync because it does I/O on the filesystem
- fix output file not being opened with context manager (so never closed)
- fix sensor creation loop to only create necessary sensors instead of sensors for all code slots
- fix CodeSlotsData sensor (now a DataUpdateCoordinator) logic for OZW integrations

Code Cleanup/Improvements
- move CodeSlotsData logic into DataUpdateCoordinator since that's what it is being used for
- reduce polling frequency significantly by only polling any time a slot is set or cleared with a backup hourly polling in case updates are made outside of KeyMaster (this will significantly improve battery life over current implementation with the same level of accuracy)
- Update config entry using update method instead of directly manipulating attributes
- use slugify when fixing CONF_NAME
- use os.path.join to create paths for better OS compatibility
- switch to using f-strings
- only attempt cleanup of packages directory if it exists
- always rely on entry.data so that options is only used to capture options updates
- simplify code and reduced repeat logic by moving things into common functions
- raise Exceptions in services when there is a failure (this will be shown in UI)
- use more list comprehensions
- switch while loops to for loops
- added typing
- gitignore venv
- improve debug messaging

* remove helper entities on entry unload or options update

* remove counter since it's not actually used, it was just there for futureproofing

* bugfix
@FutureTense
FutureTense merged commit c8d86e1 into FutureTense:main Dec 9, 2020
@raman325
raman325 deleted the fix_path_migration branch December 9, 2020 18:39
github-actions Bot pushed a commit that referenced this pull request Dec 9, 2020
* Remove helper entities on entry unload or options update (#2)

* refactor, bug fixes, and improvements

New Features
- cleanup packages folder on entry removal

Changes
- switch to using relative path for CONF_PATH to reduce changes of error (existing config entries will be updated automatically)

Bug Fixes
- Switch _generate_package from async to sync because it does I/O on the filesystem
- fix output file not being opened with context manager (so never closed)
- fix sensor creation loop to only create necessary sensors instead of sensors for all code slots
- fix CodeSlotsData sensor (now a DataUpdateCoordinator) logic for OZW integrations

Code Cleanup/Improvements
- move CodeSlotsData logic into DataUpdateCoordinator since that's what it is being used for
- reduce polling frequency significantly by only polling any time a slot is set or cleared with a backup hourly polling in case updates are made outside of KeyMaster (this will significantly improve battery life over current implementation with the same level of accuracy)
- Update config entry using update method instead of directly manipulating attributes
- use slugify when fixing CONF_NAME
- use os.path.join to create paths for better OS compatibility
- switch to using f-strings
- only attempt cleanup of packages directory if it exists
- always rely on entry.data so that options is only used to capture options updates
- simplify code and reduced repeat logic by moving things into common functions
- raise Exceptions in services when there is a failure (this will be shown in UI)
- use more list comprehensions
- switch while loops to for loops
- added typing
- gitignore venv
- improve debug messaging

* fix typo

* refactor, bug fixes, and improvements

New Features
- cleanup packages folder on entry removal

Changes
- switch to using relative path for CONF_PATH to reduce changes of error (existing config entries will be updated automatically)

Bug Fixes
- Switch _generate_package from async to sync because it does I/O on the filesystem
- fix output file not being opened with context manager (so never closed)
- fix sensor creation loop to only create necessary sensors instead of sensors for all code slots
- fix CodeSlotsData sensor (now a DataUpdateCoordinator) logic for OZW integrations

Code Cleanup/Improvements
- move CodeSlotsData logic into DataUpdateCoordinator since that's what it is being used for
- reduce polling frequency significantly by only polling any time a slot is set or cleared with a backup hourly polling in case updates are made outside of KeyMaster (this will significantly improve battery life over current implementation with the same level of accuracy)
- Update config entry using update method instead of directly manipulating attributes
- use slugify when fixing CONF_NAME
- use os.path.join to create paths for better OS compatibility
- switch to using f-strings
- only attempt cleanup of packages directory if it exists
- always rely on entry.data so that options is only used to capture options updates
- simplify code and reduced repeat logic by moving things into common functions
- raise Exceptions in services when there is a failure (this will be shown in UI)
- use more list comprehensions
- switch while loops to for loops
- added typing
- gitignore venv
- improve debug messaging

* remove helper entities on entry unload or options update

* remove counter since it's not actually used, it was just there for futureproofing

* bugfix

* fix path migration logic

* fix imports

* fix imports

* fix imports

* fix imports

* add pyproject.toml to configure black, isort, pytest, etc (from homeassistant repo)
@firstof9 firstof9 added the bugfix Fixes a bug label Dec 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix Fixes a bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants