From 2686dc1593ce1ef18d0892babc55681231c9909d Mon Sep 17 00:00:00 2001 From: Magdalena Date: Wed, 8 Nov 2023 09:16:50 +0100 Subject: [PATCH] add noqa A004 for imports of gt4py-builtins abs (#309) * add noqa A004 for imports of gt4py-builtins abs * add noqa A004 for imports of gt4py-builtins abs for model/atmosphere/advection --- model/atmosphere/advection/.pre-commit-config.yaml | 10 ++++++++++ .../advection/hflx_limiter_mo_stencil_01a.py | 3 +-- .../advection/prep_gauss_quadrature_c_stencil.py | 8 ++++++-- .../atmosphere/advection/v_limit_prbl_sm_stencil_01.py | 9 +++++++-- model/atmosphere/dycore/.pre-commit-config.yaml | 10 ++++++++++ .../dycore/mo_velocity_advection_stencil_14.py | 7 ++++++- .../dycore/mo_velocity_advection_stencil_18.py | 9 ++++++++- .../dycore/mo_velocity_advection_stencil_20.py | 10 +++++++++- .../model/atmosphere/dycore/state_utils/utils.py | 8 +++++++- 9 files changed, 64 insertions(+), 10 deletions(-) diff --git a/model/atmosphere/advection/.pre-commit-config.yaml b/model/atmosphere/advection/.pre-commit-config.yaml index a5f7495843..1d094ca441 100644 --- a/model/atmosphere/advection/.pre-commit-config.yaml +++ b/model/atmosphere/advection/.pre-commit-config.yaml @@ -63,6 +63,16 @@ repos: rev: v1.3.0 hooks: - id: yesqa + additional_dependencies: + - flake8==4.0.1 + - darglint + - flake8-bugbear + - flake8-builtins==2.2.0 + - flake8-debugger + - flake8-docstrings + - flake8-eradicate + - flake8-mutable + - pygments - repo: https://github.com/psf/black rev: '22.3.0' diff --git a/model/atmosphere/advection/src/icon4py/model/atmosphere/advection/hflx_limiter_mo_stencil_01a.py b/model/atmosphere/advection/src/icon4py/model/atmosphere/advection/hflx_limiter_mo_stencil_01a.py index f912fc1f43..23e16ce0df 100644 --- a/model/atmosphere/advection/src/icon4py/model/atmosphere/advection/hflx_limiter_mo_stencil_01a.py +++ b/model/atmosphere/advection/src/icon4py/model/atmosphere/advection/hflx_limiter_mo_stencil_01a.py @@ -12,7 +12,7 @@ # SPDX-License-Identifier: GPL-3.0-or-later from gt4py.next.ffront.decorator import field_operator, program -from gt4py.next.ffront.fbuiltins import Field, abs +from gt4py.next.ffront.fbuiltins import Field, abs # noqa: A004 # import gt4py builtin from icon4py.model.common.dimension import E2C, CellDim, EdgeDim, KDim @@ -23,7 +23,6 @@ def _hflx_limiter_mo_stencil_01a( p_mass_flx_e: Field[[EdgeDim, KDim], float], p_cc: Field[[CellDim, KDim], float], ) -> tuple[Field[[EdgeDim, KDim], float], Field[[EdgeDim, KDim], float]]: - z_mflx_low = 0.5 * ( p_mass_flx_e * (p_cc(E2C[0]) + p_cc(E2C[1])) - abs(p_mass_flx_e) * (p_cc(E2C[1]) - p_cc(E2C[0])) diff --git a/model/atmosphere/advection/src/icon4py/model/atmosphere/advection/prep_gauss_quadrature_c_stencil.py b/model/atmosphere/advection/src/icon4py/model/atmosphere/advection/prep_gauss_quadrature_c_stencil.py index d75ed51a38..0f249751cb 100644 --- a/model/atmosphere/advection/src/icon4py/model/atmosphere/advection/prep_gauss_quadrature_c_stencil.py +++ b/model/atmosphere/advection/src/icon4py/model/atmosphere/advection/prep_gauss_quadrature_c_stencil.py @@ -12,7 +12,12 @@ # SPDX-License-Identifier: GPL-3.0-or-later from gt4py.next.ffront.decorator import field_operator, program -from gt4py.next.ffront.fbuiltins import Field, abs, maximum, where +from gt4py.next.ffront.fbuiltins import ( # noqa: A004 # import gt4py builtin + Field, + abs, + maximum, + where, +) from icon4py.model.common.dimension import EdgeDim, KDim @@ -70,7 +75,6 @@ def _prep_gauss_quadrature_c_stencil( Field[[EdgeDim, KDim], float], Field[[EdgeDim, KDim], float], ]: - z_wgt_1 = 0.0625 * wgt_zeta_1 * wgt_eta_1 z_wgt_2 = 0.0625 * wgt_zeta_1 * wgt_eta_2 z_wgt_3 = 0.0625 * wgt_zeta_2 * wgt_eta_1 diff --git a/model/atmosphere/advection/src/icon4py/model/atmosphere/advection/v_limit_prbl_sm_stencil_01.py b/model/atmosphere/advection/src/icon4py/model/atmosphere/advection/v_limit_prbl_sm_stencil_01.py index 3ded4ed63c..4b35c4de09 100644 --- a/model/atmosphere/advection/src/icon4py/model/atmosphere/advection/v_limit_prbl_sm_stencil_01.py +++ b/model/atmosphere/advection/src/icon4py/model/atmosphere/advection/v_limit_prbl_sm_stencil_01.py @@ -12,7 +12,13 @@ # SPDX-License-Identifier: GPL-3.0-or-later from gt4py.next.ffront.decorator import field_operator, program -from gt4py.next.ffront.fbuiltins import Field, FieldOffset, abs, int32, where +from gt4py.next.ffront.fbuiltins import ( # noqa: A004 # import gt4py builtin + Field, + FieldOffset, + abs, + int32, + where, +) from icon4py.model.common.dimension import CellDim, KDim @@ -25,7 +31,6 @@ def _v_limit_prbl_sm_stencil_01( p_face: Field[[CellDim, KDim], float], p_cc: Field[[CellDim, KDim], float], ) -> Field[[CellDim, KDim], int32]: - z_delta = p_face - p_face(Koff[1]) z_a6i = 6.0 * (p_cc - 0.5 * (p_face + p_face(Koff[1]))) diff --git a/model/atmosphere/dycore/.pre-commit-config.yaml b/model/atmosphere/dycore/.pre-commit-config.yaml index 2e760aedef..1ddf87797c 100644 --- a/model/atmosphere/dycore/.pre-commit-config.yaml +++ b/model/atmosphere/dycore/.pre-commit-config.yaml @@ -63,6 +63,16 @@ repos: rev: v1.3.0 hooks: - id: yesqa + additional_dependencies: + - flake8==4.0.1 + - darglint + - flake8-bugbear + - flake8-builtins==2.2.0 + - flake8-debugger + - flake8-docstrings + - flake8-eradicate + - flake8-mutable + - pygments - repo: https://github.com/psf/black rev: '22.3.0' diff --git a/model/atmosphere/dycore/src/icon4py/model/atmosphere/dycore/mo_velocity_advection_stencil_14.py b/model/atmosphere/dycore/src/icon4py/model/atmosphere/dycore/mo_velocity_advection_stencil_14.py index cb72dafdb9..b61e8b1109 100644 --- a/model/atmosphere/dycore/src/icon4py/model/atmosphere/dycore/mo_velocity_advection_stencil_14.py +++ b/model/atmosphere/dycore/src/icon4py/model/atmosphere/dycore/mo_velocity_advection_stencil_14.py @@ -13,7 +13,12 @@ from gt4py.next.common import GridType from gt4py.next.ffront.decorator import field_operator, program -from gt4py.next.ffront.fbuiltins import Field, abs, broadcast, where +from gt4py.next.ffront.fbuiltins import ( # noqa: A004 # import gt4py builtin + Field, + abs, + broadcast, + where, +) from icon4py.model.common.dimension import CellDim, KDim diff --git a/model/atmosphere/dycore/src/icon4py/model/atmosphere/dycore/mo_velocity_advection_stencil_18.py b/model/atmosphere/dycore/src/icon4py/model/atmosphere/dycore/mo_velocity_advection_stencil_18.py index 817a73f04e..8e0e580724 100644 --- a/model/atmosphere/dycore/src/icon4py/model/atmosphere/dycore/mo_velocity_advection_stencil_18.py +++ b/model/atmosphere/dycore/src/icon4py/model/atmosphere/dycore/mo_velocity_advection_stencil_18.py @@ -13,7 +13,14 @@ from gt4py.next.common import GridType from gt4py.next.ffront.decorator import field_operator, program -from gt4py.next.ffront.fbuiltins import Field, abs, int32, minimum, neighbor_sum, where +from gt4py.next.ffront.fbuiltins import ( # noqa: A004 # import gt4py builtin + Field, + abs, + int32, + minimum, + neighbor_sum, + where, +) from icon4py.model.common.dimension import C2E2CO, C2E2CODim, CellDim, KDim diff --git a/model/atmosphere/dycore/src/icon4py/model/atmosphere/dycore/mo_velocity_advection_stencil_20.py b/model/atmosphere/dycore/src/icon4py/model/atmosphere/dycore/mo_velocity_advection_stencil_20.py index 32d8a997af..001190db24 100644 --- a/model/atmosphere/dycore/src/icon4py/model/atmosphere/dycore/mo_velocity_advection_stencil_20.py +++ b/model/atmosphere/dycore/src/icon4py/model/atmosphere/dycore/mo_velocity_advection_stencil_20.py @@ -13,7 +13,15 @@ from gt4py.next.common import GridType from gt4py.next.ffront.decorator import field_operator, program -from gt4py.next.ffront.fbuiltins import Field, abs, broadcast, int32, minimum, neighbor_sum, where +from gt4py.next.ffront.fbuiltins import ( # noqa: A004 # import gt4py builtin + Field, + abs, + broadcast, + int32, + minimum, + neighbor_sum, + where, +) from icon4py.model.common.dimension import ( E2C, diff --git a/model/atmosphere/dycore/src/icon4py/model/atmosphere/dycore/state_utils/utils.py b/model/atmosphere/dycore/src/icon4py/model/atmosphere/dycore/state_utils/utils.py index 2549420734..cb5af1d707 100644 --- a/model/atmosphere/dycore/src/icon4py/model/atmosphere/dycore/state_utils/utils.py +++ b/model/atmosphere/dycore/src/icon4py/model/atmosphere/dycore/state_utils/utils.py @@ -15,7 +15,13 @@ import numpy as np from gt4py.next.common import Dimension, Field from gt4py.next.ffront.decorator import field_operator, program -from gt4py.next.ffront.fbuiltins import abs, broadcast, int32, maximum, minimum +from gt4py.next.ffront.fbuiltins import ( # noqa: A004 # import gt4py builtin + abs, + broadcast, + int32, + maximum, + minimum, +) from gt4py.next.iterator.embedded import np_as_located_field from icon4py.model.common.dimension import CellDim, EdgeDim, KDim, Koff, VertexDim