Skip to content

Add keys and __contains__ method to Controls class - #88

Open
nhallez wants to merge 3 commits into
tiagocoutinho:masterfrom
nhallez:master
Open

Add keys and __contains__ method to Controls class#88
nhallez wants to merge 3 commits into
tiagocoutinho:masterfrom
nhallez:master

Conversation

@nhallez

@nhallez nhallez commented May 28, 2026

Copy link
Copy Markdown

The Control class (video) inherits from dict but only overrides items() and values(), leaving keys() and the in keyword to fall back to the default dict implementation. This causes those methods to return an empty result immediately after device creation, before any refresh has occurred.

As a result, membership checks like:

ControlsID.FOCUS_AUTO in cam.controls

…silently fail unless controls.refresh() is explicitly called.

@nhallez nhallez changed the title Add keys method to Controls class Add keys and __contains__ method to Controls class May 28, 2026

@tiagocoutinho tiagocoutinho left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Looks good!
Thanks for the contribution
Merging

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.

2 participants