Skip to content

[MNT] Use walrus operator in study.py to resolve TODO - #1747

Merged
L-Agbaria merged 1 commit into
openml:mainfrom
shellyco-code:refactor/study-walrus-operator
Sep 25, 2026
Merged

L-Agbaria merged 1 commit into
openml:mainfrom
shellyco-code:refactor/study-walrus-operator

Conversation

@shellyco-code

Copy link
Copy Markdown
Contributor

Description

This PR resolves an outstanding TODO comment in openml/study/study.py by refactoring legacy variable assignments to use the Python 3.8+ walrus operator (:=).

This change is now safe to make as the project has updated its requires-python specification to >=3.10 in pyproject.toml, officially dropping Python 3.7 support.

Resolves #1746

Changes

  • Replaced two instances of getattr followed by an is not None check with the walrus operator in openml/study/study.py.
  • Removed the old # TODO(eddiebergman): Begging for a walrus if we can drop 3.7 comments.

Checklist

  • I have read the CONTRIBUTING guide.
  • I have run the pre-commit checks locally (pre-commit run --all-files).
  • All tests related to my changes pass locally (pytest tests).

Signed-off-by: Shelly Chahar <shellychahar57@gmail.com>
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.32%. Comparing base (fabbc28) to head (b5c8350).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1747      +/-   ##
==========================================
- Coverage   81.50%   81.32%   -0.18%     
==========================================
  Files          63       63              
  Lines        5240     5238       -2     
==========================================
- Hits         4271     4260      -11     
- Misses        969      978       +9     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@L-Agbaria
L-Agbaria merged commit 26e35aa into openml:main Sep 25, 2026
24 of 27 checks passed
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.

[Refactor] Use walrus operator in study.py (Python 3.10+ upgrade)

3 participants