Skip to content

Conversation

@Omswastik-11
Copy link

Fixes #1581

@Omswastik-11
Copy link
Author

Omswastik-11 commented Jan 2, 2026

Hi @fkiraly !! I would like to know you suggestion on this .

Screenshot 2026-01-02 133722

In openml\runs\run.py the _generate_arff_dict function is causing the above issue . so I created a new function _get_arff_attributes_for_task to reduce complexity is it ok ? or should I think of a alternate solution ?

@Omswastik-11 Omswastik-11 changed the title [MNT] Replace asserts with proper if else error handling [MNT] Replace asserts with proper if else Exception handling Jan 2, 2026
Copy link
Collaborator

@fkiraly fkiraly left a comment

Choose a reason for hiding this comment

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

Yes, looks reasonable for me for a first go, to isolate the if/else in a function.

More generally, from an architecture standpoint however, whenever I see a long list of if/elses on the argument class type, I think it is too high coupling and it should be either a method of the (task/argument) class or a visitor pattern.

Why: imagine you want to add a new task. Now you have to add another elif in all of these functions. This is absolutely not extensible.

This should be refactored - I would say, in another PR, after opening an issue with a plan - so the task itself, or a visitor, manages whatever is in the if/else.

@codecov-commenter
Copy link

codecov-commenter commented Jan 2, 2026

Codecov Report

❌ Patch coverage is 4.76190% with 40 lines in your changes missing coverage. Please review.
✅ Project coverage is 52.64%. Comparing base (3454bbb) to head (5401957).

Files with missing lines Patch % Lines
openml/runs/run.py 4.54% 21 Missing ⚠️
openml/runs/functions.py 7.14% 13 Missing ⚠️
openml/runs/trace.py 0.00% 6 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1589      +/-   ##
==========================================
- Coverage   52.72%   52.64%   -0.09%     
==========================================
  Files          36       36              
  Lines        4326     4335       +9     
==========================================
+ Hits         2281     2282       +1     
- Misses       2045     2053       +8     

☔ View full report in Codecov by Sentry.
📢 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.

@fkiraly fkiraly changed the title [MNT] Replace asserts with proper if else Exception handling [ENH] Replace asserts with proper if else Exception handling Jan 2, 2026
@fkiraly fkiraly added enhancement module:Run OpenML concept labels Jan 2, 2026
@Omswastik-11 Omswastik-11 requested a review from fkiraly January 2, 2026 12:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[MNT] Replace Assert Statements with Proper Exceptions

3 participants