Skip to content

No longer allow Parameter as input to ModelComponents#198

Merged
henrikjacobsenfys merged 4 commits into
developfrom
remove-parameter-as-input
Jun 3, 2026
Merged

No longer allow Parameter as input to ModelComponents#198
henrikjacobsenfys merged 4 commits into
developfrom
remove-parameter-as-input

Conversation

@henrikjacobsenfys
Copy link
Copy Markdown
Member

Closes #62

@henrikjacobsenfys henrikjacobsenfys added [scope] maintenance Code/tooling cleanup, no feature or bugfix (major.minor.PATCH) [priority] low Low importance labels Jun 1, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 1, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.10%. Comparing base (556b95f) to head (b6c30e5).
⚠️ Report is 1 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #198      +/-   ##
===========================================
- Coverage    98.13%   98.10%   -0.04%     
===========================================
  Files           51       51              
  Lines         3542     3532      -10     
  Branches       652      646       -6     
===========================================
- Hits          3476     3465      -11     
  Misses          36       36              
- Partials        30       31       +1     
Flag Coverage Δ
integration 45.01% <28.00%> (+0.09%) ⬆️
unittests 97.98% <100.00%> (-0.04%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ 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.

@henrikjacobsenfys henrikjacobsenfys linked an issue Jun 1, 2026 that may be closed by this pull request
@henrikjacobsenfys henrikjacobsenfys changed the title Remove parameter as input to ModelComponents No longer allow Parameter as input to ModelComponents Jun 1, 2026
Copy link
Copy Markdown

@damskii9992 damskii9992 left a comment

Choose a reason for hiding this comment

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

You have some more cleanup to do :) Your code gets much cleaner now that you don't allow Parameters as inputs ;)
Otherwise, LGTM.

if not isinstance(area, Numeric):
raise TypeError('area must be a number.')

if isinstance(area, Numeric):
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

You can remove this if isinstance as you already made that check above.

Comment on lines 75 to 77
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pretty sure this check is redundant now, since the min/max is by default -inf and inf.

raise ValueError('area must be a finite number or a Parameter')

raise ValueError('area must be a finite number.')
area = Parameter(name=name + ' area', value=float(area), unit=unit)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Just realized you're overwriting the local area variable. It is better coding practice to name it something else to avoid accidental coding errors. Like area_param or something.

Comment on lines 133 to 134
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

You should also be able to remove this check and the relevant argument, I suppose.

if not isinstance(width, Numeric):
raise TypeError(f'{param_name} must be a number.')

if isinstance(width, Numeric):
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

You can remove this isinstance

Comment on lines 190 to 196
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

You should also be able to remove this else branch

@henrikjacobsenfys henrikjacobsenfys merged commit 2f728e5 into develop Jun 3, 2026
34 of 35 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[priority] low Low importance [scope] maintenance Code/tooling cleanup, no feature or bugfix (major.minor.PATCH)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Don't allow Parameter's as input in ModelComponents.

2 participants