Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

style: Fix leftovers of moving lint infrastructure to ruff #1480

Merged
merged 3 commits into from
Mar 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
115 changes: 1 addition & 114 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -94,26 +94,6 @@ Homepage = 'https://gridtools.github.io/'
Source = 'https://github.com/GridTools/gt4py'

# ---- Other tools ----
# -- black --
[tool.black]
exclude = '''
/(
\.git
| \.gt_cache
| \.hg
| \.mypy_cache
| \.tox
| \.venv
| _build
| buck-out
| build
| dist
)/
'''
include = '\.pyi?$'
line-length = 100
target-version = ['py310']

# -- coverage --
[tool.coverage]

Expand All @@ -137,99 +117,6 @@ ignore_errors = true
branch = true
source_pkgs = ['gt4py']

# -- flake8 --
# flake8-pyproject plugin is used to load configuration settings
# from this file, since flake8 doesn't support it natively.
[tool.flake8]
count = true
doctests = true
exclude = [
'.eggs',
'.gt_cache',
'.ipynb_checkpoints',
'.tox',
'_local/',
'build',
'dist',
'docs',
'tests/_disabled',
'setup.py'
]
ignore = [
'B008', # Do not perform function calls in argument defaults
'B028', # Consider replacing f"'{foo}'" with f"{foo!r}" # TODO: review this ignore
'D1', # Public code object needs docstring
'DAR', # Disable dargling errors by default
'E203', # Whitespace before ':' (black formatter breaks this sometimes)
'E501', # Line too long (using Bugbear's B950 warning)
'W503', # Line break occurred before a binary operator
'E701', # Multiple statements on one line, see https://github.com/psf/black/issues/3887
'E704' # Multiple statements on one line, see https://github.com/psf/black/issues/3887
]
max-complexity = 15
max-line-length = 100 # It should be the same as in `tool.black.line-length` above
per-file-ignores = [
'src/gt4py/eve/extended_typing.py:F401,F405',
'src/gt4py/next/__init__.py:F401' # We import stuff there in order to reexport.
]
rst-roles = [
'py:mod, mod',
'py:func, func',
'py:data, data',
'py:const, const',
'py:class, class',
'py:meth, meth',
'py:attr, attr',
'py:exc, exc',
'py:obj, obj'
]

# -- isort --
[tool.isort]
combine_as_imports = true
group_by_package = true
known_first_party = ['gt4py', '__externals__', '__gtscript__']
known_tests = ['cartesian_tests', 'eve_tests', 'next_tests', 'storage_tests']
known_third_party = [
'attr',
'black',
'boltons',
'cached_property',
'click',
'cupy',
'dace',
'devtools',
'factory',
'hypothesis',
'importlib_resources',
'jinja2',
'mako',
'networkx',
'numpy',
'packaging',
'pybind11',
'pytest',
'pytest_factoryboy',
'setuptools',
'tabulate',
'typing_extensions',
'xxhash'
]
lexicographical = true
line_length = 100 # It should be the same as in `tool.black.line-length` above
lines_after_imports = 2
profile = 'black'
sections = [
'FUTURE',
'STDLIB',
'THIRDPARTY',
'FIRSTPARTY',
'TESTS',
'LOCALFOLDER'
]
skip_gitignore = true
skip_glob = ['*.venv/**', '_local/**']

# -- mypy --
[tool.mypy]
disallow_incomplete_defs = true
Expand Down Expand Up @@ -451,7 +338,7 @@ split-on-trailing-comma = false
max-complexity = 15

[tool.ruff.lint.per-file-ignores]
"src/gt4py/cartesian/*" = ["RUF012"]
'src/gt4py/cartesian/*' = ['RUF012']
'src/gt4py/eve/extended_typing.py' = ['F401', 'F405']
'src/gt4py/next/__init__.py' = ['F401']

Expand Down
4 changes: 1 addition & 3 deletions src/gt4py/cartesian/frontend/gtscript_frontend.py
Original file line number Diff line number Diff line change
Expand Up @@ -1919,9 +1919,7 @@ def resolve_external_symbols(
"{}.{}".format(value._gtscript_["qualified_name"], item_name): item_value
for item_name, item_value in value._gtscript_["nonlocals"].items()
}
resolved_values_list.extend( # noqa[B038] #editing a loop's mutable iterable (probably intended here)
nested_inlined_values.items()
)
resolved_values_list.extend(nested_inlined_values.items())

for imported_name, imported_name_accesses in value._gtscript_[
"imported"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,4 @@ def test_warning_for_unsupported_backend_option(backend):
@gtscript.stencil(backend=backend, **{"this_option_is_not_supported": "foo"})
def foo(f: Field[float]):
with computation(PARALLEL), interval(...): # type: ignore
f = 42.0 # noqa F841
f = 42.0 # noqa: F841 [unused-variable]
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@


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

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

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

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

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

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

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

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

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

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


def test_lazy_sdfg():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def backend(request):
def init_1(input_field: Field[float]): # type: ignore
"""Implement simple stencil."""
with computation(PARALLEL), interval(...): # type: ignore
input_field = 1 # noqa - unused var is in/out field
input_field = 1 # noqa # unused var is in/out field


def test_generate_computation(backend, tmp_path):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# GT4Py - GridTools Framework
#
# Copyright (c) 2014-2023, ETH Zurich
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# GT4Py - GridTools Framework
#
# Copyright (c) 2014-2023, ETH Zurich
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# GT4Py - GridTools Framework
#
# Copyright (c) 2014-2023, ETH Zurich
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# GT4Py - GridTools Framework
#
# Copyright (c) 2014-2023, ETH Zurich
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# GT4Py - GridTools Framework
#
# Copyright (c) 2014-2023, ETH Zurich
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# GT4Py - GridTools Framework
#
# Copyright (c) 2014-2023, ETH Zurich
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# GT4Py - GridTools Framework
#
# Copyright (c) 2014-2023, ETH Zurich
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# GT4Py - GridTools Framework
#
# Copyright (c) 2014-2023, ETH Zurich
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-

# GT4Py - GridTools Framework
#
# Copyright (c) 2014-2023, ETH Zurich
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-

# GT4Py - GridTools Framework
#
# Copyright (c) 2014-2023, ETH Zurich
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# GT4Py - GridTools Framework
#
# Copyright (c) 2014-2023, ETH Zurich
Expand Down
Loading