-
Notifications
You must be signed in to change notification settings - Fork 114
ENUM refactor #216
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
Open
Flavsditz
wants to merge
11
commits into
reilleya:staging
Choose a base branch
from
Flavsditz:enum_refactor
base: staging
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
ENUM refactor #216
Changes from 9 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
1988f19
moved fileIO existing enum into its own file and updated deps
Flavsditz 9f8968d
moved `SimAlertType` and `SimAlertLevel` existing enums into its own …
Flavsditz a85cd57
simplified code by making `SimAlertType` and `SimAlertLevel` use strings
Flavsditz 2d8efbd
fixed bug due to new version of matplotlib that likely also fixes iss…
Flavsditz 0107f16
Multi and Single Value channels extracted to ENUMs
Flavsditz 5c2752e
Units extracted into ENUMs
Flavsditz fd5f988
Extracted `InhibitedEnds` to its own ENUM
Flavsditz 4aa88b2
extracted other variables to enums and fixed file names to start with…
Flavsditz 72b7c19
fix for preferences loading
Flavsditz 7210a69
merged Unit files into single file
Flavsditz 826d408
removed superfluous comments
Flavsditz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| from enum import Enum | ||
|
|
||
|
|
||
| # Python 3.11 supports `StrEnum` that would make this a bit more concise to write | ||
| # https://docs.python.org/3/library/enum.html#enum.StrEnum | ||
| class InhibitedEnds(str, Enum): | ||
| NEITHER = 'Neither' | ||
| TOP = 'Top' | ||
| BOTTOM = 'Bottom' | ||
| BOTH = 'Both' | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| from enum import Enum | ||
|
|
||
|
|
||
| # Python 3.11 supports `StrEnum` that would make this a bit more concise to write | ||
| # https://docs.python.org/3/library/enum.html#enum.StrEnum | ||
| class MultiValueChannels(str, Enum): | ||
| MASS = 'mass' | ||
| MASS_FLOW = 'massFlow' | ||
| MASS_FLUX = 'massFlux' | ||
| REGRESSION = 'regression' | ||
| WEB = 'web' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| from enum import Enum | ||
|
|
||
|
|
||
| # Python 3.11 supports `StrEnum` that would make this a bit more concise to write | ||
| # https://docs.python.org/3/library/enum.html#enum.StrEnum | ||
| class SimAlertLevel(str, Enum): | ||
| """Levels of severity for sim alerts""" | ||
| ERROR = 'Error' | ||
| WARNING = 'Warning' | ||
| MESSAGE = 'Message' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,9 @@ | ||||||
| from enum import Enum | ||||||
|
|
||||||
| # Python 3.11 supports `StrEnum` that would make this a bit more concise to write | ||||||
| # https://docs.python.org/3/library/enum.html#enum.StrEnum | ||||||
| class SimAlertType(str, Enum): | ||||||
| """Types of sim alerts""" | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| GEOMETRY = 'Geometry' | ||||||
| CONSTRAINT = 'Constraint' | ||||||
| VALUE = 'Value' | ||||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| from enum import Enum | ||
|
|
||
|
|
||
| # Python 3.11 supports `StrEnum` that would make this a bit more concise to write | ||
| # https://docs.python.org/3/library/enum.html#enum.StrEnum | ||
| class SingleValueChannels(str, Enum): | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it is recommended to use singular form for classes AFAIK |
||
| TIME = 'time' | ||
| KN = 'kn' | ||
| PRESSURE = 'pressure' | ||
| FORCE = 'force' | ||
| VOLUME_LOADING = 'volumeLoading' | ||
| EXIT_PRESSURE = 'exitPressure' | ||
| D_THROAT = 'dThroat' | ||
Empty file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| from enum import Enum | ||
|
|
||
|
|
||
| # Python 3.11 supports `StrEnum` that would make this a bit more concise to write | ||
| # https://docs.python.org/3/library/enum.html#enum.StrEnum | ||
| class AngleUnit(str, Enum): | ||
| DEGREES = 'deg' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| from enum import Enum | ||
|
|
||
|
|
||
| # Python 3.11 supports `StrEnum` that would make this a bit more concise to write | ||
| # https://docs.python.org/3/library/enum.html#enum.StrEnum | ||
| class BurnRateCoefficientUnit(str, Enum): | ||
| METER_PER_SECOND_PASCAL_TO_THE_POWER_OF_N = 'm/(s*Pa^n)' | ||
| INCH_PER_SECOND_POUND_PER_SQUARE_INCH_TO_THE_POWER_OF_N = 'in/(s*psi^n)' | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| from enum import Enum | ||
|
|
||
|
|
||
| # Python 3.11 supports `StrEnum` that would make this a bit more concise to write | ||
| # https://docs.python.org/3/library/enum.html#enum.StrEnum | ||
| class DensityUnit(str, Enum): | ||
Flavsditz marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| KILOGRAM_PER_CUBIC_METER = 'kg/m^3' | ||
| POUND_PER_CUBIC_INCH = 'lb/in^3' | ||
| GRAM_PER_CUBIC_CENTIMETER = 'g/cm^3' | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| from enum import Enum | ||
|
|
||
|
|
||
| # Python 3.11 supports `StrEnum` that would make this a bit more concise to write | ||
| # https://docs.python.org/3/library/enum.html#enum.StrEnum | ||
| class ForceUnit(str, Enum): | ||
| NEWTON = 'N' | ||
| POUND_FORCE = 'lbf' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| from enum import Enum | ||
|
|
||
|
|
||
| # Python 3.11 supports `StrEnum` that would make this a bit more concise to write | ||
| # https://docs.python.org/3/library/enum.html#enum.StrEnum | ||
| class ImpulseUnit(str, Enum): | ||
| NEWTON_SECOND = 'Ns' | ||
| POUND_FORCE_SECOND = 'lbfs' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| from enum import Enum | ||
|
|
||
|
|
||
| # Python 3.11 supports `StrEnum` that would make this a bit more concise to write | ||
| # https://docs.python.org/3/library/enum.html#enum.StrEnum | ||
| class LengthUnit(str, Enum): | ||
| METER = 'm' | ||
| CENTIMETER = 'cm' | ||
| MILLIMETER = 'mm' | ||
| INCH = 'in' | ||
| FOOT = 'ft' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| from enum import Enum | ||
|
|
||
|
|
||
| # Python 3.11 supports `StrEnum` that would make this a bit more concise to write | ||
| # https://docs.python.org/3/library/enum.html#enum.StrEnum | ||
| class MassFlowUnit(str, Enum): | ||
| KILOGRAM_PER_SECOND = 'kg/s' | ||
| POUND_PER_SECOND = 'lb/s' | ||
| GRAM_PER_SECOND = 'g/s' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| from enum import Enum | ||
|
|
||
|
|
||
| # Python 3.11 supports `StrEnum` that would make this a bit more concise to write | ||
| # https://docs.python.org/3/library/enum.html#enum.StrEnum | ||
| class MassFluxUnit(str, Enum): | ||
| KILOGRAM_PER_SQUARE_METER_PER_SECOND = 'kg/(m^2*s)' | ||
| POUND_PER_SQUARE_INCH_PER_SECOND = 'lb/(in^2*s)' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| from enum import Enum | ||
|
|
||
|
|
||
| # Python 3.11 supports `StrEnum` that would make this a bit more concise to write | ||
| # https://docs.python.org/3/library/enum.html#enum.StrEnum | ||
| class MassUnit(str, Enum): | ||
| KILOGRAM = 'kg' | ||
| GRAM = 'g' | ||
| POUND = 'lb' | ||
| OUNCE = 'oz' | ||
| GRAM_PER_MOLE = 'g/mol' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| from enum import Enum | ||
|
|
||
|
|
||
| # Python 3.11 supports `StrEnum` that would make this a bit more concise to write | ||
| # https://docs.python.org/3/library/enum.html#enum.StrEnum | ||
| class NozzleErosionCoefficientUnit(str, Enum): | ||
| METER_PER_SECOND_PASCAL = 'm/(s*Pa)' | ||
| METER_PER_SECOND_MEGAPASCAL = 'm/(s*MPa)' | ||
| THOUSANDTH_INCH_PER_SECOND_POUND_PER_SQUARE_INCH = 'thou/(s*psi)' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| from enum import Enum | ||
|
|
||
|
|
||
| # Python 3.11 supports `StrEnum` that would make this a bit more concise to write | ||
| # https://docs.python.org/3/library/enum.html#enum.StrEnum | ||
| class NozzleSlagCoefficientUnit(str, Enum): | ||
| METER_PASCAL_PER_SECOND = '(m*Pa)/s' | ||
| METER_MEGAPASCAL_PER_SECOND = '(m*MPa)/s' | ||
| INCH_POUND_PER_SQUARE_INCH_PER_SECOND = '(in*psi)/s' | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| from enum import Enum | ||
|
|
||
|
|
||
| # Python 3.11 supports `StrEnum` that would make this a bit more concise to write | ||
| # https://docs.python.org/3/library/enum.html#enum.StrEnum | ||
| class PressureUnit(str, Enum): | ||
| PASCAL = 'Pa' | ||
| MEGAPASCAL = 'MPa' | ||
| POUND_PER_SQUARE_INCH = 'psi' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| from enum import Enum | ||
|
|
||
|
|
||
| # Python 3.11 supports `StrEnum` that would make this a bit more concise to write | ||
| # https://docs.python.org/3/library/enum.html#enum.StrEnum | ||
| class TemperatureUnit(str, Enum): | ||
| KELVIN = 'K' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| from enum import Enum | ||
|
|
||
|
|
||
| # Python 3.11 supports `StrEnum` that would make this a bit more concise to write | ||
| # https://docs.python.org/3/library/enum.html#enum.StrEnum | ||
| class TimeUnit(str, Enum): | ||
| SECOND = 's' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| from enum import Enum | ||
|
|
||
|
|
||
| # Python 3.11 supports `StrEnum` that would make this a bit more concise to write | ||
| # https://docs.python.org/3/library/enum.html#enum.StrEnum | ||
| class VelocityUnit(str, Enum): | ||
| METER_PER_SECOND = 'm/s' | ||
| CENTIMETER_PER_SECOND = 'cm/s' | ||
| MILLIMETER_PER_SECOND = 'mm/s' | ||
| FOOT_PER_SECOND = 'ft/s' | ||
| INCH_PER_SECOND = 'in/s' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| from enum import Enum | ||
|
|
||
|
|
||
| # Python 3.11 supports `StrEnum` that would make this a bit more concise to write | ||
| # https://docs.python.org/3/library/enum.html#enum.StrEnum | ||
| class VolumeUnit(str, Enum): | ||
| CUBIC_METER = 'm^3' | ||
| CUBIC_CENTIMETER = 'cm^3' | ||
| CUBIC_MILLIMETER = 'mm^3' | ||
| CUBIC_INCH = 'in^3' | ||
| CUBIC_FOOT = 'ft^3' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
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.
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 think we should try to take this opportunity to make a migration that converts "top"->"forward" and "bottom"->"aft".
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.
As far as I can see this would only be present on the
.ricfiles. Is this assumption correct?So that the necessary migration can be done I don't want to miss anything.
Any chance for a more complex
.ricfile to be made available so I can use it for testing too?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.
Sorry for the delay! Here's a kind of silly example that uses all 4 inhibitor configurations:

example.ric.txt
and what it looks like on my end, so you can verify nothing changed: