Browse Source

flake8

drone
Sebastian Heimann 11 months ago
parent
commit
bff37f64f4
  1. 2
      setup.py
  2. 2
      src/apps/grond.py
  3. 1
      src/environment.py
  4. 8
      src/meta.py
  5. 4
      src/problems/plot.py
  6. 2
      src/targets/gnss_campaign/plot.py
  7. 16
      src/targets/satellite/plot.py
  8. 3
      src/targets/waveform_phase_ratio/target.py
  9. 4
      test/__init__.py
  10. 4
      test/common.py

2
setup.py

@ -71,6 +71,7 @@ installed_date = %s
with open(outfile, 'w') as f:
f.write(module_code)
class CustomBuildPyCommand(build_py):
def run(self):
@ -99,6 +100,7 @@ class CustomDevelopCommand(develop):
make_info_module('grond', version, outfile)
super().run()
setup(
cmdclass={
'build_py': CustomBuildPyCommand,

2
src/apps/grond.py

@ -551,7 +551,7 @@ def command_init(args):
sys.stdout.write(config+'\n\n')
logger.info('Hint: To create a project, use: grond init <example> '
'<projectdir>'.format(c=Color, example=args[0]))
'<projectdir>')
elif op.exists(op.abspath(args[1])) and not options.force:
help_and_die(

1
src/environment.py

@ -2,7 +2,6 @@ import time
import logging
import shutil
import os
from contextlib import contextmanager
from grond.config import read_config, write_config
from grond import meta, run_info

8
src/meta.py

@ -61,9 +61,9 @@ def nextpow2(i):
return 2**int(math.ceil(math.log(i) / math.log(2.)))
def gather(l, key, sort=None, filter=None):
def gather(seq, key, sort=None, filter=None):
d = {}
for x in l:
for x in seq:
if filter is not None and not filter(x):
continue
@ -316,8 +316,8 @@ def nslc_to_pattern(s):
raise GrondError('Invalid net.sta.loc.cha pattern: %s' % s)
def nslcs_to_patterns(l):
return [nslc_to_pattern(s) for s in l]
def nslcs_to_patterns(seq):
return [nslc_to_pattern(s) for s in seq]
class SelectionError(GrondError):

4
src/problems/plot.py

@ -709,8 +709,8 @@ class MTLocationPlot(SectionPlotConfig):
default='dc')
normalisation_gamma = Float.T(
default=3.,
help='Normalisation of colors and alpha as :math:`x^\gamma`.'
'A linear colormap/alpha with :math:`\gamma=1`.')
help='Normalisation of colors and alpha as :math:`x^\\gamma`.'
'A linear colormap/alpha with :math:`\\gamma=1`.')
def make(self, environ):
environ.setup_modelling()

2
src/targets/gnss_campaign/plot.py

@ -8,7 +8,7 @@ from pyrocko import orthodrome as od
from grond.plot.config import PlotConfig
from grond.plot.collection import PlotItem
from grond.problems import CMTProblem, RectangularProblem, \
VolumePointProblem, VLVDProblem
VLVDProblem
from ..plot import StationDistributionPlot

16
src/targets/satellite/plot.py

@ -234,8 +234,8 @@ edge marking the upper fault edge. Complete data extent is shown.
arr = num.full_like(scene.displacement, fill_value=num.nan)
qt = scene.quadtree
for syn_v, l in zip(displacements, qt.leaves):
arr[l._slice_rows, l._slice_cols] = syn_v
for syn_v, leaf in zip(displacements, qt.leaves):
arr[leaf._slice_rows, leaf._slice_cols] = syn_v
arr[scene.displacement_mask] = num.nan
@ -313,11 +313,11 @@ edge marking the upper fault edge. Complete data extent is shown.
off_e = source.effective_lon - target.scene.frame.llLon
turE, turN, tllE, tllN = zip(
*[(l.gridE.max()-off_e,
l.gridN.max()-off_n,
l.gridE.min()-off_e,
l.gridN.min()-off_n)
for l in target.scene.quadtree.leaves])
*[(leaf.gridE.max()-off_e,
leaf.gridN.max()-off_n,
leaf.gridE.min()-off_e,
leaf.gridN.min()-off_n)
for leaf in target.scene.quadtree.leaves])
turE, turN = map(max, (turE, turN))
tllE, tllN = map(min, (tllE, tllN))
@ -345,7 +345,7 @@ edge marking the upper fault edge. Complete data extent is shown.
Surface displacements derived from satellite data.
(Left) the input data, (center) the modelled
data and (right) the model residual.
'''.format(meta=scene.meta))
''')
stat_obs = result.statics_obs
stat_syn = result.statics_syn['displacement.los']

3
src/targets/waveform_phase_ratio/target.py

@ -11,8 +11,7 @@ from . import measure as fm
from grond import dataset
from grond.meta import has_get_plot_classes
from ..waveform.target import StoreIDSelector, StoreIDSelectorError,\
Crust2StoreIDSelector, StationDictStoreIDSelector
from ..waveform.target import StoreIDSelector
guts_prefix = 'grond'
logger = logging.getLogger('grond.targets.waveform_phase_ratio.target')

4
test/__init__.py

@ -1,8 +1,8 @@
import matplotlib
matplotlib.use('Agg')
from pyrocko import util
from pyrocko import util # noqa
util.force_dummy_progressbar = True
util.setup_logging('grondtest', 'info')
import warnings
import warnings # noqa
warnings.simplefilter(action='ignore', category=FutureWarning)

4
test/common.py

@ -80,8 +80,8 @@ class Capture(object):
self.orig_stdout.write(data)
def writelines(self, lines):
for l in lines:
self.write(l)
for line in lines:
self.write(line)
def flush(self):
self.file.flush()

Loading…
Cancel
Save