Skip to content

Commit 5ed2590

Browse files
authored
style: Fix leftovers of moving lint infrastructure to ruff (#1480)
Changes: - Remove unneeded configuration for `black`, `isort` and `flake8` in pyproject.toml - Fixes in `noqa` comments in several files - Remove line with text-encoding from some headers
1 parent 0151b05 commit 5ed2590

File tree

16 files changed

+16
-140
lines changed

16 files changed

+16
-140
lines changed

pyproject.toml

+1-114
Original file line numberDiff line numberDiff line change
@@ -94,26 +94,6 @@ Homepage = 'https://gridtools.github.io/'
9494
Source = 'https://github.com/GridTools/gt4py'
9595

9696
# ---- Other tools ----
97-
# -- black --
98-
[tool.black]
99-
exclude = '''
100-
/(
101-
\.git
102-
| \.gt_cache
103-
| \.hg
104-
| \.mypy_cache
105-
| \.tox
106-
| \.venv
107-
| _build
108-
| buck-out
109-
| build
110-
| dist
111-
)/
112-
'''
113-
include = '\.pyi?$'
114-
line-length = 100
115-
target-version = ['py310']
116-
11797
# -- coverage --
11898
[tool.coverage]
11999

@@ -137,99 +117,6 @@ ignore_errors = true
137117
branch = true
138118
source_pkgs = ['gt4py']
139119

140-
# -- flake8 --
141-
# flake8-pyproject plugin is used to load configuration settings
142-
# from this file, since flake8 doesn't support it natively.
143-
[tool.flake8]
144-
count = true
145-
doctests = true
146-
exclude = [
147-
'.eggs',
148-
'.gt_cache',
149-
'.ipynb_checkpoints',
150-
'.tox',
151-
'_local/',
152-
'build',
153-
'dist',
154-
'docs',
155-
'tests/_disabled',
156-
'setup.py'
157-
]
158-
ignore = [
159-
'B008', # Do not perform function calls in argument defaults
160-
'B028', # Consider replacing f"'{foo}'" with f"{foo!r}" # TODO: review this ignore
161-
'D1', # Public code object needs docstring
162-
'DAR', # Disable dargling errors by default
163-
'E203', # Whitespace before ':' (black formatter breaks this sometimes)
164-
'E501', # Line too long (using Bugbear's B950 warning)
165-
'W503', # Line break occurred before a binary operator
166-
'E701', # Multiple statements on one line, see https://github.com/psf/black/issues/3887
167-
'E704' # Multiple statements on one line, see https://github.com/psf/black/issues/3887
168-
]
169-
max-complexity = 15
170-
max-line-length = 100 # It should be the same as in `tool.black.line-length` above
171-
per-file-ignores = [
172-
'src/gt4py/eve/extended_typing.py:F401,F405',
173-
'src/gt4py/next/__init__.py:F401' # We import stuff there in order to reexport.
174-
]
175-
rst-roles = [
176-
'py:mod, mod',
177-
'py:func, func',
178-
'py:data, data',
179-
'py:const, const',
180-
'py:class, class',
181-
'py:meth, meth',
182-
'py:attr, attr',
183-
'py:exc, exc',
184-
'py:obj, obj'
185-
]
186-
187-
# -- isort --
188-
[tool.isort]
189-
combine_as_imports = true
190-
group_by_package = true
191-
known_first_party = ['gt4py', '__externals__', '__gtscript__']
192-
known_tests = ['cartesian_tests', 'eve_tests', 'next_tests', 'storage_tests']
193-
known_third_party = [
194-
'attr',
195-
'black',
196-
'boltons',
197-
'cached_property',
198-
'click',
199-
'cupy',
200-
'dace',
201-
'devtools',
202-
'factory',
203-
'hypothesis',
204-
'importlib_resources',
205-
'jinja2',
206-
'mako',
207-
'networkx',
208-
'numpy',
209-
'packaging',
210-
'pybind11',
211-
'pytest',
212-
'pytest_factoryboy',
213-
'setuptools',
214-
'tabulate',
215-
'typing_extensions',
216-
'xxhash'
217-
]
218-
lexicographical = true
219-
line_length = 100 # It should be the same as in `tool.black.line-length` above
220-
lines_after_imports = 2
221-
profile = 'black'
222-
sections = [
223-
'FUTURE',
224-
'STDLIB',
225-
'THIRDPARTY',
226-
'FIRSTPARTY',
227-
'TESTS',
228-
'LOCALFOLDER'
229-
]
230-
skip_gitignore = true
231-
skip_glob = ['*.venv/**', '_local/**']
232-
233120
# -- mypy --
234121
[tool.mypy]
235122
disallow_incomplete_defs = true
@@ -451,7 +338,7 @@ split-on-trailing-comma = false
451338
max-complexity = 15
452339

453340
[tool.ruff.lint.per-file-ignores]
454-
"src/gt4py/cartesian/*" = ["RUF012"]
341+
'src/gt4py/cartesian/*' = ['RUF012']
455342
'src/gt4py/eve/extended_typing.py' = ['F401', 'F405']
456343
'src/gt4py/next/__init__.py' = ['F401']
457344

src/gt4py/cartesian/frontend/gtscript_frontend.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -1919,9 +1919,7 @@ def resolve_external_symbols(
19191919
"{}.{}".format(value._gtscript_["qualified_name"], item_name): item_value
19201920
for item_name, item_value in value._gtscript_["nonlocals"].items()
19211921
}
1922-
resolved_values_list.extend( # noqa[B038] #editing a loop's mutable iterable (probably intended here)
1923-
nested_inlined_values.items()
1924-
)
1922+
resolved_values_list.extend(nested_inlined_values.items())
19251923

19261924
for imported_name, imported_name_accesses in value._gtscript_[
19271925
"imported"

tests/cartesian_tests/integration_tests/feature_tests/test_stencil_object.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,4 +81,4 @@ def test_warning_for_unsupported_backend_option(backend):
8181
@gtscript.stencil(backend=backend, **{"this_option_is_not_supported": "foo"})
8282
def foo(f: Field[float]):
8383
with computation(PARALLEL), interval(...): # type: ignore
84-
f = 42.0 # noqa F841
84+
f = 42.0 # noqa: F841 [unused-variable]

tests/cartesian_tests/integration_tests/multi_feature_tests/test_dace_parsing.py

+10-10
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030

3131

3232
dace = pytest.importorskip("dace")
33-
from gt4py.cartesian.backend.dace_lazy_stencil import ( # noqa: E402 (needs to be guarded by above importorskip)
33+
from gt4py.cartesian.backend.dace_lazy_stencil import ( # noqa: E402 [import-shadowed-by-loop-var] 'importorskip' is needed
3434
DaCeLazyStencil,
3535
)
3636

@@ -76,7 +76,7 @@ def test_basic(decorator, backend):
7676
@decorator(backend=backend)
7777
def defn(outp: gtscript.Field[np.float64], par: np.float64):
7878
with computation(PARALLEL), interval(...):
79-
outp = par # noqa F841: local variable 'outp' is assigned to but never used
79+
outp = par # noqa: F841 [unused-variable]
8080

8181
outp = OriginWrapper(
8282
array=gt_storage.zeros(
@@ -105,7 +105,7 @@ def test_origin_offsetting_frozen(domain, outp_origin):
105105
@gtscript.stencil(backend=backend)
106106
def dace_stencil(inp: gtscript.Field[np.float64], outp: gtscript.Field[np.float64]):
107107
with computation(PARALLEL), interval(...):
108-
outp = inp # noqa F841: local variable 'outp' is assigned to but never used
108+
outp = inp # noqa: F841 [unused-variable]
109109

110110
frozen_stencil = dace_stencil.freeze(
111111
domain=domain, origin={"inp": (0, 0, 0), "outp": outp_origin}
@@ -156,7 +156,7 @@ def test_origin_offsetting_nofrozen(domain, outp_origin):
156156
@gtscript.stencil(backend=backend)
157157
def dace_stencil(inp: gtscript.Field[np.float64], outp: gtscript.Field[np.float64]):
158158
with computation(PARALLEL), interval(...):
159-
outp = inp # noqa F841: local variable 'outp' is assigned to but never used
159+
outp = inp # noqa: F841 [unused-variable]
160160

161161
inp = OriginWrapper(
162162
array=gt_storage.full(
@@ -204,7 +204,7 @@ def test_origin_offsetting_nofrozen_default_origin(domain, outp_origin):
204204
@gtscript.stencil(backend=backend)
205205
def dace_stencil(inp: gtscript.Field[np.float64], outp: gtscript.Field[np.float64]):
206206
with computation(PARALLEL), interval(...):
207-
outp = inp # noqa F841: local variable 'outp' is assigned to but never used
207+
outp = inp # noqa: F841 [unused-variable]
208208

209209
inp = OriginWrapper(
210210
array=gt_storage.full(
@@ -252,7 +252,7 @@ def stencil(
252252
unused_par: float,
253253
):
254254
with computation(PARALLEL), interval(...):
255-
outp = inp # noqa F841: local variable 'outp' is assigned to but never used
255+
outp = inp # noqa: F841 [unused-variable]
256256

257257
frozen_stencil = stencil.freeze(
258258
domain=(3, 3, 10),
@@ -298,7 +298,7 @@ def stencil(
298298
unused_par: float,
299299
):
300300
with computation(PARALLEL), interval(...):
301-
outp = inp # noqa F841: local variable 'outp' is assigned to but never used
301+
outp = inp # noqa: F841 [unused-variable]
302302

303303
inp = OriginWrapper(
304304
array=gt_storage.full(
@@ -352,7 +352,7 @@ def stencil(
352352
unused_par: float,
353353
):
354354
with computation(PARALLEL), interval(...):
355-
outp = inp # noqa F841: local variable 'outp' is assigned to but never used
355+
outp = inp # noqa: F841 [unused-variable]
356356

357357
inp = OriginWrapper(
358358
array=gt_storage.full(
@@ -405,7 +405,7 @@ def test_nondace_raises(decorator):
405405
@decorator(backend="numpy")
406406
def numpy_stencil(inp: gtscript.Field[np.float64], outp: gtscript.Field[np.float64]):
407407
with computation(PARALLEL), interval(...):
408-
outp = inp # noqa F841: local variable 'outp' is assigned to but never used
408+
outp = inp # noqa: F841 [unused-variable]
409409

410410
inp = OriginWrapper(
411411
array=gt_storage.full(
@@ -445,7 +445,7 @@ def call_stencil():
445445
@typing.no_type_check
446446
def simple_stencil_defn(outp: gtscript.Field[np.float64], par: np.float64):
447447
with computation(PARALLEL), interval(...):
448-
outp = par # noqa F841: local variable 'outp' is assigned to but never used
448+
outp = par # noqa: F841 [unused-variable]
449449

450450

451451
def test_lazy_sdfg():

tests/cartesian_tests/unit_tests/backend_tests/test_backend_api.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def backend(request):
3131
def init_1(input_field: Field[float]): # type: ignore
3232
"""Implement simple stencil."""
3333
with computation(PARALLEL), interval(...): # type: ignore
34-
input_field = 1 # noqa - unused var is in/out field
34+
input_field = 1 # noqa # unused var is in/out field
3535

3636

3737
def test_generate_computation(backend, tmp_path):

tests/next_tests/integration_tests/feature_tests/ffront_tests/ffront_test_utils.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# -*- coding: utf-8 -*-
21
# GT4Py - GridTools Framework
32
#
43
# Copyright (c) 2014-2023, ETH Zurich

tests/next_tests/integration_tests/feature_tests/ffront_tests/test_bound_args.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# -*- coding: utf-8 -*-
21
# GT4Py - GridTools Framework
32
#
43
# Copyright (c) 2014-2023, ETH Zurich

tests/next_tests/integration_tests/feature_tests/ffront_tests/test_execution.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# -*- coding: utf-8 -*-
21
# GT4Py - GridTools Framework
32
#
43
# Copyright (c) 2014-2023, ETH Zurich

tests/next_tests/integration_tests/feature_tests/ffront_tests/test_external_local_field.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# -*- coding: utf-8 -*-
21
# GT4Py - GridTools Framework
32
#
43
# Copyright (c) 2014-2023, ETH Zurich

tests/next_tests/integration_tests/feature_tests/ffront_tests/test_gt4py_builtins.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# -*- coding: utf-8 -*-
21
# GT4Py - GridTools Framework
32
#
43
# Copyright (c) 2014-2023, ETH Zurich

tests/next_tests/integration_tests/feature_tests/ffront_tests/test_math_unary_builtins.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# -*- coding: utf-8 -*-
21
# GT4Py - GridTools Framework
32
#
43
# Copyright (c) 2014-2023, ETH Zurich

tests/next_tests/integration_tests/feature_tests/ffront_tests/test_scalar_if.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# -*- coding: utf-8 -*-
21
# GT4Py - GridTools Framework
32
#
43
# Copyright (c) 2014-2023, ETH Zurich

tests/next_tests/unit_tests/ffront_tests/ast_passes_tests/test_fix_missing_locations.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# -*- coding: utf-8 -*-
21
# GT4Py - GridTools Framework
32
#
43
# Copyright (c) 2014-2023, ETH Zurich

tests/next_tests/unit_tests/ffront_tests/ast_passes_tests/test_simple_assign.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env python
2-
# -*- coding: utf-8 -*-
2+
33
# GT4Py - GridTools Framework
44
#
55
# Copyright (c) 2014-2023, ETH Zurich

tests/next_tests/unit_tests/ffront_tests/ast_passes_tests/test_single_static_assign.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env python
2-
# -*- coding: utf-8 -*-
2+
33
# GT4Py - GridTools Framework
44
#
55
# Copyright (c) 2014-2023, ETH Zurich

tests/next_tests/unit_tests/type_system_tests/test_type_translation.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# -*- coding: utf-8 -*-
21
# GT4Py - GridTools Framework
32
#
43
# Copyright (c) 2014-2023, ETH Zurich

0 commit comments

Comments
 (0)