Skip to content

Commit 2ee72a3

Browse files
author
Bartek Florczyk Vik (CCI RPT RES1)
committed
ruff formating
1 parent 306e106 commit 2ee72a3

4 files changed

Lines changed: 33 additions & 33 deletions

File tree

src/pyscal/plotting.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,9 @@ def format_gaswater_table(model: GasWater) -> pd.DataFrame:
9999
# Check if SW in the two models differs using an epsilon of 1E-6 If any
100100
# absolute differences are greater than this threshold, an assertion error
101101
# will be raised.
102-
assert (
103-
abs(gasoil["SW"] - wateroil["SW"]) < 1e-6
104-
).all(), "SW for the GasOil model does not match SW for the WaterOil model"
102+
assert (abs(gasoil["SW"] - wateroil["SW"]) < 1e-6).all(), (
103+
"SW for the GasOil model does not match SW for the WaterOil model"
104+
)
105105

106106
# Merge dataframes and format
107107
gaswater = gasoil.merge(wateroil, left_index=True, right_index=True)

src/pyscal/utils/monotonicity.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,9 @@ def modify_dframe_monotonicity(
112112
while constants.any():
113113
iterations += 1
114114

115-
assert iterations <= 2 * len(
116-
dframe[col]
117-
), "Too many iterations for monotonicity fix"
115+
assert iterations <= 2 * len(dframe[col]), (
116+
"Too many iterations for monotonicity fix"
117+
)
118118

119119
dframe.loc[constants, col] = (
120120
dframe.loc[constants, col] + sign / 10.0**digits - epsilon
@@ -140,13 +140,13 @@ def modify_dframe_monotonicity(
140140
# Assert that we have successfully managed to force monotonicity
141141
allowance = 1.0 / 10.0**digits
142142
if sign > 0:
143-
assert not (
144-
dframe[col].round(digits).diff() < -allowance
145-
).any(), "Not possible to make column monotonically increasing"
143+
assert not (dframe[col].round(digits).diff() < -allowance).any(), (
144+
"Not possible to make column monotonically increasing"
145+
)
146146
else:
147-
assert not (
148-
dframe[col].round(digits).diff() > allowance
149-
).any(), "Not possible to make column monotonically decreasing"
147+
assert not (dframe[col].round(digits).diff() > allowance).any(), (
148+
"Not possible to make column monotonically decreasing"
149+
)
150150
return dframe
151151

152152

src/pyscal/wateroil.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -77,16 +77,16 @@ def __init__(
7777
_sgcr and _sgl are only to be used by the GasWater object.
7878
"""
7979

80-
assert (
81-
-epsilon - 1 < swirr < 1.0 + epsilon
82-
), f"swirr = {swirr}, -1 <= swirr <= 1 is required"
80+
assert -epsilon - 1 < swirr < 1.0 + epsilon, (
81+
f"swirr = {swirr}, -1 <= swirr <= 1 is required"
82+
)
8383
assert -epsilon < swl < 1.0 + epsilon, f"swl = {swl}, 0 <= swl < 1 is required"
84-
assert (
85-
-epsilon < swcr < 1.0 + epsilon
86-
), f"swcr = {swcr}, 0 <= swcr < 1 is required"
87-
assert (
88-
-epsilon < sorw < 1.0 + epsilon
89-
), f"sorw = {sorw}, 0 <= sorw < 1 is required"
84+
assert -epsilon < swcr < 1.0 + epsilon, (
85+
f"swcr = {swcr}, 0 <= swcr < 1 is required"
86+
)
87+
assert -epsilon < sorw < 1.0 + epsilon, (
88+
f"sorw = {sorw}, 0 <= sorw < 1 is required"
89+
)
9090
if socr is not None:
9191
assert -epsilon < socr < 1.0 + epsilon, "0 <= socr < 1 is required"
9292

tests/test_plotting.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,10 @@ def __init__(self, tag: str) -> None:
8686
def test_pyscal_list_attr():
8787
"""Check that the PyscalList class has an pyscal_list instance variable.
8888
This is accessed by the plotting module to loop through models to plot."""
89-
assert (
90-
hasattr(PyscalList(), "pyscal_list") is True
91-
), "The PyscalList object should have a pyscal_list instance variable.\
89+
assert hasattr(PyscalList(), "pyscal_list") is True, (
90+
"The PyscalList object should have a pyscal_list instance variable.\
9291
This is accessed by the plotting module."
92+
)
9393

9494

9595
def test_plot_relperm():
@@ -102,9 +102,9 @@ def test_plot_relperm():
102102
config = plotting.get_plot_config_options("WaterOil", **kwargs)
103103
fig = plotting.plot_relperm(wateroil.table, 1, config, **kwargs)
104104

105-
assert isinstance(
106-
fig, plt.Figure
107-
), "Type of returned object is not a matplotlib.pyplot Figure"
105+
assert isinstance(fig, plt.Figure), (
106+
"Type of returned object is not a matplotlib.pyplot Figure"
107+
)
108108

109109

110110
def test_plot_pc():
@@ -118,9 +118,9 @@ def test_plot_pc():
118118
config = plotting.get_plot_config_options("WaterOil", **kwargs)
119119
fig = plotting.plot_pc(wateroil.table, 1, **config)
120120

121-
assert isinstance(
122-
fig, plt.Figure
123-
), "Type of returned object is not a matplotlib.pyplot Figure"
121+
assert isinstance(fig, plt.Figure), (
122+
"Type of returned object is not a matplotlib.pyplot Figure"
123+
)
124124

125125

126126
def test_wog_plotter(tmpdir):
@@ -184,9 +184,9 @@ def test_wo_plotter_relperm_only(tmpdir):
184184
plotting.wo_plotter(wateroil, **kwargs)
185185

186186
assert Path.exists(Path(tmpdir).joinpath(kr_plot_name)), "Plot not created"
187-
assert not Path.exists(
188-
Path(tmpdir).joinpath(pc_plot_name)
189-
), "Plot created when it shouldn't have been"
187+
assert not Path.exists(Path(tmpdir).joinpath(pc_plot_name)), (
188+
"Plot created when it shouldn't have been"
189+
)
190190

191191

192192
def test_go_plotter(tmpdir):

0 commit comments

Comments
 (0)