whitespace cleanup

This commit is contained in:
olly 2015-06-20 10:51:19 +12:00
parent 293441a503
commit 05b55391d6

View File

@ -56,7 +56,7 @@ def exists_in_path(cmd):
extensions = os.environ.get("PATHEXT", "").split(os.pathsep)
for directory in os.environ.get("PATH", "").split(os.pathsep):
base = os.path.join(directory, cmd)
base = os.path.join(directory, cmd)
options = [base] + [(base + ext) for ext in extensions]
for filename in options:
if os.path.exists(filename):
@ -87,7 +87,7 @@ def find_location(cave):
if(cave[fixtype]):
return positions[cave[fixtype]]
return 0
def is_explored(cave):
s = cave["Kat Status Code"]
@ -95,7 +95,7 @@ def is_explored(cave):
s = s.replace("(?)","")
if s[-1] == " ": s=s[:-1]
if (not s):
print "Rogue space in " + find_effective_number(cave)
print "Rogue space in " + find_effective_number(cave)
return "<td></td>"
code = s[-1]
if code == '+': status = "good"
@ -186,8 +186,8 @@ def get_img_name(maparea):
# big map first (zoom factor ignored)
maps = {
# id left top right bottom zoom
# G&K G&K G&K G&K factor
# id left top right bottom zoom description
# G&K G&K G&K G&K factor
# DO NOT just change the coordinates of "all" - they MUST match the borders of the scanned map.
"all": [34394.9, 84508.6, 37399.4, 80895.6, 1.0, "All"],
"40": [36275.6, 82392.5, 36780.3, 81800.0, 3.0, "Eish&ouml;hle"],
@ -197,7 +197,7 @@ maps = {
"gk": [36000.0, 86300.0, 38320.0, 84400.0, 4.0, "Grie&szlig;kogel Area"],
}
# Keys in the order in which we want the maps output
mapcodes = ["all", "gk", "40", "76", "204", "tc"]
mapcodes = ["all", "gk", "40", "76", "204", "tc"]
# Field codes
L = 0
T = 1
@ -261,7 +261,7 @@ def mungecoord(x, y, mapcode):
# image is 1417 by 2201
# FACTOR1 = 1000.0 / (36670.0-34542.0)
# FACTOR2 = (1201.0-562.0) / (83317 - 81967)
# FACTOR = (FACTOR1 + FACTOR2)/2
# FACTOR = (FACTOR1 + FACTOR2)/2
# The factors aren't the same as the scanned map's at a slight angle. I
# can't be bothered to fix this. Since we zero on the Hinter it makes
# very little difference for caves in the areas round 76 or 204.
@ -291,7 +291,7 @@ def plot(loctuple, number, area, label):
def writeout_imagemap(data, mapname):
# Munge the list of coordinates into a proper image map.
# There is a wrinkle here: the HTML spec gives priority
# There is a wrinkle here: the HTML spec gives priority
# to the _first_ defined elt, so we swap the order!
n = len(data)
htmlfile.write("<map id=\"%s\" name=\"%s\">" % (mapname, mapname))
@ -353,11 +353,11 @@ for fnm in ("../all.3d", "../alltracks.3d"):
)? #end of optional flags group
$ #end of the line
''', l, re.VERBOSE)
if not match:
if not match:
print "Unknown: " + l
continue
act,E,N,alt,name,flags = match.groups()
# print "act:%s, E:%s, N:%s, name:%s flags:%s" % (act,E,N,name,flags)
# Only need to process NODEs once
@ -387,24 +387,24 @@ for fnm in ("../all.3d", "../alltracks.3d"):
surfacecolour = "#008000"
repath = re.compile(r'^')
print "Done"
cavestoplot = []
for cave in cavetab:
if cave["Link file"]: continue
number = find_effective_number(cave)
if(cave["Multiple entrances"] not in ["", "yes"]):
if cave["Multiple entrances"] not in ["", "yes"]):
number = "&mdash;" + cachednumber + cave["Entrances"]
shortnumber = cachednumber
if not cave["Area"]: cave["Area"] = cachedarea
if not cave["Name"]: cave["Name"] = cachedname
else:
else:
cachednumber = number
shortnumber = number
cachedname = cave["Name"] or cave["Unofficial Name"]
cachedarea = cave["Area"]
area = cave["Area"]
# We have some areas like '2b or 4 (unclear)' - just chop the space
# We have some areas like '2b or 4 (unclear)' - just chop the space
# and everything after it for these.
area = re.sub(r' .*', "", area)
if area == '1626' or area == 'nonexistent': continue
@ -414,11 +414,11 @@ for cave in cavetab:
except:
print "Unable to find location for %s" % (number)
else:
label = find_label(cave, shortnumber)
label = find_label(cave, shortnumber)
if(cave["Multiple entrances"] == "yes"):
locn = "<td colspan=\"3\">&nbsp;</td>"
elif(loctuple):
locn = "<td class=\"locn good\">%d</td><td class=\"locn good\">%d</td><td class=\"locn good\">%d</td>" % loctuple
locn = "<td class=\"locn good\">%d</td><td class=\"locn good\">%d</td><td class=\"locn good\">%d</td>" % loctuple
cavestoplot.append((loctuple, number, area, label))
else:
locn = "<td colspan=\"3\" class=%s>" % findability_color(cave) + (cave["Findability"] or '?') + "</td>"
@ -489,7 +489,7 @@ for p in fakedpositions:
print "Couldn't understand" + repr(chomp(p))
continue
# Find the area with this cave in
# Find the area with this cave in
area = ''
for tryarea in areas:
for (number, cave, locn) in cavelists[tryarea]:
@ -500,7 +500,7 @@ for p in fakedpositions:
# but I don't know how to in Python
if area != '':
break
(x,y,d) = map(float, (x,y,d))
for maparea in maps.keys():
lo = mungecoord(x-d, y+d, maparea)
@ -518,7 +518,7 @@ for p in fakedpositions:
plot(positions["laser.0_7"], "BNase", "6", "Br&auml;uning Nase laser point")
plot(positions["226-96"], "BZkn", "6", "Br&auml;uning Zinken trig point")
plot(positions["vd1"],"VD1","6", "VD1 survey point")
plot(positions["laser.kt114_96"],"HSK","6", "Hinterer Schwarzmooskogel trig point")
plot(positions["laser.kt114_96"],"HSK","6", "Hinterer Schwarzmooskogel trig point")
plot(positions["2000"],"Nipple","6", "Nipple (Wei&szlig;e Warze)")
plot(positions["3000"],"VSK","6", "Vorderer Schwarzmooskogel summit")
plot(positions["topcamp"], "TC", "6", "Top Camp")
@ -551,7 +551,7 @@ for area in areas:
if cave["Autogen file"]:
htmlfile.write("<td><a href=\"../%s\">%s</a></td><td><a id=\"id%s\">%s</a></td>" % (cave["Autogen file"], longnumber(cave, number), number.replace("&mdash;", ""), cave["Name"] or cave["Unofficial Name"]))
else:
htmlfile.write("<td>%s</td><td><a id=\"id%s\">%s</a></td>" % (longnumber(cave, number), number.replace("&mdash;", ""), cave["Name"] or cave["Unofficial Name"]))
htmlfile.write("<td>%s</td><td><a id=\"id%s\">%s</a></td>" % (longnumber(cave, number), number.replace("&mdash;", ""), cave["Name"] or cave["Unofficial Name"]))
htmlfile.write(is_explored(cave))
htmlfile.write(have_survey_data(cave))
@ -563,7 +563,7 @@ for area in areas:
if(cave["Findability"] != "Surveyed" and cave["Multiple entrances"] != "yes"):
htmlfile.write("<td class=\"locn\">%s %s</td>" % (cave["Location"], cave["Bearings"]))
htmlfile.write("</tr>\n")
htmlfile.write("</table>\n")
for maparea in imgmaps.keys():