diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 2365ccd02..1ccb9fc95 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -33,21 +33,17 @@ jobs: pip install -v --editable '.[lint,test]' pip install "coveralls>=3.0.0" - - name: black check + - name: ruff linter run: | - python -m black --check --diff --color . + python -m ruff check src/gstools/ - - name: black preview + - name: ruff import check run: | - python -m black --preview --diff --color . + python -m ruff check --select I --diff src/gstools/ - - name: isort check + - name: ruff format check run: | - python -m isort --check --diff --color . - - - name: pylint check - run: | - python -m pylint src/gstools/ + python -m ruff format --diff src/gstools/ - name: coveralls check run: | diff --git a/CHANGELOG.md b/CHANGELOG.md index e9662a94e..ba0713144 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ All notable changes to **GSTools** will be documented in this file. +## [Unreleased] - ? + +### Changes + +- replace pylint, black, and isort with ruff [#391](https://github.com/GeoStat-Framework/GSTools/pull/391) + ## [1.7.0] - Morphic Mint - 2025-04 ### Enhancements diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index dd797f0a8..dbe9e88eb 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -29,8 +29,10 @@ with your idea or suggestion and we'd love to discuss about it. - Fork the repo on [GitHub](https://github.com/GeoStat-Framework/GSTools) - Add yourself to AUTHORS.md (if you want to). -- We use [black](https://github.com/psf/black) and [isort](https://github.com/PyCQA/isort) to format our code. - Please use the scripts `black .` and `isort .` after you have written your code. +- We use [Ruff](https://github.com/psf/black) to check and format the code. + Please use the scripts `ruff check src/gstools`, + `ruff check --select I --fix src/gstools/`, and + `ruff format --diff src/gstools/` after you have written your code. - Add some tests if possible. - Add an example showing your new feature in one of the examples sub-folders if possible. Follow this [Sphinx-Gallary guide](https://sphinx-gallery.github.io/stable/syntax.html#embed-rst-in-your-example-python-files). diff --git a/examples/01_random_field/05_mesh_ensemble.py b/examples/01_random_field/05_mesh_ensemble.py index 1e2f0da86..2ae9a760b 100755 --- a/examples/01_random_field/05_mesh_ensemble.py +++ b/examples/01_random_field/05_mesh_ensemble.py @@ -13,21 +13,18 @@ - `points="points"` will generate a field on the mesh points - `points="centroids"` will generate a field on the cell centroids - -In this example, we will generate a simple mesh with the aid of -`meshzoo `_. """ import matplotlib.pyplot as plt import matplotlib.tri as tri import meshio -import meshzoo import numpy as np import gstools as gs -# generate a triangulated hexagon with meshzoo -points, cells = meshzoo.ngon(6, 4) +# read a triangulated hexagon +points = np.load("hexagon_points.npy") +cells = np.load("hexagon_cells.npy") mesh = meshio.Mesh(points, {"triangle": cells}) ############################################################################### diff --git a/examples/01_random_field/hexagon_cells.npy b/examples/01_random_field/hexagon_cells.npy new file mode 100644 index 000000000..b04f21cc0 Binary files /dev/null and b/examples/01_random_field/hexagon_cells.npy differ diff --git a/examples/01_random_field/hexagon_points.npy b/examples/01_random_field/hexagon_points.npy new file mode 100644 index 000000000..0179d4ff7 Binary files /dev/null and b/examples/01_random_field/hexagon_points.npy differ diff --git a/pyproject.toml b/pyproject.toml index 3e09aaf69..27b2c53b4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -58,7 +58,6 @@ dependencies = [ doc = [ "myst_parser", "matplotlib>=3.7", - "meshzoo>=0.7", "numpydoc>=1.1", "pykrige>=1.5,<2", "pyvista>=0.40", @@ -71,13 +70,9 @@ plotting = [ "matplotlib>=3.7", "pyvista>=0.40", ] -rust = ["gstools_core>=1.0.0"] +rust = ["gstools_core>=1.1.0"] test = ["pytest-cov>=3"] -lint = [ - "black>=24", - "pylint", - "isort[colors]", -] +lint = ["ruff"] [project.urls] Changelog = "https://github.com/GeoStat-Framework/GSTools/blob/main/CHANGELOG.md" @@ -107,21 +102,9 @@ include = [ [tool.hatch.build.targets.wheel] packages = ["src/gstools"] -[tool.isort] -profile = "black" -multi_line_output = 3 -line_length = 79 - -[tool.black] +[tool.ruff] line-length = 79 -target-version = [ - "py38", - "py39", - "py310", - "py311", - "py312", - "py313", -] +target-version = "py38" [tool.coverage] [tool.coverage.run] @@ -140,32 +123,3 @@ target-version = [ "def __repr__", "def __str__", ] - -[tool.pylint] - [tool.pylint.main] - extension-pkg-whitelist = [ - "numpy", - "scipy", - "gstools_core", - ] - ignore = "_version.py" - load-plugins = [ - "pylint.extensions.no_self_use", - ] - - [tool.pylint.message_control] - disable = [ - "R0801", - ] - - [tool.pylint.reports] - output-format = "colorized" - - [tool.pylint.design] - max-args = 20 - max-locals = 50 - max-branches = 30 - max-statements = 85 - max-attributes = 30 - max-public-methods = 80 - max-positional-arguments=20 diff --git a/src/gstools/__init__.py b/src/gstools/__init__.py index c13f3e5a4..4d12007c9 100644 --- a/src/gstools/__init__.py +++ b/src/gstools/__init__.py @@ -236,6 +236,7 @@ "Krige", "SRF", "CondSRF", + "PGS", "rotated_main_axes", "generate_grid", "generate_st_grid", diff --git a/src/gstools/config.py b/src/gstools/config.py index 9c399f687..3870ac1e1 100644 --- a/src/gstools/config.py +++ b/src/gstools/config.py @@ -7,9 +7,8 @@ NUM_THREADS = None -# pylint: disable=W0611 try: # pragma: no cover - import gstools_core + import gstools_core # noqa: F401 _GSTOOLS_CORE_AVAIL = True USE_GSTOOLS_CORE = True diff --git a/src/gstools/covmodel/base.py b/src/gstools/covmodel/base.py index 53a925f09..8e3b2ae3f 100644 --- a/src/gstools/covmodel/base.py +++ b/src/gstools/covmodel/base.py @@ -10,7 +10,6 @@ SumModel """ -# pylint: disable=C0103, R0201, E1101, C0302, W0613, W0231 import copy import numpy as np diff --git a/src/gstools/covmodel/fit.py b/src/gstools/covmodel/fit.py index 8ad510de4..bb882bf04 100755 --- a/src/gstools/covmodel/fit.py +++ b/src/gstools/covmodel/fit.py @@ -9,7 +9,6 @@ fit_variogram """ -# pylint: disable=C0103, W0632 import numpy as np from scipy.optimize import curve_fit diff --git a/src/gstools/covmodel/models.py b/src/gstools/covmodel/models.py index cb495751f..3c47b351c 100644 --- a/src/gstools/covmodel/models.py +++ b/src/gstools/covmodel/models.py @@ -22,7 +22,6 @@ JBessel """ -# pylint: disable=C0103, C0302, E1101, R0201 import warnings import numpy as np diff --git a/src/gstools/covmodel/plot.py b/src/gstools/covmodel/plot.py index f7fa58db5..ce35f9bf8 100644 --- a/src/gstools/covmodel/plot.py +++ b/src/gstools/covmodel/plot.py @@ -25,7 +25,6 @@ plot_spectral_rad_pdf """ -# pylint: disable=C0103, C0415, E1130 import numpy as np from gstools.tools.geometric import generate_grid diff --git a/src/gstools/covmodel/sum_tools.py b/src/gstools/covmodel/sum_tools.py index 253ee5a4b..37bdb98e8 100644 --- a/src/gstools/covmodel/sum_tools.py +++ b/src/gstools/covmodel/sum_tools.py @@ -17,7 +17,6 @@ sum_model_repr """ -# pylint: disable=W0212 import numpy as np from gstools.tools import RADIAN_SCALE diff --git a/src/gstools/covmodel/tools.py b/src/gstools/covmodel/tools.py index cfba8259a..1d26d0628 100644 --- a/src/gstools/covmodel/tools.py +++ b/src/gstools/covmodel/tools.py @@ -22,7 +22,6 @@ model_repr """ -# pylint: disable=C0103, W0212 import warnings import numpy as np diff --git a/src/gstools/covmodel/tpl_models.py b/src/gstools/covmodel/tpl_models.py index 40ed4ec8e..46472d1b7 100644 --- a/src/gstools/covmodel/tpl_models.py +++ b/src/gstools/covmodel/tpl_models.py @@ -12,7 +12,6 @@ TPLSimple """ -# pylint: disable=C0103, E1101 import warnings import numpy as np diff --git a/src/gstools/field/base.py b/src/gstools/field/base.py index 2006b8587..247d17e77 100755 --- a/src/gstools/field/base.py +++ b/src/gstools/field/base.py @@ -9,7 +9,6 @@ Field """ -# pylint: disable=C0103, C0415 from collections.abc import Iterable from copy import copy from functools import partial diff --git a/src/gstools/field/cond_srf.py b/src/gstools/field/cond_srf.py index c3e03fe29..aad26dba3 100644 --- a/src/gstools/field/cond_srf.py +++ b/src/gstools/field/cond_srf.py @@ -9,8 +9,6 @@ CondSRF """ -# pylint: disable=C0103, W0231, W0221, W0222, E1102 - import numpy as np from gstools.field.base import Field diff --git a/src/gstools/field/generator.py b/src/gstools/field/generator.py index a260163c0..d65cc3cd7 100755 --- a/src/gstools/field/generator.py +++ b/src/gstools/field/generator.py @@ -14,7 +14,6 @@ Fourier """ -# pylint: disable=C0103, W0222, C0412, W0231 import warnings from abc import ABC, abstractmethod from copy import deepcopy as dcp @@ -29,8 +28,7 @@ from gstools.random.rng import RNG from gstools.tools.geometric import generate_grid -if config._GSTOOLS_CORE_AVAIL: # pylint: disable=W0212; # pragma: no cover - # pylint: disable=E0401 +if config._GSTOOLS_CORE_AVAIL: # pragma: no cover from gstools_core import summate as summate_gsc from gstools_core import summate_fourier as summate_fourier_gsc from gstools_core import summate_incompr as summate_incompr_gsc @@ -43,11 +41,8 @@ def _summate(cov_samples, z_1, z_2, pos, num_threads=None): """A wrapper function for calling the randomization algorithms.""" - if ( - config.USE_GSTOOLS_CORE - and config._GSTOOLS_CORE_AVAIL # pylint: disable=W0212 - ): - summate_fct = summate_gsc # pylint: disable=E0606 + if config.USE_GSTOOLS_CORE and config._GSTOOLS_CORE_AVAIL: + summate_fct = summate_gsc else: summate_fct = summate_c return summate_fct(cov_samples, z_1, z_2, pos, num_threads) @@ -62,11 +57,8 @@ def _summate_incompr( ): """A wrapper function for calling the incompr. randomization algorithms.""" - if ( - config.USE_GSTOOLS_CORE - and config._GSTOOLS_CORE_AVAIL # pylint: disable=W0212 - ): - summate_incompr_fct = summate_incompr_gsc # pylint: disable=E0606 + if config.USE_GSTOOLS_CORE and config._GSTOOLS_CORE_AVAIL: + summate_incompr_fct = summate_incompr_gsc else: summate_incompr_fct = summate_incompr_c return summate_incompr_fct(cov_samples, z_1, z_2, pos, num_threads) @@ -74,11 +66,8 @@ def _summate_incompr( def _summate_fourier(spectrum_factor, modes, z_1, z_2, pos, num_threads=None): """A wrapper function for calling the Fourier algorithms.""" - if ( - config.USE_GSTOOLS_CORE - and config._GSTOOLS_CORE_AVAIL # pylint: disable=W0212 - ): - summate_fourier_fct = summate_fourier_gsc # pylint: disable=E0606 + if config.USE_GSTOOLS_CORE and config._GSTOOLS_CORE_AVAIL: + summate_fourier_fct = summate_fourier_gsc else: summate_fourier_fct = summate_fourier_c return summate_fourier_fct( @@ -830,9 +819,7 @@ def reset_seed(self, seed=np.nan): self._model.spectrum(k_norm) * np.prod(self._delta_k) ) - def _fill_to_dim( - self, values, dim, dtype=float, default_value=None - ): # pylint: disable=R6301 + def _fill_to_dim(self, values, dim, dtype=float, default_value=None): """Fill an array with last element up to len(dim).""" r = np.atleast_1d(values) if values is None: diff --git a/src/gstools/field/pgs.py b/src/gstools/field/pgs.py index 2ab7b226c..40fcef7a6 100644 --- a/src/gstools/field/pgs.py +++ b/src/gstools/field/pgs.py @@ -11,7 +11,6 @@ PGS """ -# pylint: disable=C0103 import numpy as np # very clunky way of supporting both np 1.x and 2.x exceptions @@ -129,7 +128,7 @@ def calc_lithotype_axes(self, lithotypes_shape): # unstructured grid centroid = self._fields.mean(axis=1) for d in range(self._dim): - l = np.floor(self._fields[d].min()) - 1 + l = np.floor(self._fields[d].min()) - 1 # noqa: E741 h = np.ceil(self._fields[d].max()) + 1 m = (h + l) / 2.0 dist = max(np.abs(h - m), np.abs(l - m)) diff --git a/src/gstools/field/plot.py b/src/gstools/field/plot.py index b17cfc715..b36b048a5 100644 --- a/src/gstools/field/plot.py +++ b/src/gstools/field/plot.py @@ -10,7 +10,6 @@ plot_vec_field """ -# pylint: disable=C0103, W0613, E1101, E0606 import numpy as np from scipy import interpolate as inter from scipy.spatial import ConvexHull diff --git a/src/gstools/field/srf.py b/src/gstools/field/srf.py index c1d5081e5..0646251d9 100755 --- a/src/gstools/field/srf.py +++ b/src/gstools/field/srf.py @@ -9,8 +9,6 @@ SRF """ -# pylint: disable=C0103, W0221, E1102 - import numpy as np from gstools.field.base import Field diff --git a/src/gstools/field/tools.py b/src/gstools/field/tools.py index dfa2e3c65..0f528f5ed 100644 --- a/src/gstools/field/tools.py +++ b/src/gstools/field/tools.py @@ -11,7 +11,6 @@ generate_on_mesh """ -# pylint: disable=W0212, C0415 import meshio import numpy as np diff --git a/src/gstools/field/upscaling.py b/src/gstools/field/upscaling.py index 857bfc454..1cb24c466 100644 --- a/src/gstools/field/upscaling.py +++ b/src/gstools/field/upscaling.py @@ -12,7 +12,6 @@ var_no_scaling """ -# pylint: disable=W0613 import warnings import numpy as np @@ -75,9 +74,9 @@ def var_coarse_graining(model, point_volumes=0.0): ) # interpret volume as a hypercube and calculate the edge length edge = point_volumes ** (1.0 / model.dim) - var_factor = ( - model.len_scale**2 / (model.len_scale**2 + edge**2 / 4) - ) ** (model.dim / 2.0) + var_factor = (model.len_scale**2 / (model.len_scale**2 + edge**2 / 4)) ** ( + model.dim / 2.0 + ) return model.sill * var_factor diff --git a/src/gstools/krige/base.py b/src/gstools/krige/base.py index e14830fed..a1887434d 100755 --- a/src/gstools/krige/base.py +++ b/src/gstools/krige/base.py @@ -9,7 +9,6 @@ Krige """ -# pylint: disable=C0103, W0221, E1102, R0201, C0412 import collections import numpy as np @@ -27,13 +26,10 @@ from gstools.tools.misc import eval_func from gstools.variogram import vario_estimate -if config._GSTOOLS_CORE_AVAIL: # pylint: disable=W0212; # pragma: no cover - # pylint: disable=E0401 +if config._GSTOOLS_CORE_AVAIL: # pragma: no cover + from gstools_core import calc_field_krige as calc_field_krige_gsc from gstools_core import ( - calc_field_krige as calc_field_krige_gsc, # pylint: disable=E0606 - ) - from gstools_core import ( - calc_field_krige_and_variance as calc_field_krige_and_variance_gsc, # pylint: disable=E0606 + calc_field_krige_and_variance as calc_field_krige_and_variance_gsc, ) __all__ = ["Krige"] @@ -45,15 +41,10 @@ def _calc_field_krige(krig_mat, krig_vecs, cond, num_threads=None): """A wrapper function for calling the krige algorithms.""" - if ( - config.USE_GSTOOLS_CORE - and config._GSTOOLS_CORE_AVAIL # pylint: disable=W0212 - ): # pylint: disable=W0212 - calc_field_krige_fct = ( # pylint: disable=W0201 - calc_field_krige_gsc # pylint: disable=E0606 - ) + if config.USE_GSTOOLS_CORE and config._GSTOOLS_CORE_AVAIL: + calc_field_krige_fct = calc_field_krige_gsc else: - calc_field_krige_fct = calc_field_krige_c # pylint: disable=W0201 + calc_field_krige_fct = calc_field_krige_c return calc_field_krige_fct(krig_mat, krig_vecs, cond, num_threads) @@ -61,17 +52,10 @@ def _calc_field_krige_and_variance( krig_mat, krig_vecs, cond, num_threads=None ): """A wrapper function for calling the krige algorithms.""" - if ( - config.USE_GSTOOLS_CORE - and config._GSTOOLS_CORE_AVAIL # pylint: disable=W0212 - ): - calc_field_krige_and_variance_fct = ( # pylint: disable=W0201 - calc_field_krige_and_variance_gsc # pylint: disable=E0606 - ) + if config.USE_GSTOOLS_CORE and config._GSTOOLS_CORE_AVAIL: + calc_field_krige_and_variance_fct = calc_field_krige_and_variance_gsc else: - calc_field_krige_and_variance_fct = ( # pylint: disable=W0201 - calc_field_krige_and_variance_c - ) + calc_field_krige_and_variance_fct = calc_field_krige_and_variance_c return calc_field_krige_and_variance_fct( krig_mat, krig_vecs, cond, num_threads ) diff --git a/src/gstools/krige/methods.py b/src/gstools/krige/methods.py index 19ffed56d..e1cbffa99 100644 --- a/src/gstools/krige/methods.py +++ b/src/gstools/krige/methods.py @@ -13,7 +13,6 @@ Detrended """ -# pylint: disable=C0103 from gstools.krige.base import Krige __all__ = ["Simple", "Ordinary", "Universal", "ExtDrift", "Detrended"] diff --git a/src/gstools/krige/tools.py b/src/gstools/krige/tools.py index 629265957..e6d13f978 100644 --- a/src/gstools/krige/tools.py +++ b/src/gstools/krige/tools.py @@ -10,7 +10,6 @@ get_drift_functions """ -# pylint: disable=C0103 from itertools import combinations_with_replacement import numpy as np diff --git a/src/gstools/normalizer/base.py b/src/gstools/normalizer/base.py index 52c880539..2aedd4d95 100644 --- a/src/gstools/normalizer/base.py +++ b/src/gstools/normalizer/base.py @@ -9,7 +9,6 @@ Normalizer """ -# pylint: disable=R0201 import warnings import numpy as np diff --git a/src/gstools/normalizer/methods.py b/src/gstools/normalizer/methods.py index a46dc2306..ded75eb7d 100644 --- a/src/gstools/normalizer/methods.py +++ b/src/gstools/normalizer/methods.py @@ -14,7 +14,6 @@ Manly """ -# pylint: disable=E1101 import numpy as np from gstools.normalizer.base import Normalizer diff --git a/src/gstools/random/rng.py b/src/gstools/random/rng.py index ad07c6aab..db4baef93 100644 --- a/src/gstools/random/rng.py +++ b/src/gstools/random/rng.py @@ -9,7 +9,6 @@ RNG """ -# pylint: disable=E1101 import emcee as mc import numpy as np import numpy.random as rand diff --git a/src/gstools/tools/export.py b/src/gstools/tools/export.py index 38254cebe..9965a2446 100644 --- a/src/gstools/tools/export.py +++ b/src/gstools/tools/export.py @@ -14,7 +14,6 @@ to_vtk_unstructured """ -# pylint: disable=C0103, E1101 import numpy as np from pyevtk.hl import gridToVTK, pointsToVTK diff --git a/src/gstools/tools/geometric.py b/src/gstools/tools/geometric.py index 55408965e..5ba801278 100644 --- a/src/gstools/tools/geometric.py +++ b/src/gstools/tools/geometric.py @@ -30,7 +30,6 @@ great_circle_to_chordal """ -# pylint: disable=C0103 import numpy as np __all__ = [ diff --git a/src/gstools/tools/misc.py b/src/gstools/tools/misc.py index aaba1501e..3fe44678e 100755 --- a/src/gstools/tools/misc.py +++ b/src/gstools/tools/misc.py @@ -11,7 +11,6 @@ eval_func """ -# pylint: disable=C0103, C0415 import numpy as np from gstools.tools.geometric import format_struct_pos_dim, generate_grid diff --git a/src/gstools/tools/special.py b/src/gstools/tools/special.py index 1457b736e..5e6374ac4 100644 --- a/src/gstools/tools/special.py +++ b/src/gstools/tools/special.py @@ -15,7 +15,6 @@ tpl_gau_spec_dens """ -# pylint: disable=C0103, E1101 import numpy as np from scipy import special as sps diff --git a/src/gstools/transform/array.py b/src/gstools/transform/array.py index 87564edf0..16fd07f7c 100644 --- a/src/gstools/transform/array.py +++ b/src/gstools/transform/array.py @@ -19,7 +19,6 @@ array_to_uquad """ -# pylint: disable=C0103, C0123, R0911 from warnings import warn import numpy as np diff --git a/src/gstools/transform/field.py b/src/gstools/transform/field.py index a123e7987..659d17255 100644 --- a/src/gstools/transform/field.py +++ b/src/gstools/transform/field.py @@ -27,7 +27,6 @@ normal_to_uquad """ -# pylint: disable=C0103, C0123, R0911, R1735 import numpy as np from gstools.normalizer import ( @@ -88,7 +87,7 @@ def _post_process(fld, data, keep_mean): def _check_for_default_normal(fld): - if not type(fld.normalizer) == Normalizer: + if type(fld.normalizer) is not Normalizer: raise ValueError( "transform: need a normal field but there is a normalizer defined" ) diff --git a/src/gstools/variogram/variogram.py b/src/gstools/variogram/variogram.py index 96a5597a0..4dc9983a8 100644 --- a/src/gstools/variogram/variogram.py +++ b/src/gstools/variogram/variogram.py @@ -10,7 +10,6 @@ vario_estimate_axis """ -# pylint: disable=C0412 import numpy as np from gstools_cython.variogram import directional as directional_c from gstools_cython.variogram import ma_structured as ma_structured_c @@ -28,8 +27,7 @@ ) from gstools.variogram.binning import standard_bins -if config._GSTOOLS_CORE_AVAIL: # pylint: disable=W0212; # pragma: no cover - # pylint: disable=E0401 +if config._GSTOOLS_CORE_AVAIL: # pragma: no cover from gstools_core import variogram_directional as directional_gsc from gstools_core import variogram_ma_structured as ma_structured_gsc from gstools_core import variogram_structured as structured_gsc @@ -59,11 +57,8 @@ def _directional( num_threads=None, ): """A wrapper function for calling the directional variogram algorithms.""" - if ( - config.USE_GSTOOLS_CORE - and config._GSTOOLS_CORE_AVAIL # pylint: disable=W0212 - ): # pylint: disable=W0212 - directional_fct = directional_gsc # pylint: disable=E0606 + if config.USE_GSTOOLS_CORE and config._GSTOOLS_CORE_AVAIL: + directional_fct = directional_gsc else: directional_fct = directional_c return directional_fct( @@ -88,11 +83,8 @@ def _unstructured( num_threads=None, ): """A wrapper function for calling the unstructured variogram algorithms.""" - if ( - config.USE_GSTOOLS_CORE - and config._GSTOOLS_CORE_AVAIL # pylint: disable=W0212 - ): # pylint: disable=W0212 - unstructured_fct = unstructured_gsc # pylint: disable=E0606 + if config.USE_GSTOOLS_CORE and config._GSTOOLS_CORE_AVAIL: + unstructured_fct = unstructured_gsc else: unstructured_fct = unstructured_c return unstructured_fct( @@ -111,11 +103,8 @@ def _structured( num_threads=None, ): """A wrapper function for calling the structured variogram algorithms.""" - if ( - config.USE_GSTOOLS_CORE - and config._GSTOOLS_CORE_AVAIL # pylint: disable=W0212 - ): # pylint: disable=W0212 - structured_fct = structured_gsc # pylint: disable=E0606 + if config.USE_GSTOOLS_CORE and config._GSTOOLS_CORE_AVAIL: + structured_fct = structured_gsc else: structured_fct = structured_c return structured_fct(field, estimator_type, num_threads) @@ -128,11 +117,8 @@ def _ma_structured( num_threads=None, ): """A wrapper function for calling the masked struct. variogram algorithms.""" - if ( - config.USE_GSTOOLS_CORE - and config._GSTOOLS_CORE_AVAIL # pylint: disable=W0212 - ): # pylint: disable=W0212 - ma_structured_fct = ma_structured_gsc # pylint: disable=E0606 + if config.USE_GSTOOLS_CORE and config._GSTOOLS_CORE_AVAIL: + ma_structured_fct = ma_structured_gsc else: ma_structured_fct = ma_structured_c return ma_structured_fct(field, mask, estimator_type, num_threads)