Skip to content

Commit

Permalink
CLN: Ruff pie
Browse files Browse the repository at this point in the history
  • Loading branch information
JB Lovland authored and janbjorge committed Dec 6, 2023
1 parent 8e46e37 commit d88dd55
Show file tree
Hide file tree
Showing 10 changed files with 13 additions and 15 deletions.
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ select = [
"E",
"F",
"I",
"PIE",
"W",
# "C90",
# "NPY",
Expand Down
2 changes: 0 additions & 2 deletions src/xtgeo/grid3d/_egrid.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,6 @@ class EGridFileFormatError(ValueError):
format.
"""

pass


@unique
class RockModel(Enum):
Expand Down
2 changes: 1 addition & 1 deletion src/xtgeo/grid3d/_grid_etc1.py
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ def get_xyz_corners(self, names=("X_UTME", "Y_UTMN", "Z_TVDSS")):

grid_props = []

for i in range(0, 8):
for i in range(8):
xname = names[0] + str(i)
yname = names[1] + str(i)
zname = names[2] + str(i)
Expand Down
2 changes: 1 addition & 1 deletion src/xtgeo/surface/_zmap_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def parse_header(zmap_data):


def is_comment(line):
if line.startswith("!") or line.startswith("+"):
if line.startswith(("!", "+")):
return True
return False

Expand Down
9 changes: 5 additions & 4 deletions tests/test_common/test_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import io
import pathlib
import sys
from collections import ChainMap

import pytest
import xtgeo
Expand Down Expand Up @@ -118,17 +119,17 @@ def test_file_splitext(filename, stem, extension, obj):
assert (stem, extension) == xtgeo_file.splitext(lower=False)


files_formats = {
**surface_files_formats,
**{
files_formats = ChainMap(
surface_files_formats,
{
pathlib.Path("3dgrids/reek/REEK.EGRID"): "egrid",
pathlib.Path("3dgrids/reek/REEK.UNRST"): "unrst",
pathlib.Path("3dgrids/reek/REEK.INIT"): "init",
pathlib.Path("3dgrids/reek/reek_geo_grid.roff"): "roff_binary",
pathlib.Path("3dgrids/reek/reek_geogrid.roffasc"): "roff_ascii",
pathlib.Path("wells/battle/1/WELL12.rmswell"): "rmswell",
},
}
)


def test_xtgeo_file_reinstance(tmp_path):
Expand Down
2 changes: 0 additions & 2 deletions tests/test_etc/test_docstring.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ class SubClass(SuperClass):
@inherit_docstring(inherit_from=SuperClass.my_function)
def my_function(self):
"""I have a different doc string"""
pass

assert SubClass.my_function.__doc__ == "I have a different doc string"

Expand All @@ -34,6 +33,5 @@ class SubClass(SuperClass):
@inherit_docstring(inherit_from=SuperClass.my_function)
def my_function(self):
"""I have a doc string"""
pass

assert SubClass.my_function.__doc__ == "I have a doc string"
4 changes: 2 additions & 2 deletions tests/test_grid3d/test_grid_dual_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,11 @@ def rsg_grid_mock():
mock_grid.zone_names = ["0", "1"]

mock_grid.grid_indexer.zonation = {
0: [range(0, 1), range(2, 3)],
0: [range(1), range(2, 3)],
1: [range(1, 2), range(3, 4)],
}
mock_grid.simbox_indexer.zonation = {
0: [range(0, 1)],
0: [range(1)],
1: [range(1, 2)],
}

Expand Down
2 changes: 1 addition & 1 deletion tests/test_surface/test_deprecation.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def test_default_init_deprecation(missing_arg, expected_warning):
@fail_if_not_removed(version_limit="4")
def test_default_values_deprecation():
with pytest.warns(DeprecationWarning, match="Default values") as record:
xtgeo.RegularSurface(**{"ncol": 5, "nrow": 3, "xinc": 25.0, "yinc": 25.0})
xtgeo.RegularSurface(ncol=5, nrow=3, xinc=25.0, yinc=25.0)
assert len(record) == 1


Expand Down
2 changes: 1 addition & 1 deletion tests/test_surface/test_regular_surface.py
Original file line number Diff line number Diff line change
Expand Up @@ -920,7 +920,7 @@ def test_irapbin_io_loop(tmpdir):

num = 10

for _i in range(0, num):
for _i in range(num):
# print(i)
x = xtgeo.surface_from_file(TESTSET1, fformat="irap_binary")

Expand Down
2 changes: 1 addition & 1 deletion tests/test_surface/test_surfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def test_more_statistics(constant_map_surfaces):
res = constant_map_surfaces.statistics()
# theoretical stdev:
sum2 = 0.0
for inum in range(0, 101):
for inum in range(101):
sum2 += (float(inum) - 50.0) ** 2
stdev = math.sqrt(sum2 / 100.0) # total 101 samples, use N-1

Expand Down

0 comments on commit d88dd55

Please sign in to comment.