Rationalise accessing of read-only device attributes by use of a BlinkStickDevice class #110
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.
This pull request introduces significant changes to the BlinkStick backend classes by refactoring how devices are represented and managed. The most important changes include the introduction of a new
BlinkStickDevice
class, renaming and modifying methods to improve clarity and functionality, and updating the backend classes to utilize the new device representation.Introduction of
BlinkStickDevice
class:src/blinkstick/devices/device.py
: Added a newBlinkStickDevice
class to encapsulate device properties such asraw_device
,serial
,manufacturer
,version_attribute
, anddescription
.Refactoring backend classes:
src/blinkstick/backends/base.py
: Updated theBaseBackend
class to use the newBlinkStickDevice
class, renamed methods for clarity, and removed redundant abstract methods. [1] [2]src/blinkstick/backends/unix_like.py
: Modified theUnixLikeBackend
class to useBlinkStickDevice
and updated method implementations accordingly. [1] [2] [3]src/blinkstick/backends/win32.py
: Updated theWin32Backend
class to utilizeBlinkStickDevice
and refactored methods for better readability and functionality. [1] [2] [3]Updates to BlinkStick class:
src/blinkstick/blinkstick.py
: Updated theBlinkStick
class to acceptBlinkStickDevice
in its constructor and modified thefind_all
andfind_first
methods to use the newget_attached_blinkstick_devices
method. [1] [2] [3] [4]These changes improve the maintainability and clarity of the codebase by introducing a clear device representation and refactoring methods for better readability and functionality.