From bdf617261ec8654ee28407ba6dd7ef56394f048e Mon Sep 17 00:00:00 2001 From: larsevj Date: Sun, 25 Aug 2024 18:04:16 +0200 Subject: [PATCH] Some fixups --- pyproject.toml | 1 + python/resdata/grid/faults/fault_block_layer.py | 2 +- python/resdata/grid/rd_region.py | 4 ++-- python/resdata/resfile/rd_kw.py | 4 ++-- python/tests/rd_tests/test_npv.py | 5 ----- python/tests/rd_tests/test_rd_kw.py | 3 +-- python/tests/rd_tests/test_sum_equinor.py | 2 -- 7 files changed, 7 insertions(+), 14 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 24c3f4e65..cac854ab4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,6 +4,7 @@ requires = ["setuptools", "setuptools_scm", "wheel", "scikit-build", "cmake", "c [tool.ruff] src = ["python"] line-length = 88 +target-version = "py38" [tool.ruff.lint] select = [ diff --git a/python/resdata/grid/faults/fault_block_layer.py b/python/resdata/grid/faults/fault_block_layer.py index a2a4a175d..cb5d177fa 100644 --- a/python/resdata/grid/faults/fault_block_layer.py +++ b/python/resdata/grid/faults/fault_block_layer.py @@ -126,7 +126,7 @@ def load_keyword(self, fault_block_kw): raise ValueError( "The fault block keyword had wrong type/size: type:%s size:%d grid_size:%d" % ( - fault_block_kw.typeName(), + fault_block_kw.type_name, len(fault_block_kw), self.grid_ref.getGlobalSize(), ) diff --git a/python/resdata/grid/rd_region.py b/python/resdata/grid/rd_region.py index 28f2d1ada..8955338ea 100644 --- a/python/resdata/grid/rd_region.py +++ b/python/resdata/grid/rd_region.py @@ -552,7 +552,7 @@ def select_equal(self, rd_kw, value, intersect=False): if not rd_kw.data_type.is_int(): raise ValueError( "The select_equal method must have an integer valued keyword - got:%s" - % rd_kw.typeName() + % rd_kw.type_name ) self._select_equal(rd_kw, value) @@ -565,7 +565,7 @@ def deselect_equal(self, rd_kw, value): if not rd_kw.data_type.is_int(): raise ValueError( "The select_equal method must have an integer valued keyword - got:%s" - % rd_kw.typeName() + % rd_kw.type_name ) self._deselect_equal(rd_kw, value) diff --git a/python/resdata/resfile/rd_kw.py b/python/resdata/resfile/rd_kw.py index 8613c832e..71f69416c 100644 --- a/python/resdata/resfile/rd_kw.py +++ b/python/resdata/resfile/rd_kw.py @@ -991,7 +991,7 @@ def get_rd_type(self): @property def header(self): - return (self.getName(), len(self), self.typeName()) + return (self.get_name(), len(self), self.type_name) @property def array(self): @@ -1033,7 +1033,7 @@ def str(self, width=5, max_lines=10, fmt=None): the elements. The implementation of the builtin method __str__() is based on this method. """ - s = "%-8s %8d %-4s\n" % (self.getName(), len(self), self.typeName()) + s = "%-8s %8d %-4s\n" % (self.get_name(), len(self), self.type_name) lines = len(self) // width if not fmt: fmt = self.str_fmt + " " diff --git a/python/tests/rd_tests/test_npv.py b/python/tests/rd_tests/test_npv.py index ee4f23932..353f988c6 100644 --- a/python/tests/rd_tests/test_npv.py +++ b/python/tests/rd_tests/test_npv.py @@ -3,11 +3,6 @@ import datetime import math -try: - from unittest2 import skipIf, skipUnless, skipIf -except ImportError: - from unittest import skipIf, skipUnless, skipIf - from resdata.summary import Summary from resdata.summary import ResdataNPV, NPVPriceVector diff --git a/python/tests/rd_tests/test_rd_kw.py b/python/tests/rd_tests/test_rd_kw.py index b8f86f2e1..914cfb2e7 100644 --- a/python/tests/rd_tests/test_rd_kw.py +++ b/python/tests/rd_tests/test_rd_kw.py @@ -2,7 +2,6 @@ import random import warnings import cwrap -import random from resdata import ResDataType, ResdataTypeEnum, FileMode from resdata.resfile import ResdataKW, ResdataFile, FortIO, openFortIO @@ -423,7 +422,7 @@ def test_resize(self): def test_typename(self): kw = ResdataKW("KW", 100, ResDataType.RD_INT) - self.assertEqual(kw.typeName(), "INTE") + self.assertEqual(kw.type_name, "INTE") def test_string_alloc(self): kw = ResdataKW("KW", 10, ResDataType.RD_STRING(30)) diff --git a/python/tests/rd_tests/test_sum_equinor.py b/python/tests/rd_tests/test_sum_equinor.py index 17d05d2d3..fb0f900ff 100755 --- a/python/tests/rd_tests/test_sum_equinor.py +++ b/python/tests/rd_tests/test_sum_equinor.py @@ -1,8 +1,6 @@ import os import datetime -from unittest import skipIf, skipUnless, skipIf - from resdata.resfile import ResdataFile from resdata.summary import Summary from resdata import UnitSystem