Skip to content

Commit cd05a3c

Browse files
committed
Updates
1 parent 0979b49 commit cd05a3c

File tree

7 files changed

+23
-35
lines changed

7 files changed

+23
-35
lines changed

ffcx/analysis.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ def _analyze_form(form: ufl.form.Form, options: typing.Dict) -> ufl.algorithms.f
156156
raise RuntimeError(f"Form ({form}) contains unsupported custom integrals.")
157157

158158
# Set default spacing for coordinate elements to be equispaced
159-
for n, i in enumerate(form._integrals):
159+
for i in form._integrals:
160160
element = i._ufl_domain._ufl_coordinate_element
161161
assert isinstance(element, basix.ufl._ElementBase)
162162

ffcx/codegeneration/expression_generator.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ def generate_block_parts(self, blockmap, blockdata):
212212

213213
# Check if DOFs in dofrange are equally spaced.
214214
expand_loop = False
215-
for i, bm in enumerate(blockmap):
215+
for bm in blockmap:
216216
for a, b in zip(bm[1:-1], bm[2:]):
217217
if b - a != bm[1] - bm[0]:
218218
expand_loop = True
@@ -317,7 +317,7 @@ def generate_partition(self, symbol, F, mode):
317317
definitions = []
318318
intermediates = []
319319

320-
for i, attr in F.nodes.items():
320+
for _, attr in F.nodes.items():
321321
if attr["status"] != mode:
322322
continue
323323
v = attr["expression"]

ffcx/codegeneration/jit.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,8 @@ def get_cached_module(module_name, object_names, cache_dir, timeout):
108108
logger.info(f"Waiting for {ready_name} to appear.")
109109
time.sleep(1)
110110
raise TimeoutError(
111-
f"""JIT compilation timed out, probably due to a failed previous compile.
112-
Try cleaning cache (e.g. remove {c_filename}) or increase timeout option."""
111+
"JIT compilation timed out, probably due to a failed previous compile. "
112+
f"Try cleaning cache (e.g. remove {c_filename}) or increase timeout option."
113113
)
114114

115115

ffcx/ir/elementtables.py

