equinor / equinor/ert

Improve typing in fmudesign

Open
#14,352 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
161
Forks
141
Avg merge
2d 4h
Merged PRs (30d)
138

Description

After adding type annotations to the `fmudesign` module, i noticed that some types was too narrow and resulted in type check violations for another repo i was working on.

The relevant places is:

* `fmudesign.design_distributions.draw_values()` (and `draw_values_DISTTYPE`): Type of `dist_parameters` should be `Sequence[str | float]`, as it accepts both string and floats and eventually converts it to float

* `fmudesign.create_design.is_consistent_correlation_matrix()`: Type of `matrix` works with `pandas.DataFrame`, and should be widened to also accept it.

I can create a PR that fixes this Soon™️

Contributor guide

Open the contributing guide

Research direction

Start with fmudesign.design_distributions.draw_values() and draw_values_DISTTYPE(), then inspect fmudesign.create_design.is_consistent_correlation_matrix(). Confirm the accepted types match the issue, including strings and floats for dist_parameters and pandas.DataFrame for matrix, and verify that type checking no longer reports the described violations.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
developer-experience
Issue type
Refactor
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.