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

Device major version variant #116

Merged

Conversation

robberwick
Copy link
Collaborator

This pull request includes significant changes to the BlinkStick library, focusing on refactoring the handling of BlinkStick variants and improving the device initialization process. The most important changes include moving BlinkStickVariant to a new enums module, updating the BlinkStickDevice class to use SerialDetails, and adding new methods and tests to support these updates.

Refactoring and code organization:

  • src/blinkstick/__init__.py, src/blinkstick/clients/blinkstick.py, src/scripts/main.py, tests/clients/test_blinkstick.py: Updated imports to reflect the new location of BlinkStickVariant in the enums module. [1] [2] [3] [4]

Device initialization and variant handling:

  • src/blinkstick/backends/base.py, src/blinkstick/backends/unix_like.py, src/blinkstick/backends/win32.py: Refactored backend classes to use SerialDetails for serial number handling and updated methods to reflect this change. [1] [2] [3]
  • src/blinkstick/devices/device.py: Updated BlinkStickDevice class to include major_version and variant fields, and added a __post_init__ method to set the variant using SerialDetails.

New methods and tests:

  • src/blinkstick/backends/base.py, src/blinkstick/clients/blinkstick.py: Added get_variant method to backends and updated the get_variant method in BlinkStick class to use the backend method. [1] [2]
  • tests/devices/test_blinkstick_device.py, tests/models/serial_number.py: Added tests for the new SerialDetails class and updated tests for BlinkStickDevice to verify correct initialization and variant handling. [1] [2]

@robberwick robberwick requested a review from Copilot December 1, 2024 16:33

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 7 out of 15 changed files in this pull request and generated no suggestions.

Files not reviewed (8)
  • src/blinkstick/init.py: Evaluated as low risk
  • src/blinkstick/backends/base.py: Evaluated as low risk
  • src/blinkstick/backends/unix_like.py: Evaluated as low risk
  • src/blinkstick/clients/blinkstick.py: Evaluated as low risk
  • src/blinkstick/constants.py: Evaluated as low risk
  • tests/devices/test_blinkstick_device.py: Evaluated as low risk
  • src/blinkstick/enums.py: Evaluated as low risk
  • src/blinkstick/models.py: Evaluated as low risk
Rename BlinkStickVariant.identify() to .from_version_attrs(), for added clarity.
Add a serial number model so that it's easier to decompose th estring into constituent parts
@robberwick robberwick force-pushed the device-major-version-variant branch from fc3f52c to 7e5837e Compare December 1, 2024 16:36
@robberwick robberwick force-pushed the device-major-version-variant branch from 7e5837e to 1aa1b0f Compare December 1, 2024 16:41
@robberwick robberwick requested a review from Copilot December 1, 2024 16:52

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 7 out of 16 changed files in this pull request and generated no suggestions.

Files not reviewed (9)
  • src/blinkstick/enums.py: Evaluated as low risk
  • tests/devices/test_blinkstick_device.py: Evaluated as low risk
  • tests/clients/test_blinkstick.py: Evaluated as low risk
  • src/blinkstick/models.py: Evaluated as low risk
  • src/blinkstick/init.py: Evaluated as low risk
  • src/blinkstick/backends/win32.py: Evaluated as low risk
  • src/blinkstick/backends/unix_like.py: Evaluated as low risk
  • src/blinkstick/clients/blinkstick.py: Evaluated as low risk
  • src/scripts/main.py: Evaluated as low risk
@robberwick robberwick merged commit e402922 into arvydas:release/2.0-dev Dec 1, 2024
17 checks passed
@robberwick robberwick deleted the device-major-version-variant branch December 1, 2024 16:58
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.

1 participant