Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Papercut: enumify text based choices #3021
Papercut: enumify text based choices #3021
Changes from 14 commits
4f32a79
bfae427
c7b4b5b
b7c91e8
7cc05bf
60e2dca
d7c027c
fe1a428
19eabef
a1123dc
e5b041c
303ea5b
56dee4c
c9efa5e
bbeafbd
9dba7d5
d58bd0b
b34ccfd
773020b
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
Check warning on line 39 in bluemira/builders/pf_coil.py
Codecov / codecov/patch
bluemira/builders/pf_coil.py#L38-L39
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typing of value is missing
def _missing_(cls, value: str):
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done in PR #3036, commit 3c9ff6d.
Check warning on line 76 in bluemira/equilibria/equilibrium.py
Codecov / codecov/patch
bluemira/equilibria/equilibrium.py#L73-L76
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please autofill the options with the
cls._member_names_
attribute egalso the error message sounds like the user can input something (which they can't). Maybe something like:
f"{cls.__name__} has no strategy {value} please select from {*cls._member_names_,}"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done in PR #3036, commit 3c9ff6d.
Check warning on line 1078 in bluemira/equilibria/equilibrium.py
Codecov / codecov/patch
bluemira/equilibria/equilibrium.py#L1074-L1078
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this error message will never be hit as it will error on L1073 on the initialisation of the enum, please remove the else
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done in PR #3036, commit 3c9ff6d. removed else, put two ifs (instead of if-elif without else)
Check warning on line 1080 in bluemira/equilibria/equilibrium.py
Codecov / codecov/patch
bluemira/equilibria/equilibrium.py#L1080
Check warning on line 110 in bluemira/equilibria/plotting.py
Codecov / codecov/patch
bluemira/equilibria/plotting.py#L107-L110
Check warning on line 256 in bluemira/equilibria/plotting.py
Codecov / codecov/patch
bluemira/equilibria/plotting.py#L255-L256
Check warning on line 258 in bluemira/equilibria/plotting.py
Codecov / codecov/patch
bluemira/equilibria/plotting.py#L258
Check warning on line 329 in bluemira/equilibria/plotting.py
Codecov / codecov/patch
bluemira/equilibria/plotting.py#L328-L329
Check warning on line 340 in bluemira/equilibria/plotting.py
Codecov / codecov/patch
bluemira/equilibria/plotting.py#L340
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I dont like these names, they're quite restrictive and not very descriptive.
possible replacements
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done in #3036, commit b4e1ad1
Check warning on line 54 in bluemira/equilibria/positioner.py
Codecov / codecov/patch
bluemira/equilibria/positioner.py#L53-L54
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as previous enum comments, no typing on value and error message:
f"{cls.__name__} has no entry {value} please select from {*cls._member_names_,}"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done in #3036, commit b4e1ad1
Check warning on line 66 in bluemira/equilibria/positioner.py
Codecov / codecov/patch
bluemira/equilibria/positioner.py#L65-L66
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typing of value and message
f"{value} is not a valid coilset Layout. please select from {*cls._member_names_,}"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done in #3036, commit b4e1ad1
Check warning on line 140 in bluemira/equilibria/positioner.py
Codecov / codecov/patch
bluemira/equilibria/positioner.py#L140
Check warning on line 17 in bluemira/fuel_cycle/analysis.py
Codecov / codecov/patch
bluemira/fuel_cycle/analysis.py#L17
Check warning on line 28 in bluemira/fuel_cycle/analysis.py
Codecov / codecov/patch
bluemira/fuel_cycle/analysis.py#L28
Check warning on line 35 in bluemira/fuel_cycle/analysis.py
Codecov / codecov/patch
bluemira/fuel_cycle/analysis.py#L31-L35
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can also deal with the 95th here eg
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done in #3036, commit f564879
Check warning on line 42 in bluemira/fuel_cycle/analysis.py
Codecov / codecov/patch
bluemira/fuel_cycle/analysis.py#L37-L42
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fix typing and message
f"Invalid query: {value}. Choose from: {*cls._member_names_,}"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done in #3036, commit f564879
Check warning on line 140 in bluemira/fuel_cycle/analysis.py
Codecov / codecov/patch
bluemira/fuel_cycle/analysis.py#L140
Check warning on line 142 in bluemira/fuel_cycle/analysis.py
Codecov / codecov/patch
bluemira/fuel_cycle/analysis.py#L142
Check warning on line 144 in bluemira/fuel_cycle/analysis.py
Codecov / codecov/patch
bluemira/fuel_cycle/analysis.py#L144
Check warning on line 146 in bluemira/fuel_cycle/analysis.py
Codecov / codecov/patch
bluemira/fuel_cycle/analysis.py#L146
Check warning on line 148 in bluemira/fuel_cycle/analysis.py
Codecov / codecov/patch
bluemira/fuel_cycle/analysis.py#L148
Check warning on line 150 in bluemira/fuel_cycle/analysis.py
Codecov / codecov/patch
bluemira/fuel_cycle/analysis.py#L150
Check warning on line 152 in bluemira/fuel_cycle/analysis.py
Codecov / codecov/patch
bluemira/fuel_cycle/analysis.py#L152
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this error will never be hit it will have already errored at L140
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed in PR #3036, followed if-elif-else approach, commit 22ee7a0
Check warning on line 14 in bluemira/fuel_cycle/lifecycle.py
Codecov / codecov/patch
bluemira/fuel_cycle/lifecycle.py#L14
Check warning on line 35 in bluemira/fuel_cycle/lifecycle.py
Codecov / codecov/patch
bluemira/fuel_cycle/lifecycle.py#L35
Check warning on line 39 in bluemira/fuel_cycle/lifecycle.py
Codecov / codecov/patch
bluemira/fuel_cycle/lifecycle.py#L38-L39
Check warning on line 46 in bluemira/fuel_cycle/lifecycle.py
Codecov / codecov/patch
bluemira/fuel_cycle/lifecycle.py#L41-L46
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typing and error message
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done in PR #3036, commit 878ddf4
Check warning on line 433 in bluemira/fuel_cycle/lifecycle.py
Codecov / codecov/patch
bluemira/fuel_cycle/lifecycle.py#L432-L433
Check warning on line 443 in bluemira/fuel_cycle/lifecycle.py
Codecov / codecov/patch
bluemira/fuel_cycle/lifecycle.py#L443