From f37a8502bddcd47cbe2f3d3ffc1d32acb0e6b615 Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner Date: Sun, 28 Oct 2018 14:07:30 -0500 Subject: [PATCH] Placate flake8 3.6 --- grudge/models/second_order.py | 4 ++-- grudge/models/wave.py | 14 +++++++------- grudge/symbolic/compiler.py | 6 ++++-- grudge/symbolic/mappers/__init__.py | 11 ++++++----- grudge/symbolic/primitives.py | 2 +- test/test_grudge.py | 2 +- 6 files changed, 21 insertions(+), 18 deletions(-) diff --git a/grudge/models/second_order.py b/grudge/models/second_order.py index 24260c0f..61aa72a0 100644 --- a/grudge/models/second_order.py +++ b/grudge/models/second_order.py @@ -156,8 +156,8 @@ class NeumannBCGenerator(mappers.IdentityMapper): "operator encountered by stab term generator") from grudge.symbolic import BoundaryNormalComponent - return (self.bc * factor * - BoundaryNormalComponent(self.tag, expr.op.xyz_axis)) + return (self.bc * factor + * BoundaryNormalComponent(self.tag, expr.op.xyz_axis)) elif isinstance(expr.op, sym.FluxOperatorBase): return 0 diff --git a/grudge/models/wave.py b/grudge/models/wave.py index 19229abe..40710eb2 100644 --- a/grudge/models/wave.py +++ b/grudge/models/wave.py @@ -36,8 +36,8 @@ from pytools.obj_array import join_fields # {{{ constant-velocity class StrongWaveOperator(HyperbolicOperator): - """This operator discretizes the wave equation - :math:`\\partial_t^2 u = c^2 \\Delta u`. + r"""This operator discretizes the wave equation + :math:`\partial_t^2 u = c^2 \Delta u`. To be precise, we discretize the hyperbolic system @@ -156,7 +156,7 @@ class StrongWaveOperator(HyperbolicOperator): -self.c*np.dot(nabla, v), -self.c*(nabla*u) ) - + + + # noqa: W504 sym.InverseMassOperator()( sym.FaceMassOperator()( flux(sym.int_tpair(w)) @@ -181,8 +181,8 @@ class StrongWaveOperator(HyperbolicOperator): class WeakWaveOperator(HyperbolicOperator): - """This operator discretizes the wave equation - :math:`\\partial_t^2 u = c^2 \\Delta u`. + r"""This operator discretizes the wave equation + :math:`\partial_t^2 u = c^2 \Delta u`. To be precise, we discretize the hyperbolic system @@ -321,8 +321,8 @@ class WeakWaveOperator(HyperbolicOperator): # {{{ variable-velocity class VariableCoefficientWeakWaveOperator(HyperbolicOperator): - """This operator discretizes the wave equation - :math:`\\partial_t^2 u = c^2 \\Delta u`. + r"""This operator discretizes the wave equation + :math:`\partial_t^2 u = c^2 \Delta u`. To be precise, we discretize the hyperbolic system diff --git a/grudge/symbolic/compiler.py b/grudge/symbolic/compiler.py index 976beed9..4a58961b 100644 --- a/grudge/symbolic/compiler.py +++ b/grudge/symbolic/compiler.py @@ -592,6 +592,8 @@ class Code(object): # }}} +# }}} + # {{{ assignment aggregration pass @@ -721,8 +723,8 @@ def aggregate_assignments(inf_mapper, instructions, result, other_indirect_origins = get_complete_origins_set( other_assign, skip_levels=1) - if (my_assign not in other_indirect_origins and - other_assign not in my_indirect_origins): + if (my_assign not in other_indirect_origins + and other_assign not in my_indirect_origins): did_work = True # aggregate the two assignments diff --git a/grudge/symbolic/mappers/__init__.py b/grudge/symbolic/mappers/__init__.py index 5304d647..2b0b2242 100644 --- a/grudge/symbolic/mappers/__init__.py +++ b/grudge/symbolic/mappers/__init__.py @@ -658,8 +658,8 @@ class GlobalToReferenceMapper(CSECachingMapperMixin, IdentityMapper): return sum( sym.inverse_metric_derivative( rst_axis, expr.op.xyz_axis, - ambient_dim=self.ambient_dim, dim=self.dim) * - ref_class(rst_axis, dd_in=dd_in)(rec_field) + ambient_dim=self.ambient_dim, dim=self.dim) + * ref_class(rst_axis, dd_in=dd_in)(rec_field) for rst_axis in range(self.dim)) if isinstance(expr.op, op.MassOperator): @@ -677,8 +677,9 @@ class GlobalToReferenceMapper(CSECachingMapperMixin, IdentityMapper): jac_in_surf * self.rec(expr.field)) elif isinstance(expr.op, op.StiffnessOperator): - return op.RefMassOperator()(jac_noquad * - self.rec( + return op.RefMassOperator()( + jac_noquad + * self.rec( op.DiffOperator(expr.op.xyz_axis)(expr.field))) elif isinstance(expr.op, op.DiffOperator): @@ -1048,7 +1049,7 @@ class _InnerDerivativeJoiner(pymbolic.mapper.RecursiveMapper): class DerivativeJoiner(CSECachingMapperMixin, IdentityMapper): - """Joins derivatives: + r"""Joins derivatives: .. math:: diff --git a/grudge/symbolic/primitives.py b/grudge/symbolic/primitives.py index 7c92087d..2afb3d21 100644 --- a/grudge/symbolic/primitives.py +++ b/grudge/symbolic/primitives.py @@ -613,7 +613,7 @@ def mv_normal(dd, ambient_dim, dim=None): pder = ( pseudoscalar(ambient_dim, dim, dd=dd) - / + / # noqa: W504 area_element(ambient_dim, dim, dd=dd)) return cse( # Dorst Section 3.7.2 diff --git a/test/test_grudge.py b/test/test_grudge.py index 9537a31d..cf820f4c 100644 --- a/test/test_grudge.py +++ b/test/test_grudge.py @@ -193,7 +193,7 @@ def test_2d_gauss_theorem(ctx_factory): sym.integral(( sym.nabla(2) * f(sym.nodes(2)) ).sum()) - - + - # noqa: W504 sym.integral( sym.interp("vol", sym.BTAG_ALL)(f(sym.nodes(2))) .dot(sym.normal(sym.BTAG_ALL, 2)), -- GitLab