diff --git a/pyproject.toml b/pyproject.toml index 7b46e4abd..100d53301 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -139,6 +139,7 @@ select = [ "E", "F", "I", + "PIE", "W", # "C90", # "NPY", diff --git a/src/xtgeo/grid3d/_egrid.py b/src/xtgeo/grid3d/_egrid.py index fd785a2b2..4f962e9e0 100644 --- a/src/xtgeo/grid3d/_egrid.py +++ b/src/xtgeo/grid3d/_egrid.py @@ -80,8 +80,6 @@ class EGridFileFormatError(ValueError): format. """ - pass - @unique class RockModel(Enum): diff --git a/src/xtgeo/grid3d/_grid_etc1.py b/src/xtgeo/grid3d/_grid_etc1.py index 5fa1054eb..978b20b87 100644 --- a/src/xtgeo/grid3d/_grid_etc1.py +++ b/src/xtgeo/grid3d/_grid_etc1.py @@ -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) diff --git a/src/xtgeo/surface/_zmap_parser.py b/src/xtgeo/surface/_zmap_parser.py index 4519ea8f4..732f2a819 100644 --- a/src/xtgeo/surface/_zmap_parser.py +++ b/src/xtgeo/surface/_zmap_parser.py @@ -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 diff --git a/tests/test_common/test_system.py b/tests/test_common/test_system.py index bcc050de6..9ae133e88 100644 --- a/tests/test_common/test_system.py +++ b/tests/test_common/test_system.py @@ -2,6 +2,7 @@ import io import pathlib import sys +from collections import ChainMap import pytest import xtgeo @@ -118,9 +119,9 @@ 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", @@ -128,7 +129,7 @@ def test_file_splitext(filename, stem, extension, obj): pathlib.Path("3dgrids/reek/reek_geogrid.roffasc"): "roff_ascii", pathlib.Path("wells/battle/1/WELL12.rmswell"): "rmswell", }, -} +) def test_xtgeo_file_reinstance(tmp_path): diff --git a/tests/test_etc/test_docstring.py b/tests/test_etc/test_docstring.py index 01a3450f6..524860209 100644 --- a/tests/test_etc/test_docstring.py +++ b/tests/test_etc/test_docstring.py @@ -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" @@ -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" diff --git a/tests/test_grid3d/test_grid_dual_index.py b/tests/test_grid3d/test_grid_dual_index.py index 29df84d9e..9d427ce3b 100644 --- a/tests/test_grid3d/test_grid_dual_index.py +++ b/tests/test_grid3d/test_grid_dual_index.py @@ -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)], } diff --git a/tests/test_surface/test_deprecation.py b/tests/test_surface/test_deprecation.py index 2d7ba8e52..6a4224112 100644 --- a/tests/test_surface/test_deprecation.py +++ b/tests/test_surface/test_deprecation.py @@ -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 diff --git a/tests/test_surface/test_regular_surface.py b/tests/test_surface/test_regular_surface.py index 59f524faa..9be57674b 100644 --- a/tests/test_surface/test_regular_surface.py +++ b/tests/test_surface/test_regular_surface.py @@ -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") diff --git a/tests/test_surface/test_surfaces.py b/tests/test_surface/test_surfaces.py index 4a9538442..c1f0ce5dd 100644 --- a/tests/test_surface/test_surfaces.py +++ b/tests/test_surface/test_surfaces.py @@ -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