-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
remove intermediate Fluid class by creating a factory that constructs…
… and returns the scp classes directly, then operate directly on those scp class instances
- Loading branch information
Showing
17 changed files
with
92 additions
and
165 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 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,28 @@ | ||
from __future__ import annotations | ||
|
||
from scp.ethyl_alcohol import EthylAlcohol | ||
from scp.ethylene_glycol import EthyleneGlycol | ||
from scp.methyl_alcohol import MethylAlcohol | ||
from scp.propylene_glycol import PropyleneGlycol | ||
from scp.water import Water | ||
|
||
|
||
def get_fluid(inputs: dict) -> EthylAlcohol | EthyleneGlycol | MethylAlcohol | PropyleneGlycol | Water: | ||
fluid_type_str = inputs['fluid-type'].upper() | ||
if fluid_type_str == "WATER": | ||
concentration = 0 | ||
return Water() | ||
elif fluid_type_str == "EA": | ||
concentration = inputs['concentration'] / 100.0 | ||
return EthylAlcohol(concentration) | ||
elif fluid_type_str == "EG": | ||
concentration = inputs['concentration'] / 100.0 | ||
return EthyleneGlycol(concentration) | ||
elif fluid_type_str == "MA": | ||
concentration = inputs['concentration'] / 100.0 | ||
return MethylAlcohol(concentration) | ||
elif fluid_type_str == "PG": | ||
concentration = inputs['concentration'] / 100.0 | ||
return PropyleneGlycol(concentration) | ||
else: | ||
raise ValueError(f"Fluid '{fluid_type_str}' fluid is not valid.") |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains 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 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 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 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 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 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 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 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.