From bdd87578b7c418a4701cf478bd4d7225b64f014a Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner Date: Mon, 5 Dec 2016 20:01:58 -0600 Subject: [PATCH] Run flake8 during CI --- .gitlab-ci.yml | 11 +++++++++++ grudge/models/advection.py | 14 +++++--------- grudge/symbolic/mappers/type_inference.py | 2 +- grudge/symbolic/operators.py | 1 + grudge/symbolic/primitives.py | 9 +++++---- grudge/version.py | 1 - setup.cfg | 8 ++++++++ 7 files changed, 31 insertions(+), 15 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ffd202a2..a865565e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -10,6 +10,7 @@ Python 2.7 POCL: - pocl except: - tags + Python 3.5 POCL: script: - export PY_EXE=python3.5 @@ -22,6 +23,7 @@ Python 3.5 POCL: - pocl except: - tags + Documentation: script: - EXTRA_INSTALL="numpy" @@ -31,3 +33,12 @@ Documentation: - python3.5 only: - master + +Flake8: + script: + - curl -L -O -k https://gitlab.tiker.net/inducer/ci-support/raw/master/prepare-and-run-flake8.sh + - ". ./prepare-and-run-flake8.sh grudge test" + tags: + - python3.5 + except: + - tags diff --git a/grudge/models/advection.py b/grudge/models/advection.py index 56538062..da920cc0 100644 --- a/grudge/models/advection.py +++ b/grudge/models/advection.py @@ -106,15 +106,10 @@ class WeakAdvectionOperator(AdvectionOperatorBase): get_flux_operator, make_stiffness_t, InverseMassOperator, - RestrictToBoundary, - QuadratureGridUpsampler, - QuadratureInteriorFacesGridUpsampler) + RestrictToBoundary) u = Field("u") - to_quad = QuadratureGridUpsampler("quad") - to_int_face_quad = QuadratureInteriorFacesGridUpsampler("quad") - # boundary conditions ------------------------------------------------- bc_in = Field("bc_in") bc_out = RestrictToBoundary(self.outflow_tag)*u @@ -196,9 +191,10 @@ class VariableCoefficientAdvectionOperator(HyperbolicOperator): elif self.flux_type == "upwind": return ( - IfPositive(np.dot(normal, v.avg), - np.dot(normal, v.int) * u.int, # outflow - np.dot(normal, v.ext) * u.ext, # inflow + IfPositive( + np.dot(normal, v.avg), + np.dot(normal, v.int) * u.int, # outflow + np.dot(normal, v.ext) * u.ext, # inflow )) else: raise ValueError("invalid flux type") diff --git a/grudge/symbolic/mappers/type_inference.py b/grudge/symbolic/mappers/type_inference.py index 7f3c9bfe..68b7d9b3 100644 --- a/grudge/symbolic/mappers/type_inference.py +++ b/grudge/symbolic/mappers/type_inference.py @@ -72,7 +72,7 @@ class QuadratureRepresentation(object): # {{{ type information -------------------------------------------------------- -class type_info: +class type_info: # noqa """These classes represent various bits and pieces of information that we may deduce about expressions in our symbolic operator. """ diff --git a/grudge/symbolic/operators.py b/grudge/symbolic/operators.py index e1e9091c..69759298 100644 --- a/grudge/symbolic/operators.py +++ b/grudge/symbolic/operators.py @@ -99,6 +99,7 @@ class ElementwiseLinearOperator(Operator): class InterpolationOperator(Operator): mapper_method = intern("map_interpolation") + interp = InterpolationOperator diff --git a/grudge/symbolic/primitives.py b/grudge/symbolic/primitives.py index 74b6e7df..ace6d42b 100644 --- a/grudge/symbolic/primitives.py +++ b/grudge/symbolic/primitives.py @@ -104,20 +104,20 @@ Geometry data # {{{ DOF description -class DTAG_SCALAR: +class DTAG_SCALAR: # noqa pass -class DTAG_VOLUME_ALL: +class DTAG_VOLUME_ALL: # noqa pass -class DTAG_BOUNDARY: +class DTAG_BOUNDARY: # noqa def __init__(self, tag): self.tag = tag -class QTAG_NONE: +class QTAG_NONE: # noqa pass @@ -309,6 +309,7 @@ class Variable(HasDOFDesc, ExpressionBase, pymbolic.primitives.Variable): mapper_method = "map_grudge_variable" + var = Variable diff --git a/grudge/version.py b/grudge/version.py index 6f813c63..1da70a1e 100644 --- a/grudge/version.py +++ b/grudge/version.py @@ -1,3 +1,2 @@ VERSION = (2015, 1) VERSION_TEXT = ".".join(str(i) for i in VERSION) - diff --git a/setup.cfg b/setup.cfg index 51292424..b785a55c 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,3 +1,11 @@ [flake8] ignore = E126,E127,E128,E123,E226,E241,E242,E265,W503,E402 max-line-length=85 +exclude= + grudge/models/gas_dynamics, + grudge/models/em.py, + grudge/models/burgers.py, + grudge/models/pml.py, + grudge/models/diffusion.py, + grudge/models/nd_calculus.py, + grudge/dt_finding.py -- GitLab