Skip to content

Commit

Permalink
Update some python code to remove errors
Browse files Browse the repository at this point in the history
Also excludes the dev directory from linting
  • Loading branch information
mandli committed Jun 2, 2024
1 parent 5d100da commit 6d6dac1
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
run: |
cd ${CLAW}/amrclaw
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics --exclude dev
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
Expand Down
10 changes: 5 additions & 5 deletions examples/acoustics_2d_adjoint/run_adjoint_flagging.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@

import os

currentdir = os.getcwd()
adjointdir = currentdir + '/adjoint'
current_dir = os.getcwd()
adjoint_dir = os.path.join(current_dir, "adjoint")

# Running the adjoint problem
os.chdir(adjointdir)
os.chdir(adjoint_dir)
os.system('make new')
os.system('make .plots')

# Running the forward problem
os.chdir(currentdir)
os.chdir(current_dir)
os.system('make new')
os.system('make .plots')

print 'Finished running example with adjoint refinement'
print('Finished running example with adjoint refinement')
6 changes: 3 additions & 3 deletions src/python/amrclaw/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ def __init__(self, num_dim, region=None):
self.convert_old_region(region)


def convert_old_region(region):
def convert_old_region(self, region):
"""
Take a list region = [minlevel, maxlevel, t1, t2, x1, x2, y1, y2]
in the old style and convert to a new flagregion.
Expand Down Expand Up @@ -266,10 +266,10 @@ def __init__(self,flagregions=None,num_dim=2):

super(FlagRegionData,self).__init__()

if flagregions is None or not isinstance(regions,list):
if flagregions is None or not isinstance(flagregions,list):
self.add_attribute('flagregions',[])
else:
self.add_attribute('flagregions',regions)
self.add_attribute('flagregions',flagregions)
self.add_attribute('num_dim',num_dim)


Expand Down
2 changes: 1 addition & 1 deletion tests/advection_1d_example1/setplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from numpy import linspace
probdata = ClawData()
probdata.read('setprob.data', force=True)
print "Parameters: u = %g, beta = %g" % (probdata.u, probdata.beta)
print("Parameters: u = %g, beta = %g" % (probdata.u, probdata.beta))

def qtrue(x,t):
"""
Expand Down

0 comments on commit 6d6dac1

Please sign in to comment.