Skip to content

Commit

Permalink
STY: Format with new ruff
Browse files Browse the repository at this point in the history
  • Loading branch information
mferrera committed Jan 10, 2025
1 parent 8295e21 commit 294eaa5
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 20 deletions.
2 changes: 1 addition & 1 deletion src/xtgeo/grid3d/_grid_etc1.py
Original file line number Diff line number Diff line change
Expand Up @@ -966,7 +966,7 @@ def inactivate_inside(
)

if ier == 1:
raise RuntimeError("Problems with one or more polygons. " "Not closed?")
raise RuntimeError("Problems with one or more polygons. Not closed?")


def collapse_inactive_cells(self: Grid) -> None:
Expand Down
2 changes: 1 addition & 1 deletion src/xtgeo/grid3d/_gridprop_lowlevel.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ def check_shape_ok(self: GridProperty, values: np.ndarray) -> bool:
if values.shape == (self._ncol, self._nrow, self._nlay):
return True
logger.error(
"Wrong shape: Dimens of values %s %s %s" "vs %s %s %s",
"Wrong shape: Dimens of values %s %s %svs %s %s %s",
*values.shape,
self._ncol,
self._nrow,
Expand Down
4 changes: 1 addition & 3 deletions src/xtgeo/grid3d/grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -634,9 +634,7 @@ def props(self) -> list[GridProperty] | None:
if isinstance(self._props, GridProperties):
return self._props.props
if isinstance(self._props, list):
raise RuntimeError(
"self._props is a list, not a GridProperties " "instance"
)
raise RuntimeError("self._props is a list, not a GridProperties instance")
return None

@props.setter
Expand Down
3 changes: 1 addition & 2 deletions src/xtgeo/xyz/_xyz_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -471,8 +471,7 @@ def _from_list_like(plist, zname, attrs, is_polygons) -> pd.DataFrame:
attr_first_col = 4
else:
raise ValueError(
f"Wrong length detected of row: {totnum}. "
"Are attributes set correct?"
f"Wrong length detected of row: {totnum}. Are attributes set correct?"
)
dfr.dropna()
dfr = dfr.astype(np.float64)
Expand Down
12 changes: 4 additions & 8 deletions src/xtgeo/xyz/points.py
Original file line number Diff line number Diff line change
Expand Up @@ -447,24 +447,20 @@ def _dataframe_consistency_check(self):
dataframe = self.get_dataframe(copy=False)
if self.xname not in dataframe:
raise ValueError(
f"xname={self.xname} is not a column "
f"of dataframe {dataframe.columns}"
f"xname={self.xname} is not a column of dataframe {dataframe.columns}"
)
if self.yname not in dataframe:
raise ValueError(
f"yname={self.yname} is not a column "
f"of dataframe {dataframe.columns}"
f"yname={self.yname} is not a column of dataframe {dataframe.columns}"
)
if self.zname not in dataframe:
raise ValueError(
f"zname={self.zname} is not a column "
f"of dataframe {dataframe.columns}"
f"zname={self.zname} is not a column of dataframe {dataframe.columns}"
)
for attr in self._attrs:
if attr not in dataframe:
raise ValueError(
f"Attribute {attr} is not a column "
f"of dataframe {dataframe.columns}"
f"Attribute {attr} is not a column of dataframe {dataframe.columns}"
)

def __repr__(self):
Expand Down
6 changes: 3 additions & 3 deletions tests/test_grid3d/test_ecl_inte_head.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ def test_intehead_iphs_when_e300():
intehead_values = [0] * 100
intehead_values[94] = 300 # simulator is Ecl 300
intehead_values[14] = 8 # 14 is IPHS code in E100 but no. tracers in E300, here 8
assert (
InteHead(intehead_values).phases == Phases.OIL_WATER_GAS
), "phases always OIL_WATER_GAS in Eclipse 300"
assert InteHead(intehead_values).phases == Phases.OIL_WATER_GAS, (
"phases always OIL_WATER_GAS in Eclipse 300"
)


def test_intehead_iphs_fail_when_outsiderange_e100():
Expand Down
2 changes: 1 addition & 1 deletion tests/test_grid3d/test_grdecl_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def test_read_extra_keyword_characters():

def test_read_long_keyword():
very_long_keyword = "a" * 200
file_data = f"{very_long_keyword} Eclipse comment\n" "1 2 3 4 /"
file_data = f"{very_long_keyword} Eclipse comment\n1 2 3 4 /"
with (
patch(
"builtins.open",
Expand Down
2 changes: 1 addition & 1 deletion tests/test_opm_integration/test_gridprop_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def deck_contents(self):
0.5 2.0E-6 0.1 0.0
1.0 1.0E-5 0.0 0.0 /
PVTW
{self.convert_pressure(270.0)} 1.0 {1.0 / self.convert_pressure(1.0 / 5.0E-5)} 0.3 0.0 /
{self.convert_pressure(270.0)} 1.0 {1.0 / self.convert_pressure(1.0 / 5.0e-5)} 0.3 0.0 /
DENSITY
{self.convert_density(860.0)}
{self.convert_density(1030.0)}
Expand Down

0 comments on commit 294eaa5

Please sign in to comment.