From 934249d6265034c5a730ae356932c0123df2dfa8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9cile?= Date: Tue, 3 Dec 2024 10:43:53 +0100 Subject: [PATCH] Fix ruff --- ufl/algorithms/formsplitter.py | 9 +++++---- ufl/algorithms/formtransformations.py | 8 ++++---- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/ufl/algorithms/formsplitter.py b/ufl/algorithms/formsplitter.py index 7e4c3db58..0b04ae0df 100644 --- a/ufl/algorithms/formsplitter.py +++ b/ufl/algorithms/formsplitter.py @@ -94,8 +94,9 @@ def restricted(self, o): expr = MultiFunction.reuse_if_untouched -def extract_blocks(form, i: Optional[int] = None, j: Optional[int] = None, - arity: Optional[int] = None): +def extract_blocks( + form, i: Optional[int] = None, j: Optional[int] = None, arity: Optional[int] = None +): """Extract blocks of a form. If arity is 0, returns the form. @@ -117,8 +118,8 @@ def extract_blocks(form, i: Optional[int] = None, j: Optional[int] = None, arguments = form.arguments() if arity is None: - numbers = tuple(sorted(set(a.number() for a in arguments))) - arity = len(numbers) + numbers = tuple(sorted(set(a.number() for a in arguments))) + arity = len(numbers) assert arity <= 2 if arity == 0: diff --git a/ufl/algorithms/formtransformations.py b/ufl/algorithms/formtransformations.py index 3ed89925f..229114327 100644 --- a/ufl/algorithms/formtransformations.py +++ b/ufl/algorithms/formtransformations.py @@ -362,9 +362,9 @@ def compute_form_lhs(form): form_blocks = extract_blocks(form, arity=2) lhs = 0 for bi in form_blocks: - for bj in bi: - if bj is not None: - lhs += compute_form_with_arity(bj, 2) + for bj in bi: + if bj is not None: + lhs += compute_form_with_arity(bj, 2) return lhs @@ -378,7 +378,7 @@ def compute_form_rhs(form): form_blocks = extract_blocks(form, arity=1) rhs = 0 for bi in form_blocks: - rhs += compute_form_with_arity(bi, 1) + rhs += compute_form_with_arity(bi, 1) return -rhs