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

[Lint] - Fixed strange if #1540

Merged
merged 2 commits into from
Feb 6, 2025
Merged

[Lint] - Fixed strange if #1540

merged 2 commits into from
Feb 6, 2025

Conversation

marcus-oscarsson
Copy link
Member

Fixed the odd if statement, the sample changer HardwareObjects should now return True and not None or True on success.

if (
res is not False
not res
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
not res
res is not None

Otherwise the semantics for this if statement changes.

For example not res will be True even for res = "", res = 0, not only res = None. Don't know if this actually make a difference in this code.

Copy link
Member Author

@marcus-oscarsson marcus-oscarsson Feb 5, 2025

Choose a reason for hiding this comment

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

load of the SampleChanger hardware object should now always return True or False. It used to be the the case, in the past that, None or True was returned for a successful load.

Your right the test should be changed, but to if res.

Thanks for spotting this one, I made a quick touch up before making the PR and made this mistake but it should be fine now.

@marcus-oscarsson marcus-oscarsson merged commit 12ac847 into develop Feb 6, 2025
17 checks passed
@marcus-oscarsson marcus-oscarsson deleted the mo-esrf-lint branch February 6, 2025 07: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.

None yet

2 participants