From b06ccbedf82251e95be8a533cf9415945e414e53 Mon Sep 17 00:00:00 2001 From: mferrera Date: Fri, 1 Mar 2024 07:39:44 +0100 Subject: [PATCH] CLN: format with latest ruff --- bin/xtgls.py | 1 + examples/grid3d_prop_as_map.py | 1 + examples/surface_slice_grid3d.py | 1 + src/xtgeo/grid3d/_grdecl_grid.py | 1 + src/xtgeo/grid3d/_grid3d_fence.py | 1 + src/xtgeo/grid3d/_grid_import_ecl.py | 1 + src/xtgeo/grid3d/_grid_import_roff.py | 1 + src/xtgeo/grid3d/_grid_import_xtgcpgeom.py | 7 +++---- src/xtgeo/grid3d/_grid_refine.py | 1 + src/xtgeo/grid3d/_grid_wellzone.py | 1 + src/xtgeo/grid3d/_gridprop_import_grdecl.py | 1 + src/xtgeo/grid3d/_gridprop_lowlevel.py | 1 + src/xtgeo/grid3d/_gridprop_op1.py | 1 + src/xtgeo/grid3d/_gridprop_roxapi.py | 1 + src/xtgeo/surface/_regsurf_roxapi.py | 1 + src/xtgeo/surface/regular_surface.py | 1 - src/xtgeo/xyz/__init__.py | 1 - src/xtgeo/xyz/_xyz_oper.py | 1 - src/xtgeo/xyz/_xyz_roxapi.py | 1 + tests/test_grid3d/test_grid_property_etc.py | 1 + tests/test_grid3d/test_grid_property_roff.py | 4 ++-- tests/test_grid3d/test_grid_xtgformats_io.py | 1 + 22 files changed, 22 insertions(+), 9 deletions(-) diff --git a/bin/xtgls.py b/bin/xtgls.py index 4b53e06fc..5b9c019a6 100644 --- a/bin/xtgls.py +++ b/bin/xtgls.py @@ -1,4 +1,5 @@ """xtgls: a small script for listing xtg formatted files.""" + import argparse import json import pathlib diff --git a/examples/grid3d_prop_as_map.py b/examples/grid3d_prop_as_map.py index e2a800500..08e5a3ab8 100644 --- a/examples/grid3d_prop_as_map.py +++ b/examples/grid3d_prop_as_map.py @@ -2,6 +2,7 @@ Make a regularmap from a property at a given K layer By JRIV """ + import os import xtgeo diff --git a/examples/surface_slice_grid3d.py b/examples/surface_slice_grid3d.py index 6b276a7b0..3cdc544f6 100644 --- a/examples/surface_slice_grid3d.py +++ b/examples/surface_slice_grid3d.py @@ -7,6 +7,7 @@ JRIV """ + import os import pathlib import tempfile diff --git a/src/xtgeo/grid3d/_grdecl_grid.py b/src/xtgeo/grid3d/_grdecl_grid.py index 0cd889963..3d2c74759 100644 --- a/src/xtgeo/grid3d/_grdecl_grid.py +++ b/src/xtgeo/grid3d/_grdecl_grid.py @@ -20,6 +20,7 @@ of how these keywords are layed out in a text file, and see GrdeclGrid for how the grid geometry is interpreted from these keywords. """ + from __future__ import annotations from dataclasses import dataclass diff --git a/src/xtgeo/grid3d/_grid3d_fence.py b/src/xtgeo/grid3d/_grid3d_fence.py index 79db6ee00..0b534a893 100644 --- a/src/xtgeo/grid3d/_grid3d_fence.py +++ b/src/xtgeo/grid3d/_grid3d_fence.py @@ -1,4 +1,5 @@ """Some grid utilities, file scanning etc.""" + from __future__ import annotations from typing import TYPE_CHECKING diff --git a/src/xtgeo/grid3d/_grid_import_ecl.py b/src/xtgeo/grid3d/_grid_import_ecl.py index a6cdd623b..5b3f41309 100644 --- a/src/xtgeo/grid3d/_grid_import_ecl.py +++ b/src/xtgeo/grid3d/_grid_import_ecl.py @@ -1,4 +1,5 @@ """Grid import functions for Eclipse, new approach (i.e. version 2).""" + from __future__ import annotations from typing import TYPE_CHECKING, Any diff --git a/src/xtgeo/grid3d/_grid_import_roff.py b/src/xtgeo/grid3d/_grid_import_roff.py index 755ad213f..c951a4d44 100644 --- a/src/xtgeo/grid3d/_grid_import_roff.py +++ b/src/xtgeo/grid3d/_grid_import_roff.py @@ -1,4 +1,5 @@ """Private module, Grid Import private functions for ROFF format.""" + from __future__ import annotations import pathlib diff --git a/src/xtgeo/grid3d/_grid_import_xtgcpgeom.py b/src/xtgeo/grid3d/_grid_import_xtgcpgeom.py index 75feb3b1e..50662242c 100644 --- a/src/xtgeo/grid3d/_grid_import_xtgcpgeom.py +++ b/src/xtgeo/grid3d/_grid_import_xtgcpgeom.py @@ -1,4 +1,5 @@ """Private module, Grid Import private functions for xtgeo based formats.""" + from __future__ import annotations import json @@ -52,13 +53,11 @@ class _META(TypedDict): @overload -def convert_subgrids(sdict: dict[str, int]) -> dict[str, range]: - ... +def convert_subgrids(sdict: dict[str, int]) -> dict[str, range]: ... @overload -def convert_subgrids(sdict: None) -> None: - ... +def convert_subgrids(sdict: None) -> None: ... def convert_subgrids(sdict: dict[str, int] | None) -> dict[str, range] | None: diff --git a/src/xtgeo/grid3d/_grid_refine.py b/src/xtgeo/grid3d/_grid_refine.py index 773db9cb5..63ea91d87 100644 --- a/src/xtgeo/grid3d/_grid_refine.py +++ b/src/xtgeo/grid3d/_grid_refine.py @@ -1,4 +1,5 @@ """Private module for refinement of a grid.""" + from __future__ import annotations from typing import TYPE_CHECKING diff --git a/src/xtgeo/grid3d/_grid_wellzone.py b/src/xtgeo/grid3d/_grid_wellzone.py index 13061c29d..1a7748d35 100644 --- a/src/xtgeo/grid3d/_grid_wellzone.py +++ b/src/xtgeo/grid3d/_grid_wellzone.py @@ -1,4 +1,5 @@ """Private module for grid vs well zonelog checks.""" + from __future__ import annotations from typing import TYPE_CHECKING, Literal diff --git a/src/xtgeo/grid3d/_gridprop_import_grdecl.py b/src/xtgeo/grid3d/_gridprop_import_grdecl.py index 5430d74f8..6ba5ade56 100644 --- a/src/xtgeo/grid3d/_gridprop_import_grdecl.py +++ b/src/xtgeo/grid3d/_gridprop_import_grdecl.py @@ -1,4 +1,5 @@ """Importing grid props from GRDECL, ascii or binary""" + from __future__ import annotations from typing import TYPE_CHECKING, Any diff --git a/src/xtgeo/grid3d/_gridprop_lowlevel.py b/src/xtgeo/grid3d/_gridprop_lowlevel.py index 65758a574..c2d79605d 100644 --- a/src/xtgeo/grid3d/_gridprop_lowlevel.py +++ b/src/xtgeo/grid3d/_gridprop_lowlevel.py @@ -1,4 +1,5 @@ """GridProperty (not GridProperies) low level functions""" + from __future__ import annotations from typing import TYPE_CHECKING, Literal diff --git a/src/xtgeo/grid3d/_gridprop_op1.py b/src/xtgeo/grid3d/_gridprop_op1.py index aaecf8a49..ca5dc4b3a 100644 --- a/src/xtgeo/grid3d/_gridprop_op1.py +++ b/src/xtgeo/grid3d/_gridprop_op1.py @@ -1,4 +1,5 @@ """Various grid property operations""" + from __future__ import annotations from typing import TYPE_CHECKING, List, Literal, Optional, Tuple, Union diff --git a/src/xtgeo/grid3d/_gridprop_roxapi.py b/src/xtgeo/grid3d/_gridprop_roxapi.py index 05b9e2c73..466668c3a 100644 --- a/src/xtgeo/grid3d/_gridprop_roxapi.py +++ b/src/xtgeo/grid3d/_gridprop_roxapi.py @@ -1,5 +1,6 @@ # coding: utf-8 """Roxar API functions for XTGeo Grid Property.""" + from __future__ import annotations import contextlib diff --git a/src/xtgeo/surface/_regsurf_roxapi.py b/src/xtgeo/surface/_regsurf_roxapi.py index 97c5abbc5..ad952439c 100644 --- a/src/xtgeo/surface/_regsurf_roxapi.py +++ b/src/xtgeo/surface/_regsurf_roxapi.py @@ -1,5 +1,6 @@ # coding: utf-8 """Roxar API functions for XTGeo RegularSurface.""" + import os import tempfile diff --git a/src/xtgeo/surface/regular_surface.py b/src/xtgeo/surface/regular_surface.py index 448bd6c3e..2b7ebe223 100644 --- a/src/xtgeo/surface/regular_surface.py +++ b/src/xtgeo/surface/regular_surface.py @@ -32,7 +32,6 @@ # For functions with mask=... ,the should be replaced with asmasked=... # -------------------------------------------------------------------------------------- - from __future__ import annotations import functools diff --git a/src/xtgeo/xyz/__init__.py b/src/xtgeo/xyz/__init__.py index a0c543f4e..b5d8ad4d4 100644 --- a/src/xtgeo/xyz/__init__.py +++ b/src/xtgeo/xyz/__init__.py @@ -1,6 +1,5 @@ """The XTGeo xyz (points and polygons) package.""" - # flake8: noqa from xtgeo.xyz._xyz import XYZ from xtgeo.xyz.points import Points diff --git a/src/xtgeo/xyz/_xyz_oper.py b/src/xtgeo/xyz/_xyz_oper.py index aa35fee5b..31d93de16 100644 --- a/src/xtgeo/xyz/_xyz_oper.py +++ b/src/xtgeo/xyz/_xyz_oper.py @@ -1,7 +1,6 @@ # coding: utf-8 """Various operations on XYZ data""" - import numpy as np import pandas as pd import shapely.geometry as sg diff --git a/src/xtgeo/xyz/_xyz_roxapi.py b/src/xtgeo/xyz/_xyz_roxapi.py index 5e142d7c1..35d487899 100644 --- a/src/xtgeo/xyz/_xyz_roxapi.py +++ b/src/xtgeo/xyz/_xyz_roxapi.py @@ -1,5 +1,6 @@ # coding: utf-8 """Roxar API functions for XTGeo Points/Polygons""" + from __future__ import annotations import os diff --git a/tests/test_grid3d/test_grid_property_etc.py b/tests/test_grid3d/test_grid_property_etc.py index e8d006620..9437cb009 100644 --- a/tests/test_grid3d/test_grid_property_etc.py +++ b/tests/test_grid3d/test_grid_property_etc.py @@ -1,5 +1,6 @@ # coding: utf-8 """Testing: test_grid_property more special functions""" + import pytest from xtgeo.grid3d import _gridprop_roxapi diff --git a/tests/test_grid3d/test_grid_property_roff.py b/tests/test_grid3d/test_grid_property_roff.py index d259e2308..b777a6e76 100644 --- a/tests/test_grid3d/test_grid_property_roff.py +++ b/tests/test_grid3d/test_grid_property_roff.py @@ -152,7 +152,7 @@ def test_xtgeo_codes(param, expected_codes): def test_to_file(tmp_path): - roff_param = RoffParameter(1, 1, 2, "", b"\x01\xFF") + roff_param = RoffParameter(1, 1, 2, "", b"\x01\xff") roff_param.to_file(tmp_path / "param.roff") vals = roffio.read(tmp_path / "param.roff") assert vals["parameter"] == {"name": "", "data": b"\x01\xff"} @@ -166,7 +166,7 @@ def test_to_file_codes(): 1, 2, "a", - b"\x01\xFF", + b"\x01\xff", code_names=["a", "b"], code_values=np.array([1, 2], dtype=np.int32), ) diff --git a/tests/test_grid3d/test_grid_xtgformats_io.py b/tests/test_grid3d/test_grid_xtgformats_io.py index 0effd45eb..af5cc3855 100644 --- a/tests/test_grid3d/test_grid_xtgformats_io.py +++ b/tests/test_grid3d/test_grid_xtgformats_io.py @@ -1,5 +1,6 @@ # coding: utf-8 """Testing new xtgf and hdf5/h5 formats.""" + from os.path import join import hypothesis.strategies as st