+8-8
Original file line numberDiff line numberDiff line change
@@ -236,40 +236,40 @@ def get_modified_terminal_element(mt) -> typing.Optional[ModifiedTerminalElement
236236

237237

238238
def permute_quadrature_interval(points, reflections=0):
239-
"""Permuteq quadrature points for an interval."""
239+
"""Permute quadrature points for an interval."""
240240
output = points.copy()
241241
for p in output:
242242
assert len(p) < 2 or np.isclose(p[1], 0)
243243
assert len(p) < 3 or np.isclose(p[2], 0)
244-
for i in range(reflections):
244+
for _ in range(reflections):
245245
for n, p in enumerate(output):
246246
output[n] = [1 - p[0]]
247247
return output
248248

249249

250250
def permute_quadrature_triangle(points, reflections=0, rotations=0):
251-
"""Permuteq quadrature points for a triangle."""
251+
"""Permute quadrature points for a triangle."""
252252
output = points.copy()
253253
for p in output:
254254
assert len(p) < 3 or np.isclose(p[2], 0)
255-
for i in range(rotations):
255+
for _ in range(rotations):
256256
for n, p in enumerate(output):
257257
output[n] = [p[1], 1 - p[0] - p[1]]
258-
for i in range(reflections):
258+
for _ in range(reflections):
259259
for n, p in enumerate(output):
260260
output[n] = [p[1], p[0]]
261261
return output
262262

263263

264264
def permute_quadrature_quadrilateral(points, reflections=0, rotations=0):
265-
"""Permuteq quadrature points for a quadrilateral."""
265+
"""Permute quadrature points for a quadrilateral."""
266266
output = points.copy()
267267
for p in output:
268268
assert len(p) < 3 or np.isclose(p[2], 0)
269-
for i in range(rotations):
269+
for _ in range(rotations):
270270
for n, p in enumerate(output):
271271
output[n] = [p[1], 1 - p[0]]
272-
for i in range(reflections):
272+
for _ in range(reflections):
273273
for n, p in enumerate(output):
274274
output[n] = [p[1], p[0]]
275275
return output

ffcx/ir/integral.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ def analyse_dependencies(F, mt_unique_table_reference):
302302
"""
303303
# Set targets, and dependencies to 'active'
304304
targets = [i for i, v in F.nodes.items() if v.get("target")]
305-
for i, v in F.nodes.items():
305+
for _, v in F.nodes.items():
306306
v["status"] = "inactive"
307307

308308
while targets:
@@ -343,7 +343,7 @@ def analyse_dependencies(F, mt_unique_table_reference):
343343
varying_indices.append(j)
344344

345345
# Any remaining active nodes must be 'piecewise'
346-
for i, v in F.nodes.items():
346+
for _, v in F.nodes.items():
347347
if v["status"] == "active":
348348
v["status"] = "piecewise"
349349

pyproject.toml

+6-18
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ version = "0.8.0.dev0"
88
description = "The FEniCSx Form Compiler"
99
readme = "README.md"
1010
requires-python = ">=3.8.0"
11-
license = {file = "LICENSE"}
11+
license = { file = "LICENSE" }
1212
authors = [
1313
{ email = "fenics-steering-council@googlegroups.com" },
1414
{ name = "FEniCS Steering Council" },
1515
]
1616
dependencies = [
1717
"numpy>=1.21",
1818
"cffi",
19-
"setuptools; python_version >= '3.12'", # cffi with compilation support requires setuptools
19+
"setuptools; python_version >= '3.12'", # cffi with compilation support requires setuptools
2020
"fenics-basix >= 0.8.0.dev0, <0.9.0",
2121
"fenics-ufl >= 2023.3.0.dev0, <2023.4.0",
2222
]
@@ -59,13 +59,8 @@ packages = [
5959
[tool.pytest.ini_options]
6060
minversion = "6.0"
6161
addopts = "-ra"
62-
testpaths = [
63-
"test"
64-
]
65-
norecursedirs = [
66-
"libs",
67-
"docs"
68-
]
62+
testpaths = ["test"]
63+
norecursedirs = ["libs", "docs"]
6964
log_cli = true
7065

7166
[tool.mypy]
@@ -80,13 +75,7 @@ warn_unused_ignores = false
8075
show_error_codes = true
8176

8277
[[tool.mypy.overrides]]
83-
module = [
84-
'basix',
85-
'cffi',
86-
'numba.*',
87-
'pygraphviz',
88-
'ufl.*'
89-
]
78+
module = ['basix', 'cffi', 'numba.*', 'pygraphviz', 'ufl.*']
9079
ignore_missing_imports = true
9180

9281
[tool.ruff]
@@ -114,7 +103,7 @@ select = [
114103
"FLY", # use f-string not static joins
115104
"LOG", # https://docs.astral.sh/ruff/rules/#flake8-logging-log
116105
# "ISC", # https://docs.astral.sh/ruff/rules/#flake8-implicit-str-concat-isc
117-
# "B", https://docs.astral.sh/ruff/rules/#flake8-bugbear-b
106+
# "B", # https://docs.astral.sh/ruff/rules/#flake8-bugbear-b
118107
# "A", # https://docs.astral.sh/ruff/rules/#flake8-builtins-a
119108
]
120109
ignore = ["RUF005", "RUF012", "RUF015"]
@@ -127,4 +116,3 @@ ignore = ["RUF005", "RUF012", "RUF015"]
127116

128117
[tool.ruff.lint.pydocstyle]
129118
convention = "google"
130-

test/test_jit_forms.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -551,7 +551,7 @@ def test_curl_curl(compile_args):
551551
)
552552

553553

554-
def lagrange_triangle_symbolic(order, corners=[(1, 0), (2, 0), (0, 1)], fun=lambda i: i):
554+
def lagrange_triangle_symbolic(order, corners=((1, 0), (2, 0), (0, 1)), fun=lambda i: i):
555555
from sympy import S
556556

557557
poly_basis = [x**i * y**j for i in range(order + 1) for j in range(order + 1 - i)]
@@ -648,7 +648,7 @@ def test_lagrange_triangle(compile_args, order, dtype, sym_fun, ufl_fun):
648648

649649

650650
def lagrange_tetrahedron_symbolic(
651-
order, corners=[(1, 0, 0), (2, 0, 0), (0, 1, 0), (0, 0, 1)], fun=lambda i: i
651+
order, corners=((1, 0, 0), (2, 0, 0), (0, 1, 0), (0, 0, 1)), fun=lambda i: i
652652
):
653653
from sympy import S
654654

0 commit comments

Comments
 (0)