Skip to content

jumpstarter-driver-gpio: Add read method required by PowerInterface#616

Merged
mangelajo merged 1 commit intojumpstarter-dev:mainfrom
anobli:abailon/fix-gpiod-power
Apr 20, 2026
Merged

jumpstarter-driver-gpio: Add read method required by PowerInterface#616
mangelajo merged 1 commit intojumpstarter-dev:mainfrom
anobli:abailon/fix-gpiod-power

Conversation

@anobli
Copy link
Copy Markdown
Contributor

@anobli anobli commented Apr 17, 2026

This addresses the following issue:
TypeError: Can't instantiate abstract class PowerSwitch without an implementation for abstract method 'read'

This adds the read method which return 0 power because we can't get this kind of data from a gpio.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 17, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 358d5f8e-c27b-46bb-862b-c88c1045f012

📥 Commits

Reviewing files that changed from the base of the PR and between 7956f62 and 9370d0d.

📒 Files selected for processing (1)
  • python/packages/jumpstarter-driver-gpiod/jumpstarter_driver_gpiod/driver.py

📝 Walkthrough

Walkthrough

A new read() method was added to the PowerSwitch class with a generator-based return type Generator[PowerReading, None, None]; the method body currently raises NotImplementedError and includes a yield to make it a generator. Generator and PowerReading were imported to support the signature.

Changes

Cohort / File(s) Summary
GPIO Power Switch driver
python/packages/jumpstarter-driver-gpiod/jumpstarter_driver_gpiod/driver.py
Added a stub read() method on PowerSwitch typed as Generator[PowerReading, None, None] that raises NotImplementedError and contains a yield (to ensure generator form). Added imports for Generator and PowerReading supporting the new signature.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐇 I added a little stub today,
A generator that won’t yet play,
It yields a promise, not the light—
Soon it’ll measure, soon it’ll write. ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: adding a read method to satisfy the PowerInterface requirement for the GPIO driver.
Description check ✅ Passed The description is directly related to the changeset, explaining the problem (TypeError from missing abstract method) and the solution (adding the read method).

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Member

@mangelajo mangelajo left a comment

Choose a reason for hiding this comment

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

Thank you very much for the bugfix.

@mangelajo mangelajo added backport release-0.8 bug Something isn't working labels Apr 17, 2026
This addresses the following issue:
TypeError: Can't instantiate abstract class PowerSwitch without an implementation
for abstract method 'read'

This adds the read method that will raise an exception because we can't
get this kind of data from a gpio.

Signed-off-by: Alexandre Bailon <abailon@baylibre.com>
@anobli anobli force-pushed the abailon/fix-gpiod-power branch from 7956f62 to 9370d0d Compare April 18, 2026 07:13
@anobli anobli requested a review from mangelajo April 18, 2026 07:16
Copy link
Copy Markdown
Member

@mangelajo mangelajo left a comment

Choose a reason for hiding this comment

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

Thank you so much

@mangelajo mangelajo merged commit f0ba0c1 into jumpstarter-dev:main Apr 20, 2026
32 checks passed
@jumpstarter-backport-bot
Copy link
Copy Markdown

Successfully created backport PR for release-0.8:

mangelajo pushed a commit that referenced this pull request Apr 20, 2026
…red by PowerInterface (#623)

Bot-based backport to `release-0.8`, triggered by a label in #616.

Signed-off-by: Alexandre Bailon <abailon@baylibre.com>
Co-authored-by: Alexandre Bailon <abailon@baylibre.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport release-0.8 bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants