Skip to content

feat: add major_version attribute to device initialization #119

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

Merged

Conversation

robberwick
Copy link
Collaborator

This pull request includes an important change to the BlinkStickDevice class in the src/blinkstick/devices/device.py file. The change involves initializing the major_version attribute in the __post_init__ method.

  • src/blinkstick/devices/device.py: Added initialization of the major_version attribute in the __post_init__ method to ensure it is set based on the serial_details of the device.

@robberwick robberwick requested a review from Copilot February 16, 2025 09:44
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.

@@ -20,6 +20,7 @@ class BlinkStickDevice(Generic[T]):
variant: BlinkStickVariant = field(init=False)

def __post_init__(self):
Copy link
Preview

Copilot AI Feb 16, 2025

Choose a reason for hiding this comment

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

Add a check to ensure serial_details is not None before accessing major_version to prevent potential AttributeError.

Suggested change
def __post_init__(self):
def __post_init__(self):
if self.serial_details is None:
raise ValueError("serial_details must not be None")

Copilot uses AI. Check for mistakes.

Copy link
Collaborator Author

@robberwick robberwick Feb 16, 2025

Choose a reason for hiding this comment

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

this is incorrect. serial_details is a required field of the dataclass, as a default is not provided in the decalration above, andit is not marked with Field(init=False)

@robberwick robberwick merged commit 23c5529 into arvydas:release/2.0-dev Feb 16, 2025
17 checks passed
@robberwick robberwick deleted the blinkstick-device-major-version branch February 16, 2025 09:49
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