Skip to content

Commit

Permalink
PEP8: various indentation fixes (#403)
Browse files Browse the repository at this point in the history
* PEP8: fix E101: indentation contains mixed spaces and tabs
* PEP8: fix E115: expected an indented block (comment)
* PEP8: fix E121: continuation line under-indented for hanging indent
* PEP8: fix E123: closing bracket does not match indentation of opening bracket's line
* PEP8: fix E221: multiple spaces before operator
* PEP8: fix E241: multiple spaces after ','
  • Loading branch information
neteler committed Jan 12, 2021
1 parent 85c4e1a commit 41c4cb4
Show file tree
Hide file tree
Showing 35 changed files with 198 additions and 198 deletions.
14 changes: 7 additions & 7 deletions grass7/display/d.vect.thematic2/d.vect.thematic2.py
Original file line number Diff line number Diff line change
Expand Up @@ -358,14 +358,14 @@ def main():
grass.fatal(_("Unable to calculate statistics for vector map <%s> "
"(missing minimum/maximum value)" % map))

min = float(stats['min'])
max = float(stats['max'])
min = float(stats['min'])
max = float(stats['max'])
mean = float(stats['mean'])
sd = float(stats['population_stddev'])
q1 = float(stats['first_quartile'])
q2 = float(stats['median'])
q3 = float(stats['third_quartile'])
q4 = max
sd = float(stats['population_stddev'])
q1 = float(stats['first_quartile'])
q2 = float(stats['median'])
q3 = float(stats['third_quartile'])
q4 = max

ptsize = size

Expand Down
16 changes: 8 additions & 8 deletions grass7/general/g.copyall/g.copyall.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,15 @@ def main():
# define variables
#

overwrite = False
mapset = options['mapset'] # prefix for copied maps
datatype = options['datatype'] # prefix for copied maps
filter = options['filter'] # prefix for copied maps
overwrite = False
mapset = options['mapset'] # prefix for copied maps
datatype = options['datatype'] # prefix for copied maps
filter = options['filter'] # prefix for copied maps
filter_type = options['filter_type'] # prefix for copied maps
prefix = options['output_prefix'] # prefix for copied maps
datalist = [] # list of GRASS data files to copy
input = ''
output = ''
prefix = options['output_prefix'] # prefix for copied maps
datalist = [] # list of GRASS data files to copy
input = ''
output = ''
if grass.overwrite():
overwrite = True

Expand Down
48 changes: 24 additions & 24 deletions grass7/gui/wxpython/newgui/mapwindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def __init__(self, parent, giface, Map, frame=None,

# render output objects
self.mapfile = None # image file to be rendered
self.img = None # wx.Image object (self.mapfile)
self.img = None # wx.Image object (self.mapfile)
# decoration overlays
self.overlays = overlays
# images and their PseudoDC ID's for painting and dragging
Expand All @@ -110,10 +110,10 @@ def __init__(self, parent, giface, Map, frame=None,
self.currtxtid = None # PseudoDC id for currently selected text

# zoom objects
self.zoomhistory = [] # list of past zoom extents
self.currzoom = 0 # current set of extents in zoom history being used
self.zoomtype = 1 # 1 zoom in, 0 no zoom, -1 zoom out
self.hitradius = 10 # distance for selecting map decorations
self.zoomhistory = [] # list of past zoom extents
self.currzoom = 0 # current set of extents in zoom history being used
self.zoomtype = 1 # 1 zoom in, 0 no zoom, -1 zoom out
self.hitradius = 10 # distance for selecting map decorations
self.dialogOffset = 5 # offset for dialog (e.g. DisplayAttributesDialog)

# OnSize called to make sure the buffer is initialized.
Expand All @@ -131,8 +131,8 @@ def __init__(self, parent, giface, Map, frame=None,
self.Bind(wx.EVT_ERASE_BACKGROUND, lambda x:None)

# vars for handling mouse clicks
self.dragid = -1
self.lastpos = (0, 0)
self.dragid = -1
self.lastpos = (0, 0)

# list for registration of graphics to draw
self.graphicsSetList = []
Expand Down Expand Up @@ -864,7 +864,7 @@ def MouseDraw(self, pdc = None, begin = None, end = None):
if begin is None:
begin = self.mouse['begin']
if end is None:
end = self.mouse['end']
end = self.mouse['end']

Debug.msg (5, "BufferedWindow2.MouseDraw(): use=%s, box=%s, begin=%f,%f, end=%f,%f" %
(self.mouse['use'], self.mouse['box'],
Expand Down Expand Up @@ -983,7 +983,7 @@ def _computeZoomToPointAndRecenter(self, position, zoomtype):
if zoomtype > 0:
begin = (position[0] - self.Map.width / 4,
position[1] - self.Map.height / 4)
end = (position[0] + self.Map.width / 4,
end = (position[0] + self.Map.width / 4,
position[1] + self.Map.height / 4)
else:
begin = ((self.Map.width - position[0]) / 2,
Expand Down Expand Up @@ -1051,7 +1051,7 @@ def OnMouseWheel(self, event):
return

self.processMouse = False
current = event.GetPositionTuple()[:]
current = event.GetPositionTuple()[:]
wheel = event.GetWheelRotation()
Debug.msg (5, "BufferedWindow2.MouseAction(): wheel=%d" % wheel)

Expand Down Expand Up @@ -1089,7 +1089,7 @@ def OnDragging(self, event):
"""!Mouse dragging
"""
Debug.msg (5, "BufferedWindow2.MouseAction(): Dragging")
current = event.GetPositionTuple()[:]
current = event.GetPositionTuple()[:]
previous = self.mouse['begin']
move = (current[0] - previous[0],
current[1] - previous[1])
Expand Down Expand Up @@ -1270,7 +1270,7 @@ def OnButtonDClick(self, event):
hasattr(self, "digit")):
# select overlay decoration options dialog
clickposition = event.GetPositionTuple()[:]
idlist = self.pdc.FindObjects(clickposition[0], clickposition[1], self.hitradius)
idlist = self.pdc.FindObjects(clickposition[0], clickposition[1], self.hitradius)
if idlist == []:
return
self.dragid = idlist[0]
Expand Down Expand Up @@ -1325,7 +1325,7 @@ def OnMiddleUp(self, event):

# set region in zoom or pan
begin = self.mouse['begin']
end = self.mouse['end']
end = self.mouse['end']

self.Zoom(begin, end, 0) # no zoom

Expand Down Expand Up @@ -1416,7 +1416,7 @@ def Pixel2Cell(self, (x, y)):
w = self.Map.region["center_easting"] - (self.Map.width / 2) * res
n = self.Map.region["center_northing"] + (self.Map.height / 2) * res

east = w + x * res
east = w + x * res
north = n - y * res

return (east, north)
Expand All @@ -1425,7 +1425,7 @@ def Cell2Pixel(self, (east, north)):
"""!Convert real word coordinates to image coordinates
"""
try:
east = float(east)
east = float(east)
north = float(north)
except:
return None
Expand All @@ -1438,7 +1438,7 @@ def Cell2Pixel(self, (east, north)):
w = self.Map.region["center_easting"] - (self.Map.width / 2) * res
n = self.Map.region["center_northing"] + (self.Map.height / 2) * res

x = (east - w) / res
x = (east - w) / res
y = (n - north) / res

return (x, y)
Expand Down Expand Up @@ -1466,8 +1466,8 @@ def Zoom(self, begin, end, zoomtype):
# zoom out
elif zoomtype < 0:
newreg['w'], newreg['n'] = self.Pixel2Cell((-x1 * 2, -y1 * 2))
newreg['e'], newreg['s'] = self.Pixel2Cell((self.Map.width + 2 *
(self.Map.width - x2),
newreg['e'], newreg['s'] = self.Pixel2Cell((self.Map.width + 2 *
(self.Map.width - x2),
self.Map.height + 2 *
(self.Map.height - y2)))
# pan
Expand All @@ -1478,7 +1478,7 @@ def Zoom(self, begin, end, zoomtype):
dx = x1 - self.Map.width / 2
dy = y1 - self.Map.height / 2
newreg['w'], newreg['n'] = self.Pixel2Cell((dx, dy))
newreg['e'], newreg['s'] = self.Pixel2Cell((self.Map.width + dx,
newreg['e'], newreg['s'] = self.Pixel2Cell((self.Map.width + dx,
self.Map.height + dy))

# if new region has been calculated, set the values
Expand Down Expand Up @@ -1814,7 +1814,7 @@ def Distance(self, beginpt, endpt, screen = True):
e1, n1 = beginpt
e2, n2 = endpt

dEast = (e2 - e1)
dEast = (e2 - e1)
dNorth = (n2 - n1)

if self.frame.Map.projinfo['proj'] == 'll' and haveCtypes:
Expand Down Expand Up @@ -1896,9 +1896,9 @@ def __init__(self, parentMapWin, graphicsType, setStatusFunc = None, drawFunc =
# list contains instances of GraphicsSetItem
self.itemsList = []

self.properties = {}
self.graphicsType = graphicsType
self.parentMapWin = parentMapWin
self.properties = {}
self.graphicsType = graphicsType
self.parentMapWin = parentMapWin
self.setStatusFunc = setStatusFunc

if drawFunc:
Expand Down Expand Up @@ -1933,7 +1933,7 @@ def Draw(self, pdc):
itemOrderNum += 1
continue

if self.graphicsType == "point":
if self.graphicsType == "point":
if item.GetPropertyVal("penName"):
self.parentMapWin.pen = self.pens[item.GetPropertyVal("penName")]
else:
Expand Down
46 changes: 23 additions & 23 deletions grass7/gui/wxpython/newgui/render2.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ def __init__(self, ltype, cmd, Map, name = None,
tmpfile = tempfile.mkstemp()[1]
self.maskfile = tmpfile + '.pgm'
if ltype == 'overlay':
self.mapfile = tmpfile + '.png'
self.mapfile = tmpfile + '.png'
else:
self.mapfile = tmpfile + '.ppm'
self.mapfile = tmpfile + '.ppm'
grass.try_remove(tmpfile)
else:
self.mapfile = self.maskfile = None
Expand All @@ -84,9 +84,9 @@ def __init__(self, ltype, cmd, Map, name = None,
self.renderMgr = None

self.Map = Map
self.type = None
self.type = None
self.SetType(ltype)
self.name = name
self.name = name



Expand All @@ -97,8 +97,8 @@ def __init__(self, ltype, cmd, Map, name = None,
else:
self.cmd = utils.CmdToTuple(cmd)

self.active = active
self.hidden = hidden
self.active = active
self.hidden = hidden
self.opacity = opacity

self.forceRender = True
Expand Down Expand Up @@ -378,19 +378,19 @@ def __init__(self, gisrc = None):
@param gisrc alternative gisrc (used eg. by georectifier)
"""
# region/extent settigns
self.wind = dict() # WIND settings (wind file)
self.region = dict() # region settings (g.region)
self.width = 640 # map width
self.height = 480 # map height
self.wind = dict() # WIND settings (wind file)
self.region = dict() # region settings (g.region)
self.width = 640 # map width
self.height = 480 # map height

# list of layers
self.layers = list() # stack of available GRASS layer
self.layers = list() # stack of available GRASS layer

self.overlays = list() # stack of available overlays
self.ovlookup = dict() # lookup dictionary for overlay items and overlays
self.overlays = list() # stack of available overlays
self.ovlookup = dict() # lookup dictionary for overlay items and overlays

# environment settings
self.env = dict()
self.env = dict()

# path to external gisrc
self.gisrc = gisrc
Expand Down Expand Up @@ -506,13 +506,13 @@ def AdjustRegion(self):
computational resolution. Set computational resolution through
g.region.
"""
mapwidth = abs(self.region["e"] - self.region["w"])
mapheight = abs(self.region['n'] - self.region['s'])
mapwidth = abs(self.region["e"] - self.region["w"])
mapheight = abs(self.region['n'] - self.region['s'])

self.region["nsres"] = mapheight / self.height
self.region["ewres"] = mapwidth / self.width
self.region['rows'] = round(mapheight / self.region["nsres"])
self.region['cols'] = round(mapwidth / self.region["ewres"])
self.region["ewres"] = mapwidth / self.width
self.region['rows'] = round(mapheight / self.region["nsres"])
self.region['cols'] = round(mapwidth / self.region["ewres"])
self.region['cells'] = self.region['rows'] * self.region['cols']

Debug.msg (3, "Map.AdjustRegion(): %s" % self.region)
Expand Down Expand Up @@ -584,13 +584,13 @@ def ChangeMapSize(self, (width, height)):
@param width,height map size given as tuple
"""
try:
self.width = int(width)
self.width = int(width)
self.height = int(height)
if self.width < 1 or self.height < 1:
sys.stderr.write(_("Invalid map size %d,%d\n") % (self.width, self.height))
raise ValueError
except ValueError:
self.width = 640
self.width = 640
self.height = 480

Debug.msg(2, "Map.ChangeMapSize(): width=%d, height=%d" %
Expand Down Expand Up @@ -793,7 +793,7 @@ def SetRegion(self, windres = False, windres3 = False):
grass_region += "depths: %d; " % \
(region['depths'])
else:
grass_region += key + ": " + self.wind[key] + "; "
grass_region += key + ": " + self.wind[key] + "; "

Debug.msg (3, "Map.SetRegion(): %s" % grass_region)

Expand Down Expand Up @@ -948,7 +948,7 @@ def Render(self, force = False, windres = False):

tmp_region = os.getenv("GRASS_REGION")
os.environ["GRASS_REGION"] = self.SetRegion(windres)
os.environ["GRASS_RENDER_WIDTH"] = str(self.width)
os.environ["GRASS_RENDER_WIDTH"] = str(self.width)
os.environ["GRASS_RENDER_HEIGHT"] = str(self.height)
driver = UserSettings.Get(group = 'display', key = 'driver', subkey = 'type')
if driver == 'png':
Expand Down
4 changes: 2 additions & 2 deletions grass7/gui/wxpython/newgui/wxgui.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ def OnInit(self):

# create splash screen
introImagePath = os.path.join(globalvar.ETCIMGDIR, "silesia_splash.png")
introImage = wx.Image(introImagePath, wx.BITMAP_TYPE_PNG)
introBmp = introImage.ConvertToBitmap()
introImage = wx.Image(introImagePath, wx.BITMAP_TYPE_PNG)
introBmp = introImage.ConvertToBitmap()
if SC and sys.platform != 'darwin':
# AdvancedSplash is buggy on the Mac as of 2.8.12.1
# and raises annoying (though seemingly harmless) errors everytime the GUI is started
Expand Down
2 changes: 1 addition & 1 deletion grass7/gui/wxpython/wx.metadata/mdlib/mdutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ def grassProfileValidator(md):
(
md.identification.temporalextent_start is (None or '') or
md.identification.temporalextent_end is (None or '')
)):
)):

result["errors"].append(
"Both gmd:EX_TemporalExtent and gmd:CI_Date are missing")
Expand Down
2 changes: 1 addition & 1 deletion grass7/gui/wxpython/wx.mwprecip/mw3.py
Original file line number Diff line number Diff line change
Expand Up @@ -1445,7 +1445,7 @@ def grassTemporalConnection(self, db='postgres'):
'''

def grassConnectionRemote(self):
self.dbConnStr = self.dbName
self.dbConnStr = self.dbName

if self.user and not self.password:
grass.run_command('db.login',
Expand Down
2 changes: 1 addition & 1 deletion grass7/gui/wxpython/wx.rdigit/rdigit/dialogs_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ def CreateNewRaster(parent, title = _('Create new vector map'),
vExternalOut = grass.parse_command('r.external.out', flags = 'p', delimiter = ':')


UsingGDAL = "Not using GDAL" not in vExternalOut
UsingGDAL = "Not using GDAL" not in vExternalOut


if not UsingGDAL:
Expand Down
6 changes: 3 additions & 3 deletions grass7/gui/wxpython/wx.rdigit/rdigit/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@
try:
from rdigit.wxdigit import IRDigit, GV_LINES, CFUNCTYPE
haveRDigit = True
errorMsg = ''
errorMsg = ''
except (ImportError, NameError), err:
haveRDigit = False
errorMsg = err
errorMsg = err
print errorMsg
GV_LINES = -1
GV_LINES = -1

class IRDigit:
def __init__(self):
Expand Down
4 changes: 2 additions & 2 deletions grass7/gui/wxpython/wx.rdigit/rdigit/mapwindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ def __init__(self, parent, giface, Map, frame,
frame = frame, tree = tree, style = style, **kwargs)
self.lmgr = lmgr
self.pdcVector = wx.PseudoDC()
self.toolbar = self.parent.GetToolbar('rdigit')
self.digit = None # wxvdigit.IVDigit
self.toolbar = self.parent.GetToolbar('rdigit')
self.digit = None # wxvdigit.IVDigit
self.existingCoords = list()
self.polygons = list()
self.circles = list()
Expand Down
Loading

0 comments on commit 41c4cb4

Please sign in to comment.