forked from expo/troggle
Convert .format() to f-strings
This commit is contained in:
parent
ca9a3b5c7b
commit
45a640dfe9
@ -400,7 +400,7 @@ def readcave(filename):
|
|||||||
caves_xslug[slug] = cs
|
caves_xslug[slug] = cs
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
# This fails to do an update! It just crashes.. to be fixed
|
# This fails to do an update! It just crashes.. to be fixed
|
||||||
message = " ! Cave update/create failure : %s, skipping file cave_data/%s with exception\nException: %s" % (slug, context, ex.__class__)
|
message = f" ! Cave update/create failure : {slug}, skipping file cave_data/{context} with exception\nException: {ex.__class__}"
|
||||||
DataIssue.objects.create(parser='caves', message=message)
|
DataIssue.objects.create(parser='caves', message=message)
|
||||||
print(message)
|
print(message)
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ def find_dwg_file(dwgfile, path):
|
|||||||
if len(scanswalletl):
|
if len(scanswalletl):
|
||||||
wallet = scanswalletl[0]
|
wallet = scanswalletl[0]
|
||||||
if len(scanswalletl) > 1:
|
if len(scanswalletl) > 1:
|
||||||
message = "! More than one scan FOLDER matches filter query. [{}]: {} {} {} {}".format(scansfilel[0], mscansdir.group(1), mscansdir.group(2), dwgfile.dwgpath, path)
|
message = f"! More than one scan FOLDER matches filter query. [{scansfilel[0]}]: {mscansdir.group(1)} {mscansdir.group(2)} {dwgfile.dwgpath} {path}"
|
||||||
print(message)
|
print(message)
|
||||||
DataIssue.objects.create(parser='Tunnel', message=message)
|
DataIssue.objects.create(parser='Tunnel', message=message)
|
||||||
|
|
||||||
@ -48,7 +48,7 @@ def find_dwg_file(dwgfile, path):
|
|||||||
plist =[]
|
plist =[]
|
||||||
for sf in scansfilel:
|
for sf in scansfilel:
|
||||||
plist.append(sf.ffile)
|
plist.append(sf.ffile)
|
||||||
message = "! More than one image FILENAME matches filter query. [{}]: {} {} {} {} {}".format(scansfilel[0], mscansdir.group(1), mscansdir.group(2), dwgfile.dwgpath, path, plist)
|
message = f"! More than one image FILENAME matches filter query. [{scansfilel[0]}]: {mscansdir.group(1)} {mscansdir.group(2)} {dwgfile.dwgpath} {path} {plist}"
|
||||||
print(message)
|
print(message)
|
||||||
DataIssue.objects.create(parser='Tunnel', message=message)
|
DataIssue.objects.create(parser='Tunnel', message=message)
|
||||||
scansfile = scansfilel[0]
|
scansfile = scansfilel[0]
|
||||||
@ -100,7 +100,7 @@ def findwalletimage(therionfile, foundpath):
|
|||||||
plist =[]
|
plist =[]
|
||||||
for sf in scansfilel:
|
for sf in scansfilel:
|
||||||
plist.append(sf.ffile)
|
plist.append(sf.ffile)
|
||||||
message = "! More than one image FILENAME matches filter query. [{}]: {} {} {} {} {}".format(scansfilel[0], mscansdir.group(1), mscansdir.group(2), dwgfile.dwgpath, path, plist)
|
message = f"! More than one image FILENAME matches filter query. [{scansfilel[0]}]: {mscansdir.group(1)} {mscansdir.group(2)} {dwgfile.dwgpath} {path} {plist}"
|
||||||
print(message)
|
print(message)
|
||||||
DataIssue.objects.create(parser='Therion', message=message)
|
DataIssue.objects.create(parser='Therion', message=message)
|
||||||
scansfile = scansfilel[0]
|
scansfile = scansfilel[0]
|
||||||
@ -129,7 +129,7 @@ def settherionfileinfo(filetuple):
|
|||||||
ff = os.path.join(settings.DRAWINGS_DATA, therionfile.dwgpath)
|
ff = os.path.join(settings.DRAWINGS_DATA, therionfile.dwgpath)
|
||||||
therionfile.filesize = os.stat(ff)[stat.ST_SIZE]
|
therionfile.filesize = os.stat(ff)[stat.ST_SIZE]
|
||||||
if therionfile.filesize <= 0:
|
if therionfile.filesize <= 0:
|
||||||
message = "! Zero length therion file {}".format(ff)
|
message = f"! Zero length therion file {ff}"
|
||||||
print(message)
|
print(message)
|
||||||
DataIssue.objects.create(parser='Therion', message=message, url=f'/dwgdataraw/{therionfile.dwgpath}')
|
DataIssue.objects.create(parser='Therion', message=message, url=f'/dwgdataraw/{therionfile.dwgpath}')
|
||||||
return
|
return
|
||||||
@ -185,7 +185,7 @@ def settnlfileinfo(dwgfile):
|
|||||||
ff = os.path.join(settings.DRAWINGS_DATA, dwgfile.dwgpath)
|
ff = os.path.join(settings.DRAWINGS_DATA, dwgfile.dwgpath)
|
||||||
dwgfile.filesize = os.stat(ff)[stat.ST_SIZE]
|
dwgfile.filesize = os.stat(ff)[stat.ST_SIZE]
|
||||||
if dwgfile.filesize <= 0:
|
if dwgfile.filesize <= 0:
|
||||||
message = "! Zero length tunnel file {}".format(ff)
|
message = f"! Zero length tunnel file {ff}"
|
||||||
print(message)
|
print(message)
|
||||||
DataIssue.objects.create(parser='Tunnel', message=message, url=f'/dwgdataraw/{dwgfile.dwgpath}')
|
DataIssue.objects.create(parser='Tunnel', message=message, url=f'/dwgdataraw/{dwgfile.dwgpath}')
|
||||||
return
|
return
|
||||||
@ -217,7 +217,7 @@ def setdrwfileinfo(dwgfile):
|
|||||||
ff = Path(settings.DRAWINGS_DATA) / dwgfile.dwgpath
|
ff = Path(settings.DRAWINGS_DATA) / dwgfile.dwgpath
|
||||||
dwgfile.filesize = ff.stat().st_size
|
dwgfile.filesize = ff.stat().st_size
|
||||||
if dwgfile.filesize <= 0:
|
if dwgfile.filesize <= 0:
|
||||||
message = "! Zero length drawing file {}".format(ff)
|
message = f"! Zero length drawing file {ff}"
|
||||||
print(message)
|
print(message)
|
||||||
DataIssue.objects.create(parser='drawings', message=message, url=f'/dwgdataraw/{dwgfile.dwgpath}')
|
DataIssue.objects.create(parser='drawings', message=message, url=f'/dwgdataraw/{dwgfile.dwgpath}')
|
||||||
return
|
return
|
||||||
|
@ -77,7 +77,7 @@ def load_people_expos():
|
|||||||
|
|
||||||
for year in years:
|
for year in years:
|
||||||
lookupAttribs = {'year':year}
|
lookupAttribs = {'year':year}
|
||||||
nonLookupAttribs = {'name':"CUCC expo %s" % year}
|
nonLookupAttribs = {'name':f"CUCC expo {year}"}
|
||||||
|
|
||||||
save_carefully(Expedition, lookupAttribs, nonLookupAttribs)
|
save_carefully(Expedition, lookupAttribs, nonLookupAttribs)
|
||||||
|
|
||||||
|
@ -72,24 +72,24 @@ class MapLocations(object):
|
|||||||
try:
|
try:
|
||||||
k = ent.caveandentrance_set.all()[0].cave
|
k = ent.caveandentrance_set.all()[0].cave
|
||||||
except:
|
except:
|
||||||
message = " ! Failed to get Cave linked to Entrance:{} from:{} best:{}".format(ent.name, ent.filename, ent.best_station())
|
message = f" ! Failed to get Cave linked to Entrance:{ent.name} from:{ent.filename} best:{ent.best_station()}"
|
||||||
DataIssue.objects.create(parser='entrances', message=message)
|
DataIssue.objects.create(parser='entrances', message=message)
|
||||||
print(message)
|
print(message)
|
||||||
raise
|
raise
|
||||||
try:
|
try:
|
||||||
areaName = k.getArea().short_name
|
areaName = k.getArea().short_name
|
||||||
except:
|
except:
|
||||||
message = " ! Failed to get Area on cave '{}' linked to Entrance:{} from:{} best:{}".format(k, ent.name, ent.filename, ent.best_station())
|
message = f" ! Failed to get Area on cave '{k}' linked to Entrance:{ent.name} from:{ent.filename} best:{ent.best_station()}"
|
||||||
DataIssue.objects.create(parser='entrances', message=message)
|
DataIssue.objects.create(parser='entrances', message=message)
|
||||||
print(message)
|
print(message)
|
||||||
raise
|
raise
|
||||||
self.p.append((ent.best_station(), "%s-%s" % (areaName, str(ent)[5:]), ent.needs_surface_work(), str(ent)))
|
self.p.append((ent.best_station(), f"{areaName}-{str(ent)[5:]}", ent.needs_surface_work(), str(ent)))
|
||||||
message = f" - {len(self.p)} entrances linked to caves."
|
message = f" - {len(self.p)} entrances linked to caves."
|
||||||
print(message)
|
print(message)
|
||||||
return self.p
|
return self.p
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return "{} map locations".format(len(self.p))
|
return f"{len(self.p)} map locations"
|
||||||
|
|
||||||
def get_offending_filename(path):
|
def get_offending_filename(path):
|
||||||
"""Used to provide the URL for a line in the DataErrors page
|
"""Used to provide the URL for a line in the DataErrors page
|
||||||
@ -216,11 +216,11 @@ class LoadingSurvex():
|
|||||||
pass # we ignore all these, which is fine.
|
pass # we ignore all these, which is fine.
|
||||||
else:
|
else:
|
||||||
if cmd in ["include", "data", "flags", "title", "entrance","set", "units", "alias", "ref"]:
|
if cmd in ["include", "data", "flags", "title", "entrance","set", "units", "alias", "ref"]:
|
||||||
message = "! Warning. Unparsed [*{}]: '{}' {} - not an error (probably)".format(cmd, line, survexblock.survexfile.path)
|
message = f"! Warning. Unparsed [*{cmd}]: '{line}' {survexblock.survexfile.path} - not an error (probably)"
|
||||||
print(self.insp+message)
|
print(self.insp+message)
|
||||||
DataIssue.objects.create(parser='survex', message=message, url=get_offending_filename(survexblock.survexfile.path))
|
DataIssue.objects.create(parser='survex', message=message, url=get_offending_filename(survexblock.survexfile.path))
|
||||||
else:
|
else:
|
||||||
message = "! Bad unrecognised svx command: [*{}] {} ({}) {}".format(cmd, line, survexblock, survexblock.survexfile.path)
|
message = f"! Bad unrecognised svx command: [*{cmd}] {line} ({survexblock}) {survexblock.survexfile.path}"
|
||||||
print(self.insp+message)
|
print(self.insp+message)
|
||||||
DataIssue.objects.create(parser='survex', message=message, url=get_offending_filename(survexblock.survexfile.path))
|
DataIssue.objects.create(parser='survex', message=message, url=get_offending_filename(survexblock.survexfile.path))
|
||||||
|
|
||||||
@ -250,7 +250,7 @@ class LoadingSurvex():
|
|||||||
if expo:
|
if expo:
|
||||||
if not survexblock.expeditionday: # *date has been set
|
if not survexblock.expeditionday: # *date has been set
|
||||||
# should not happen
|
# should not happen
|
||||||
message = "! *team {} expo ok, expedition day not in *team {} ({}) ".format(expo.year, survexblock.survexfile.path, survexblock )
|
message = f"! *team {expo.year} expo ok, expedition day not in *team {survexblock.survexfile.path} ({survexblock}) "
|
||||||
print(self.insp+message)
|
print(self.insp+message)
|
||||||
DataIssue.objects.create(parser='survex', message=message, url=get_offending_filename(survexblock.survexfile.path))
|
DataIssue.objects.create(parser='survex', message=message, url=get_offending_filename(survexblock.survexfile.path))
|
||||||
|
|
||||||
@ -262,12 +262,12 @@ class LoadingSurvex():
|
|||||||
self.currentpersonexped.append(personexpedition) # used in push/pop block code
|
self.currentpersonexped.append(personexpedition) # used in push/pop block code
|
||||||
personrole.save()
|
personrole.save()
|
||||||
elif known_foreigner(tm): # note, not using .lower()
|
elif known_foreigner(tm): # note, not using .lower()
|
||||||
message = "- *team {} '{}' known foreigner on *team {} ({}) in '{}'".format(expo.year, tm, survexblock.survexfile.path, survexblock, line)
|
message = f"- *team {expo.year} '{tm}' known foreigner on *team {survexblock.survexfile.path} ({survexblock}) in '{line}'"
|
||||||
print(self.insp+message)
|
print(self.insp+message)
|
||||||
# DataIssue.objects.create(parser='survex', message=message, url=get_offending_filename(survexblock.survexfile.path))
|
# DataIssue.objects.create(parser='survex', message=message, url=get_offending_filename(survexblock.survexfile.path))
|
||||||
else:
|
else:
|
||||||
# we know the date and expo, but can't find the person
|
# we know the date and expo, but can't find the person
|
||||||
message = "! *team {} '{}' FAIL personexpedition lookup on *team {} ({}) in '{}'".format(expo.year, tm, survexblock.survexfile.path, survexblock, line)
|
message = f"! *team {expo.year} '{tm}' FAIL personexpedition lookup on *team {survexblock.survexfile.path} ({survexblock}) in '{line}'"
|
||||||
print(self.insp+message)
|
print(self.insp+message)
|
||||||
DataIssue.objects.create(parser='survex', message=message, url=get_offending_filename(survexblock.survexfile.path))
|
DataIssue.objects.create(parser='survex', message=message, url=get_offending_filename(survexblock.survexfile.path))
|
||||||
else:
|
else:
|
||||||
@ -290,13 +290,13 @@ class LoadingSurvex():
|
|||||||
# msg = "! OLD tm='{}' line: '{}' ({}) {}".format(tm, line, survexblock, survexblock.survexfile.path)
|
# msg = "! OLD tm='{}' line: '{}' ({}) {}".format(tm, line, survexblock, survexblock.survexfile.path)
|
||||||
# print(msg, file=sys.stderr)
|
# print(msg, file=sys.stderr)
|
||||||
else:
|
else:
|
||||||
message = "! *team {} ({}) Weird '{}' oldstyle line: '{}'".format(survexblock.survexfile.path, survexblock, mteammember.group(1), line)
|
message = f"! *team {survexblock.survexfile.path} ({survexblock}) Weird '{mteammember.group(1)}' oldstyle line: '{line}'"
|
||||||
print(self.insp+message)
|
print(self.insp+message)
|
||||||
DataIssue.objects.create(parser='survex', message=message, url=get_offending_filename(survexblock.survexfile.path))
|
DataIssue.objects.create(parser='survex', message=message, url=get_offending_filename(survexblock.survexfile.path))
|
||||||
else:
|
else:
|
||||||
nullmember = self.rx_teamabs.match(line) # matches empty role line. Ignore these.
|
nullmember = self.rx_teamabs.match(line) # matches empty role line. Ignore these.
|
||||||
if not nullmember:
|
if not nullmember:
|
||||||
message = "! *team {} ({}) Bad line: '{}'".format(survexblock.survexfile.path, survexblock, line)
|
message = f"! *team {survexblock.survexfile.path} ({survexblock}) Bad line: '{line}'"
|
||||||
print(self.insp+message)
|
print(self.insp+message)
|
||||||
DataIssue.objects.create(parser='survex', message=message, url=get_offending_filename(survexblock.survexfile.path))
|
DataIssue.objects.create(parser='survex', message=message, url=get_offending_filename(survexblock.survexfile.path))
|
||||||
else:
|
else:
|
||||||
@ -305,7 +305,7 @@ class LoadingSurvex():
|
|||||||
record_team_member(tm, survexblock)
|
record_team_member(tm, survexblock)
|
||||||
else:
|
else:
|
||||||
if not mteammember.group(2).lower() in ('none', 'both'):
|
if not mteammember.group(2).lower() in ('none', 'both'):
|
||||||
message = "! Weird *team '{}' newstyle line: '{}' ({}) {}".format(mteammember.group(2), line, survexblock, survexblock.survexfile.path)
|
message = f"! Weird *team '{mteammember.group(2)}' newstyle line: '{line}' ({survexblock}) {survexblock.survexfile.path}"
|
||||||
print(self.insp+message)
|
print(self.insp+message)
|
||||||
DataIssue.objects.create(parser='survex', message=message, url=get_offending_filename(survexblock.survexfile.path))
|
DataIssue.objects.create(parser='survex', message=message, url=get_offending_filename(survexblock.survexfile.path))
|
||||||
|
|
||||||
@ -319,7 +319,7 @@ class LoadingSurvex():
|
|||||||
if splayalias:
|
if splayalias:
|
||||||
self.flagsstar["splayalias"] = True
|
self.flagsstar["splayalias"] = True
|
||||||
else:
|
else:
|
||||||
message = "! Bad *ALIAS: '{}' ({}) {}".format(line, survexblock, survexblock.survexfile.path)
|
message = f"! Bad *ALIAS: '{line}' ({survexblock}) {survexblock.survexfile.path}"
|
||||||
print(self.insp+message)
|
print(self.insp+message)
|
||||||
DataIssue.objects.create(parser='survex', message=message)
|
DataIssue.objects.create(parser='survex', message=message)
|
||||||
|
|
||||||
@ -334,7 +334,7 @@ class LoadingSurvex():
|
|||||||
factor = convert.groups()[1]
|
factor = convert.groups()[1]
|
||||||
self.unitsfactor = float(factor)
|
self.unitsfactor = float(factor)
|
||||||
if debugprint:
|
if debugprint:
|
||||||
message = "! *UNITS NUMERICAL conversion [{}x] '{}' ({}) {}".format(factor, line, survexblock, survexblock.survexfile.path)
|
message = f"! *UNITS NUMERICAL conversion [{factor}x] '{line}' ({survexblock}) {survexblock.survexfile.path}"
|
||||||
print(self.insp+message)
|
print(self.insp+message)
|
||||||
DataIssue.objects.create(parser='survexunits', message=message)
|
DataIssue.objects.create(parser='survexunits', message=message)
|
||||||
|
|
||||||
@ -345,7 +345,7 @@ class LoadingSurvex():
|
|||||||
elif metres:
|
elif metres:
|
||||||
self.units = "metres"
|
self.units = "metres"
|
||||||
else:
|
else:
|
||||||
message = "! *UNITS in YARDS!? - not converted '{}' ({}) {}".format(line, survexblock, survexblock.survexfile.path)
|
message = f"! *UNITS in YARDS!? - not converted '{line}' ({survexblock}) {survexblock.survexfile.path}"
|
||||||
print(self.insp+message)
|
print(self.insp+message)
|
||||||
DataIssue.objects.create(parser='survexunits', message=message)
|
DataIssue.objects.create(parser='survexunits', message=message)
|
||||||
|
|
||||||
@ -392,11 +392,11 @@ class LoadingSurvex():
|
|||||||
pr.save()
|
pr.save()
|
||||||
self.currentpersonexped.append(pe) # used in push/pop block code
|
self.currentpersonexped.append(pe) # used in push/pop block code
|
||||||
elif known_foreigner(pr.personname): # note, not using .lower()
|
elif known_foreigner(pr.personname): # note, not using .lower()
|
||||||
message = "- *team {} '{}' known foreigner on *date {} ({}) in '{}'".format(expo.year, pr.personname, survexblock.survexfile.path, survexblock, line)
|
message = f"- *team {expo.year} '{pr.personname}' known foreigner on *date {survexblock.survexfile.path} ({survexblock}) in '{line}'"
|
||||||
print(self.insp+message)
|
print(self.insp+message)
|
||||||
# DataIssue.objects.create(parser='survex', message=message, url=get_offending_filename(survexblock.survexfile.path))
|
# DataIssue.objects.create(parser='survex', message=message, url=get_offending_filename(survexblock.survexfile.path))
|
||||||
else:
|
else:
|
||||||
message = "! *team {} '{}' FAIL personexpedition lookup on *date {} ({}) '{}'".format(year, pr.personname, survexblock.survexfile.path, survexblock, pr.personname)
|
message = f"! *team {year} '{pr.personname}' FAIL personexpedition lookup on *date {survexblock.survexfile.path} ({survexblock}) '{pr.personname}'"
|
||||||
print(self.insp+message)
|
print(self.insp+message)
|
||||||
DataIssue.objects.create(parser='survex', message=message, url=get_offending_filename(survexblock.survexfile.path))
|
DataIssue.objects.create(parser='survex', message=message, url=get_offending_filename(survexblock.survexfile.path))
|
||||||
|
|
||||||
@ -431,7 +431,7 @@ class LoadingSurvex():
|
|||||||
setdate_on_survexblock(year)
|
setdate_on_survexblock(year)
|
||||||
else:
|
else:
|
||||||
# these errors are reporting the wrong survexblock, which is actually a SurvexFile (!)
|
# these errors are reporting the wrong survexblock, which is actually a SurvexFile (!)
|
||||||
message = "! DATE Error unrecognised '{}-{}' ({}) {}".format(oline, survexblock, type(survexblock), survexblock.survexfile.path)
|
message = f"! DATE Error unrecognised '{oline}-{survexblock}' ({type(survexblock)}) {survexblock.survexfile.path}"
|
||||||
print(self.insp+message)
|
print(self.insp+message)
|
||||||
DataIssue.objects.create(parser='survex', message=message, url=get_offending_filename(survexblock.survexfile.path))
|
DataIssue.objects.create(parser='survex', message=message, url=get_offending_filename(survexblock.survexfile.path))
|
||||||
print(f" {type(survexblock)=}") # survexblock.parent fails as a SurvexFile has no .parent ...ugh.
|
print(f" {type(survexblock)=}") # survexblock.parent fails as a SurvexFile has no .parent ...ugh.
|
||||||
@ -457,7 +457,7 @@ class LoadingSurvex():
|
|||||||
return
|
return
|
||||||
|
|
||||||
if debugprint:
|
if debugprint:
|
||||||
print("! LEG datastar type:{}++{}\n{} ".format(self.datastar["type"].upper(), survexblock.survexfile.path, sline))
|
print(f"! LEG datastar type:{self.datastar['type'].upper()}++{survexblock.survexfile.path}\n{sline} ")
|
||||||
if self.datastar["type"] == "passage":
|
if self.datastar["type"] == "passage":
|
||||||
return
|
return
|
||||||
if self.datastar["type"] == "cartesian":
|
if self.datastar["type"] == "cartesian":
|
||||||
@ -469,7 +469,7 @@ class LoadingSurvex():
|
|||||||
if self.datastar["type"] == "cylpolar":
|
if self.datastar["type"] == "cylpolar":
|
||||||
return
|
return
|
||||||
if debugprint:
|
if debugprint:
|
||||||
print(" !! LEG data lineno:{}\n !! sline:'{}'\n !! datastar['tape']: {}".format(self.lineno, sline, self.datastar["tape"]))
|
print(f" !! LEG data lineno:{self.lineno}\n !! sline:'{sline}'\n !! datastar['tape']: {self.datastar['tape']}")
|
||||||
|
|
||||||
if self.datastar["type"] != "normal":
|
if self.datastar["type"] != "normal":
|
||||||
return
|
return
|
||||||
@ -508,7 +508,7 @@ class LoadingSurvex():
|
|||||||
print("Aliased splay in ", survexblock.survexfile.path)
|
print("Aliased splay in ", survexblock.survexfile.path)
|
||||||
return
|
return
|
||||||
except:
|
except:
|
||||||
message = ' ! datastar parsing from/to incorrect in line %s in %s' % (ls, survexblock.survexfile.path)
|
message = f' ! datastar parsing from/to incorrect in line {ls} in {survexblock.survexfile.path}'
|
||||||
print(self.insp+message)
|
print(self.insp+message)
|
||||||
DataIssue.objects.create(parser='survexleg', message=message, url=get_offending_filename(survexblock.survexfile.path))
|
DataIssue.objects.create(parser='survexleg', message=message, url=get_offending_filename(survexblock.survexfile.path))
|
||||||
return
|
return
|
||||||
@ -516,7 +516,7 @@ class LoadingSurvex():
|
|||||||
try:
|
try:
|
||||||
tape = ls[datastar["tape"]]
|
tape = ls[datastar["tape"]]
|
||||||
except:
|
except:
|
||||||
message = ' ! datastar parsing incorrect in line %s in %s' % (ls, survexblock.survexfile.path)
|
message = f' ! datastar parsing incorrect in line {ls} in {survexblock.survexfile.path}'
|
||||||
print(self.insp+message)
|
print(self.insp+message)
|
||||||
DataIssue.objects.create(parser='survexleg', message=message, url=get_offending_filename(survexblock.survexfile.path))
|
DataIssue.objects.create(parser='survexleg', message=message, url=get_offending_filename(survexblock.survexfile.path))
|
||||||
survexleg.tape = invalid_tape
|
survexleg.tape = invalid_tape
|
||||||
@ -529,19 +529,19 @@ class LoadingSurvex():
|
|||||||
if self.unitsfactor:
|
if self.unitsfactor:
|
||||||
tape = float(tape) * self.unitsfactor
|
tape = float(tape) * self.unitsfactor
|
||||||
if debugprint:
|
if debugprint:
|
||||||
message = " ! Units: Length scaled {}m '{}' in ({}) units:{} factor:{}x".format(tape, ls, survexblock.survexfile.path, self.units, self.unitsfactor)
|
message = f" ! Units: Length scaled {tape}m '{ls}' in ({survexblock.survexfile.path}) units:{self.units} factor:{self.unitsfactor}x"
|
||||||
print(self.insp+message)
|
print(self.insp+message)
|
||||||
DataIssue.objects.create(parser='survexleg', message=message, url=get_offending_filename(survexblock.survexfile.path))
|
DataIssue.objects.create(parser='survexleg', message=message, url=get_offending_filename(survexblock.survexfile.path))
|
||||||
if self.units =="feet":
|
if self.units =="feet":
|
||||||
tape = float(tape) / METRESINFEET
|
tape = float(tape) / METRESINFEET
|
||||||
if debugprint:
|
if debugprint:
|
||||||
message = " ! Units: converted to {:.3f}m from {} '{}' in ({})".format(tape, self.units, ls, survexblock.survexfile.path)
|
message = f" ! Units: converted to {tape:.3f}m from {self.units} '{ls}' in ({survexblock.survexfile.path})"
|
||||||
print(self.insp+message)
|
print(self.insp+message)
|
||||||
DataIssue.objects.create(parser='survexleg', message=message, url=get_offending_filename(survexblock.survexfile.path))
|
DataIssue.objects.create(parser='survexleg', message=message, url=get_offending_filename(survexblock.survexfile.path))
|
||||||
survexleg.tape = float(tape)
|
survexleg.tape = float(tape)
|
||||||
self.legsnumber += 1
|
self.legsnumber += 1
|
||||||
except ValueError:
|
except ValueError:
|
||||||
message = " ! Value Error: Tape misread in line'{}' in {} units:{}".format(ls, survexblock.survexfile.path, self.units)
|
message = f" ! Value Error: Tape misread in line'{ls}' in {survexblock.survexfile.path} units:{self.units}"
|
||||||
print(self.insp+message)
|
print(self.insp+message)
|
||||||
DataIssue.objects.create(parser='survexleg', message=message, url=get_offending_filename(survexblock.survexfile.path))
|
DataIssue.objects.create(parser='survexleg', message=message, url=get_offending_filename(survexblock.survexfile.path))
|
||||||
survexleg.tape = invalid_tape
|
survexleg.tape = invalid_tape
|
||||||
@ -549,14 +549,14 @@ class LoadingSurvex():
|
|||||||
survexblock.legslength += survexleg.tape
|
survexblock.legslength += survexleg.tape
|
||||||
self.slength += survexleg.tape
|
self.slength += survexleg.tape
|
||||||
except ValueError:
|
except ValueError:
|
||||||
message = " ! Value Error: Tape length not added '{}' in {} units:{}".format(ls, survexblock.survexfile.path, self.units)
|
message = f" ! Value Error: Tape length not added '{ls}' in {survexblock.survexfile.path} units:{self.units}"
|
||||||
print(self.insp+message)
|
print(self.insp+message)
|
||||||
DataIssue.objects.create(parser='survexleg', message=message, url=get_offending_filename(survexblock.survexfile.path))
|
DataIssue.objects.create(parser='survexleg', message=message, url=get_offending_filename(survexblock.survexfile.path))
|
||||||
|
|
||||||
try:
|
try:
|
||||||
lcompass = ls[datastar["compass"]]
|
lcompass = ls[datastar["compass"]]
|
||||||
except:
|
except:
|
||||||
message = ' ! Value Error: Compass not found in line %s in %s' % (ls, survexblock.survexfile.path)
|
message = f' ! Value Error: Compass not found in line {ls} in {survexblock.survexfile.path}'
|
||||||
print(self.insp+message)
|
print(self.insp+message)
|
||||||
DataIssue.objects.create(parser='survexleg', message=message, url=get_offending_filename(survexblock.survexfile.path))
|
DataIssue.objects.create(parser='survexleg', message=message, url=get_offending_filename(survexblock.survexfile.path))
|
||||||
lcompass = invalid_compass
|
lcompass = invalid_compass
|
||||||
@ -608,7 +608,7 @@ class LoadingSurvex():
|
|||||||
return
|
return
|
||||||
|
|
||||||
if len(args)< 4:
|
if len(args)< 4:
|
||||||
message = " ! Empty or BAD *REF statement '{}' in '{}'".format(args, survexblock.survexfile.path)
|
message = f" ! Empty or BAD *REF statement '{args}' in '{survexblock.survexfile.path}'"
|
||||||
print(self.insp+message)
|
print(self.insp+message)
|
||||||
DataIssue.objects.create(parser='survex', message=message, url=url)
|
DataIssue.objects.create(parser='survex', message=message, url=url)
|
||||||
return
|
return
|
||||||
@ -634,21 +634,21 @@ class LoadingSurvex():
|
|||||||
print(self.insp+message)
|
print(self.insp+message)
|
||||||
DataIssue.objects.create(parser='survex', message=message, url=url)
|
DataIssue.objects.create(parser='survex', message=message, url=url)
|
||||||
|
|
||||||
refscan = "%s#%s%s" % (yr, letterx, wallet)
|
refscan = f"{yr}#{letterx}{wallet}"
|
||||||
try:
|
try:
|
||||||
if int(wallet)>99:
|
if int(wallet)>99:
|
||||||
message = " ! Wallet *REF {} - very big (more than 99) so probably wrong in '{}'".format(refscan, survexblock.survexfile.path)
|
message = f" ! Wallet *REF {refscan} - very big (more than 99) so probably wrong in '{survexblock.survexfile.path}'"
|
||||||
print(self.insp+message)
|
print(self.insp+message)
|
||||||
DataIssue.objects.create(parser='survex', message=message, url=url)
|
DataIssue.objects.create(parser='survex', message=message, url=url)
|
||||||
except:
|
except:
|
||||||
message = " ! Wallet *REF {} - not numeric in '{}'".format(refscan, survexblock.survexfile.path)
|
message = f" ! Wallet *REF {refscan} - not numeric in '{survexblock.survexfile.path}'"
|
||||||
print(self.insp+message)
|
print(self.insp+message)
|
||||||
DataIssue.objects.create(parser='survex', message=message, url=url)
|
DataIssue.objects.create(parser='survex', message=message, url=url)
|
||||||
|
|
||||||
manywallets = Wallet.objects.filter(walletname=refscan) # assumes all wallets found in earlier pass of data import
|
manywallets = Wallet.objects.filter(walletname=refscan) # assumes all wallets found in earlier pass of data import
|
||||||
if manywallets:
|
if manywallets:
|
||||||
if len(manywallets) > 1:
|
if len(manywallets) > 1:
|
||||||
message = " ! Wallet *REF {} - more than one found {} wallets in db with same id {}".format(refscan, len(manywallets), survexblock.survexfile.path)
|
message = f" ! Wallet *REF {refscan} - more than one found {len(manywallets)} wallets in db with same id {survexblock.survexfile.path}"
|
||||||
print(self.insp+message)
|
print(self.insp+message)
|
||||||
DataIssue.objects.create(parser='survex', message=message, url=url)
|
DataIssue.objects.create(parser='survex', message=message, url=url)
|
||||||
|
|
||||||
@ -738,7 +738,7 @@ class LoadingSurvex():
|
|||||||
cave = survexblock.survexfile.cave)
|
cave = survexblock.survexfile.cave)
|
||||||
qm.save
|
qm.save
|
||||||
except:
|
except:
|
||||||
message = " ! QM{} FAIL to create {} in'{}'".format(qm_no, qm_nearest,survexblock.survexfile.path)
|
message = f" ! QM{qm_no} FAIL to create {qm_nearest} in'{survexblock.survexfile.path}'"
|
||||||
print(insp+message)
|
print(insp+message)
|
||||||
DataIssue.objects.create(parser='survex', message=message, url=get_offending_filename(survexblock.survexfile.path))
|
DataIssue.objects.create(parser='survex', message=message, url=get_offending_filename(survexblock.survexfile.path))
|
||||||
|
|
||||||
@ -766,7 +766,7 @@ class LoadingSurvex():
|
|||||||
self.datastar = copy.deepcopy(self.datastardefault)
|
self.datastar = copy.deepcopy(self.datastardefault)
|
||||||
elif ls[0] == "normal" or ls[0] == "topofil":
|
elif ls[0] == "normal" or ls[0] == "topofil":
|
||||||
if not ("from" in datastar and "to" in datastar):
|
if not ("from" in datastar and "to" in datastar):
|
||||||
message = " ! - Unrecognised *data normal statement '{}' {}|{}".format(args, survexblock.name, survexblock.survexpath)
|
message = f" ! - Unrecognised *data normal statement '{args}' {survexblock.name}|{survexblock.survexpath}"
|
||||||
print(message)
|
print(message)
|
||||||
print(message,file=sys.stderr)
|
print(message,file=sys.stderr)
|
||||||
DataIssue.objects.create(parser='survex', message=message, url=get_offending_filename(survexblock.survexfile.path))
|
DataIssue.objects.create(parser='survex', message=message, url=get_offending_filename(survexblock.survexfile.path))
|
||||||
@ -803,7 +803,7 @@ class LoadingSurvex():
|
|||||||
#DataIssue.objects.create(parser='survex', message=message)
|
#DataIssue.objects.create(parser='survex', message=message)
|
||||||
self.datastar["type"] = ls[0]
|
self.datastar["type"] = ls[0]
|
||||||
else:
|
else:
|
||||||
message = " ! - Unrecognised *data statement '{}' {}|{}".format(args, survexblock.name, survexblock.survexpath)
|
message = f" ! - Unrecognised *data statement '{args}' {survexblock.name}|{survexblock.survexpath}"
|
||||||
print(message)
|
print(message)
|
||||||
print(message,file=sys.stderr)
|
print(message,file=sys.stderr)
|
||||||
DataIssue.objects.create(parser='survex', message=message, url=get_offending_filename(survexblock.survexfile.path))
|
DataIssue.objects.create(parser='survex', message=message, url=get_offending_filename(survexblock.survexfile.path))
|
||||||
@ -820,7 +820,7 @@ class LoadingSurvex():
|
|||||||
for s in argslist:
|
for s in argslist:
|
||||||
flags.append(s)
|
flags.append(s)
|
||||||
if debugprint:
|
if debugprint:
|
||||||
print(" ^ flagslist:{}".format(flags),)
|
print(f" ^ flagslist:{flags}",)
|
||||||
|
|
||||||
if "duplicate" in flags:
|
if "duplicate" in flags:
|
||||||
self.flagsstar["duplicate"] = True
|
self.flagsstar["duplicate"] = True
|
||||||
@ -841,7 +841,7 @@ class LoadingSurvex():
|
|||||||
if self.flagsstar["surface"] == True or self.flagsstar["splay"] == True:
|
if self.flagsstar["surface"] == True or self.flagsstar["splay"] == True:
|
||||||
self.flagsstar["skiplegs"] = True
|
self.flagsstar["skiplegs"] = True
|
||||||
if debugprint:
|
if debugprint:
|
||||||
print(" $ flagslist:{}".format(flags),)
|
print(f" $ flagslist:{flags}",)
|
||||||
|
|
||||||
|
|
||||||
def IdentifyCave(self, cavepath):
|
def IdentifyCave(self, cavepath):
|
||||||
@ -850,13 +850,13 @@ class LoadingSurvex():
|
|||||||
# TO DO - this predates the big revision to Gcavelookup so look at this again carefully
|
# TO DO - this predates the big revision to Gcavelookup so look at this again carefully
|
||||||
path_match = self.rx_cave.search(cavepath)
|
path_match = self.rx_cave.search(cavepath)
|
||||||
if path_match:
|
if path_match:
|
||||||
sluggy = '{}-{}'.format(path_match.group(1), path_match.group(2))
|
sluggy = f'{path_match.group(1)}-{path_match.group(2)}'
|
||||||
guesses = [sluggy.lower(), path_match.group(2).lower()]
|
guesses = [sluggy.lower(), path_match.group(2).lower()]
|
||||||
for g in guesses:
|
for g in guesses:
|
||||||
if g in self.caveslist:
|
if g in self.caveslist:
|
||||||
self.caveslist[cavepath] = self.caveslist[g]
|
self.caveslist[cavepath] = self.caveslist[g]
|
||||||
return self.caveslist[g]
|
return self.caveslist[g]
|
||||||
print(' ! Failed to find cave for {}'.format(cavepath.lower()))
|
print(f' ! Failed to find cave for {cavepath.lower()}')
|
||||||
else:
|
else:
|
||||||
# not a cave, but that is fine.
|
# not a cave, but that is fine.
|
||||||
# print(' ! No regex(standard identifier) cave match for %s' % cavepath.lower())
|
# print(' ! No regex(standard identifier) cave match for %s' % cavepath.lower())
|
||||||
@ -931,9 +931,9 @@ class LoadingSurvex():
|
|||||||
The survexblock passed-in is not necessarily the parent. FIX THIS.
|
The survexblock passed-in is not necessarily the parent. FIX THIS.
|
||||||
"""
|
"""
|
||||||
if debugprint:
|
if debugprint:
|
||||||
print(" # datastack in LoadSurvexFile:{} 'type':".format(svxid), end="")
|
print(f" # datastack in LoadSurvexFile:{svxid} 'type':", end="")
|
||||||
for dict in self.datastack:
|
for dict in self.datastack:
|
||||||
print("'{}' ".format(dict["type"].upper()), end="")
|
print(f"'{dict['type'].upper()}' ", end="")
|
||||||
print("")
|
print("")
|
||||||
|
|
||||||
|
|
||||||
@ -951,7 +951,7 @@ class LoadingSurvex():
|
|||||||
cave = self.IdentifyCave(headpath) # cave already exists in db
|
cave = self.IdentifyCave(headpath) # cave already exists in db
|
||||||
|
|
||||||
if not newdirectory:
|
if not newdirectory:
|
||||||
message = " ! 'None' SurvexDirectory returned from GetSurvexDirectory({})".format(headpath)
|
message = f" ! 'None' SurvexDirectory returned from GetSurvexDirectory({headpath})"
|
||||||
print(message)
|
print(message)
|
||||||
print(message,file=sys.stderr)
|
print(message,file=sys.stderr)
|
||||||
DataIssue.objects.create(parser='survex', message=message, url = f'/survexfile/{svxid}')
|
DataIssue.objects.create(parser='survex', message=message, url = f'/survexfile/{svxid}')
|
||||||
@ -964,7 +964,7 @@ class LoadingSurvex():
|
|||||||
self.ReportNonCaveIncludes(headpath, svxid, depth)
|
self.ReportNonCaveIncludes(headpath, svxid, depth)
|
||||||
|
|
||||||
if not newfile.survexdirectory:
|
if not newfile.survexdirectory:
|
||||||
message = " ! SurvexDirectory NOT SET in new SurvexFile {} ".format(svxid)
|
message = f" ! SurvexDirectory NOT SET in new SurvexFile {svxid} "
|
||||||
print(message)
|
print(message)
|
||||||
print(message,file=sys.stderr)
|
print(message,file=sys.stderr)
|
||||||
DataIssue.objects.create(parser='survex', message=message)
|
DataIssue.objects.create(parser='survex', message=message)
|
||||||
@ -977,9 +977,9 @@ class LoadingSurvex():
|
|||||||
raise
|
raise
|
||||||
|
|
||||||
if debugprint:
|
if debugprint:
|
||||||
print(" # datastack end LoadSurvexFile:{} 'type':".format(svxid), end="")
|
print(f" # datastack end LoadSurvexFile:{svxid} 'type':", end="")
|
||||||
for dict in self.datastack:
|
for dict in self.datastack:
|
||||||
print("'{}' ".format(dict["type"].upper()), end="")
|
print(f"'{dict['type'].upper()}' ", end="")
|
||||||
print("")
|
print("")
|
||||||
|
|
||||||
def ProcessIncludeLine(self, included):
|
def ProcessIncludeLine(self, included):
|
||||||
@ -997,7 +997,7 @@ class LoadingSurvex():
|
|||||||
svxid = edulcni.groups()[0]
|
svxid = edulcni.groups()[0]
|
||||||
if debugprint:
|
if debugprint:
|
||||||
depth = " " * self.depthbegin
|
depth = " " * self.depthbegin
|
||||||
print("{:2}{} - Edulcni survexfile:'{}'".format(self.depthbegin, depth, svxid))
|
print(f"{self.depthbegin:2}{depth} - Edulcni survexfile:'{svxid}'")
|
||||||
if svxid.lower() == debugprinttrigger.lower():
|
if svxid.lower() == debugprinttrigger.lower():
|
||||||
debugprint = False
|
debugprint = False
|
||||||
self.currentsurvexfile.save()
|
self.currentsurvexfile.save()
|
||||||
@ -1056,7 +1056,7 @@ class LoadingSurvex():
|
|||||||
self.depthbegin = 0
|
self.depthbegin = 0
|
||||||
self.datastar = self.datastardefault
|
self.datastar = self.datastardefault
|
||||||
blocklegs = self.legsnumber
|
blocklegs = self.legsnumber
|
||||||
print(self.insp+" - MEM:{:.3f} Reading. parent:{} <> {} ".format(get_process_memory(),survexblock.survexfile.path, survexfile.path))
|
print(self.insp+f" - MEM:{get_process_memory():.3f} Reading. parent:{survexblock.survexfile.path} <> {survexfile.path} ")
|
||||||
self.lineno = 0
|
self.lineno = 0
|
||||||
sys.stderr.flush();
|
sys.stderr.flush();
|
||||||
self.callcount +=1
|
self.callcount +=1
|
||||||
@ -1067,7 +1067,7 @@ class LoadingSurvex():
|
|||||||
# Try to find the cave in the DB if not use the string as before
|
# Try to find the cave in the DB if not use the string as before
|
||||||
path_match = re.search(r"caves-(\d\d\d\d)/(\d+|\d\d\d\d-?\w+-\d+)/", survexblock.survexfile.path)
|
path_match = re.search(r"caves-(\d\d\d\d)/(\d+|\d\d\d\d-?\w+-\d+)/", survexblock.survexfile.path)
|
||||||
if path_match:
|
if path_match:
|
||||||
pos_cave = '%s-%s' % (path_match.group(1), path_match.group(2))
|
pos_cave = f'{path_match.group(1)}-{path_match.group(2)}'
|
||||||
cave = getCaveByReference(pos_cave)
|
cave = getCaveByReference(pos_cave)
|
||||||
if cave:
|
if cave:
|
||||||
survexfile.cave = cave
|
survexfile.cave = cave
|
||||||
@ -1103,7 +1103,7 @@ class LoadingSurvex():
|
|||||||
if blockcount % 800 ==0 :
|
if blockcount % 800 ==0 :
|
||||||
print("\n", file=sys.stderr,end='')
|
print("\n", file=sys.stderr,end='')
|
||||||
mem=get_process_memory()
|
mem=get_process_memory()
|
||||||
print(" - MEM: {:7.2f} MB in use".format(mem),file=sys.stderr)
|
print(f" - MEM: {mem:7.2f} MB in use",file=sys.stderr)
|
||||||
print(" ", file=sys.stderr,end='')
|
print(" ", file=sys.stderr,end='')
|
||||||
sys.stderr.flush()
|
sys.stderr.flush()
|
||||||
|
|
||||||
@ -1114,7 +1114,7 @@ class LoadingSurvex():
|
|||||||
depth = " " * self.depthbegin
|
depth = " " * self.depthbegin
|
||||||
self.insp = depth
|
self.insp = depth
|
||||||
if debugprint:
|
if debugprint:
|
||||||
print("{:2}{} - Begin for :'{}'".format(self.depthbegin,depth, blkid))
|
print(f"{self.depthbegin:2}{depth} - Begin for :'{blkid}'")
|
||||||
pathlist = ""
|
pathlist = ""
|
||||||
for id in self.stackbegin:
|
for id in self.stackbegin:
|
||||||
if len(id) > 0:
|
if len(id) > 0:
|
||||||
@ -1125,27 +1125,27 @@ class LoadingSurvex():
|
|||||||
|
|
||||||
depth = " " * self.depthbegin
|
depth = " " * self.depthbegin
|
||||||
if debugprint:
|
if debugprint:
|
||||||
print("{:2}{} - End from:'{}'".format(self.depthbegin,depth,args))
|
print(f"{self.depthbegin:2}{depth} - End from:'{args}'")
|
||||||
print("{:2}{} - LEGS: {} (n: {}, length:{} units:{})".format(self.depthbegin,
|
print("{:2}{} - LEGS: {} (n: {}, length:{} units:{})".format(self.depthbegin,
|
||||||
depth, self.slength, self.slength, self.legsnumber, self.units))
|
depth, self.slength, self.slength, self.legsnumber, self.units))
|
||||||
|
|
||||||
def pushblock():
|
def pushblock():
|
||||||
nonlocal blkid
|
nonlocal blkid
|
||||||
if debugprint:
|
if debugprint:
|
||||||
print(" # datastack at 1 *begin {} 'type':".format(blkid), end="")
|
print(f" # datastack at 1 *begin {blkid} 'type':", end="")
|
||||||
for dict in self.datastack:
|
for dict in self.datastack:
|
||||||
print("'{}' ".format(dict["type"].upper()), end="")
|
print(f"'{dict['type'].upper()}' ", end="")
|
||||||
print("")
|
print("")
|
||||||
print("'{}' self.datastar ".format(self.datastar["type"].upper()))
|
print(f"'{self.datastar['type'].upper()}' self.datastar ")
|
||||||
# ------------ * DATA
|
# ------------ * DATA
|
||||||
self.datastack.append(copy.deepcopy(self.datastar))
|
self.datastack.append(copy.deepcopy(self.datastar))
|
||||||
# ------------ * DATA
|
# ------------ * DATA
|
||||||
if debugprint:
|
if debugprint:
|
||||||
print(" # datastack at 2 *begin {} 'type':".format(blkid), end="")
|
print(f" # datastack at 2 *begin {blkid} 'type':", end="")
|
||||||
for dict in self.datastack:
|
for dict in self.datastack:
|
||||||
print("'{}' ".format(dict["type"].upper()), end="")
|
print(f"'{dict['type'].upper()}' ", end="")
|
||||||
print("")
|
print("")
|
||||||
print("'{}' self.datastar ".format(self.datastar["type"].upper()))
|
print(f"'{self.datastar['type'].upper()}' self.datastar ")
|
||||||
|
|
||||||
# ------------ * FLAGS
|
# ------------ * FLAGS
|
||||||
self.flagsstack.append(copy.deepcopy(self.flagsstar))
|
self.flagsstack.append(copy.deepcopy(self.flagsstar))
|
||||||
@ -1156,27 +1156,27 @@ class LoadingSurvex():
|
|||||||
nonlocal blkid
|
nonlocal blkid
|
||||||
nonlocal oldflags
|
nonlocal oldflags
|
||||||
if debugprint:
|
if debugprint:
|
||||||
print(" # datastack at *end '{} 'type':".format(blkid), end="")
|
print(f" # datastack at *end '{blkid} 'type':", end="")
|
||||||
for dict in self.datastack:
|
for dict in self.datastack:
|
||||||
print("'{}' ".format(dict["type"].upper()), end="")
|
print(f"'{dict['type'].upper()}' ", end="")
|
||||||
print("")
|
print("")
|
||||||
print("'{}' self.datastar ".format(self.datastar["type"].upper()))
|
print(f"'{self.datastar['type'].upper()}' self.datastar ")
|
||||||
# ------------ * DATA
|
# ------------ * DATA
|
||||||
self.datastar = copy.deepcopy(self.datastack.pop())
|
self.datastar = copy.deepcopy(self.datastack.pop())
|
||||||
# ------------ * DATA
|
# ------------ * DATA
|
||||||
if debugprint:
|
if debugprint:
|
||||||
print(" # datastack after *end '{} 'type':".format(blkid), end="")
|
print(f" # datastack after *end '{blkid} 'type':", end="")
|
||||||
for dict in self.datastack:
|
for dict in self.datastack:
|
||||||
print("'{}' ".format(dict["type"].upper()), end="")
|
print(f"'{dict['type'].upper()}' ", end="")
|
||||||
print("")
|
print("")
|
||||||
print("'{}' self.datastar ".format(self.datastar["type"].upper()))
|
print(f"'{self.datastar['type'].upper()}' self.datastar ")
|
||||||
|
|
||||||
# ------------ * FLAGS
|
# ------------ * FLAGS
|
||||||
self.flagsstar = copy.deepcopy(self.flagsstack.pop())
|
self.flagsstar = copy.deepcopy(self.flagsstack.pop())
|
||||||
# ------------ * FLAGS
|
# ------------ * FLAGS
|
||||||
if debugprint:
|
if debugprint:
|
||||||
if oldflags["skiplegs"] != self.flagsstar["skiplegs"]:
|
if oldflags["skiplegs"] != self.flagsstar["skiplegs"]:
|
||||||
print(" # POP 'any' flag now:'{}' was:{} ".format(self.flagsstar["skiplegs"], oldflags["skiplegs"]))
|
print(f" # POP 'any' flag now:'{self.flagsstar['skiplegs']}' was:{oldflags['skiplegs']} ")
|
||||||
|
|
||||||
def starstatement(star):
|
def starstatement(star):
|
||||||
"""Interprets a survex comamnd where * is the first character on the line, e.g. *begin
|
"""Interprets a survex comamnd where * is the first character on the line, e.g. *begin
|
||||||
@ -1263,7 +1263,7 @@ class LoadingSurvex():
|
|||||||
self.LoadSurvexFlags(args)
|
self.LoadSurvexFlags(args)
|
||||||
if debugprint:
|
if debugprint:
|
||||||
if oldflags["skiplegs"] != self.flagsstar["skiplegs"]:
|
if oldflags["skiplegs"] != self.flagsstar["skiplegs"]:
|
||||||
print(" # CHANGE 'any' flag now:'{}' was:{} ".format(self.flagsstar["skiplegs"], oldflags["skiplegs"]))
|
print(f" # CHANGE 'any' flag now:'{self.flagsstar['skiplegs']}' was:{oldflags['skiplegs']} ")
|
||||||
|
|
||||||
elif self.rx_data.match(cmd):
|
elif self.rx_data.match(cmd):
|
||||||
if self.LoadSurvexDataNormal(survexblock, args):
|
if self.LoadSurvexDataNormal(survexblock, args):
|
||||||
@ -1284,7 +1284,7 @@ class LoadingSurvex():
|
|||||||
elif self.rx_set.match(cmd) and self.rx_names.match(cmd):
|
elif self.rx_set.match(cmd) and self.rx_names.match(cmd):
|
||||||
pass
|
pass
|
||||||
elif self.rx_include.match(cmd):
|
elif self.rx_include.match(cmd):
|
||||||
message = " ! -ERROR *include command not expected here {}. Re-run a full Survex import.".format(path)
|
message = f" ! -ERROR *include command not expected here {path}. Re-run a full Survex import."
|
||||||
print(message)
|
print(message)
|
||||||
print(message,file=sys.stderr)
|
print(message,file=sys.stderr)
|
||||||
DataIssue.objects.create(parser='survex', message=message, )
|
DataIssue.objects.create(parser='survex', message=message, )
|
||||||
@ -1349,7 +1349,7 @@ class LoadingSurvex():
|
|||||||
|
|
||||||
includestmt =self.rx_include.match(svxline)
|
includestmt =self.rx_include.match(svxline)
|
||||||
if not includestmt:
|
if not includestmt:
|
||||||
fcollate.write("{}\n".format(svxline.strip()))
|
fcollate.write(f"{svxline.strip()}\n")
|
||||||
|
|
||||||
sline, comment = self.rx_comment.match(svxline.strip()).groups()
|
sline, comment = self.rx_comment.match(svxline.strip()).groups()
|
||||||
star = self.rx_star.match(sline)
|
star = self.rx_star.match(sline)
|
||||||
@ -1367,8 +1367,8 @@ class LoadingSurvex():
|
|||||||
self.depthinclude += 1
|
self.depthinclude += 1
|
||||||
# fininclude = open(fullpath,'r')
|
# fininclude = open(fullpath,'r')
|
||||||
finincludename = fullpath
|
finincludename = fullpath
|
||||||
fcollate.write(";|*include {}\n".format(includepath))
|
fcollate.write(f";|*include {includepath}\n")
|
||||||
flinear.write("{:2} {} *include {}\n".format(self.depthinclude, indent, includepath))
|
flinear.write(f"{self.depthinclude:2} {indent} *include {includepath}\n")
|
||||||
push = includepath.lower()
|
push = includepath.lower()
|
||||||
self.includestack.append(push)
|
self.includestack.append(push)
|
||||||
#-----------------
|
#-----------------
|
||||||
@ -1381,8 +1381,8 @@ class LoadingSurvex():
|
|||||||
print(message,file=flinear)
|
print(message,file=flinear)
|
||||||
print(message,file=sys.stderr)
|
print(message,file=sys.stderr)
|
||||||
DataIssue.objects.create(parser='survex', message=message, url=get_offending_filename(path))
|
DataIssue.objects.create(parser='survex', message=message, url=get_offending_filename(path))
|
||||||
flinear.write("{:2} {} *edulcni {}\n".format(self.depthinclude, indent, pop))
|
flinear.write(f"{self.depthinclude:2} {indent} *edulcni {pop}\n")
|
||||||
fcollate.write(";|*edulcni {}\n".format(pop))
|
fcollate.write(f";|*edulcni {pop}\n")
|
||||||
# fininclude.close()
|
# fininclude.close()
|
||||||
self.depthinclude -= 1
|
self.depthinclude -= 1
|
||||||
#--------------------------------------------------------
|
#--------------------------------------------------------
|
||||||
@ -1399,16 +1399,16 @@ class LoadingSurvex():
|
|||||||
else:
|
else:
|
||||||
pushargs = " "
|
pushargs = " "
|
||||||
self.stackbegin.append(pushargs.lower())
|
self.stackbegin.append(pushargs.lower())
|
||||||
flinear.write(" {:2} {} *begin {}\n".format(self.depthbegin, depth, args))
|
flinear.write(f" {self.depthbegin:2} {depth} *begin {args}\n")
|
||||||
pass
|
pass
|
||||||
elif re.match("(?i)end$", cmd):
|
elif re.match("(?i)end$", cmd):
|
||||||
depth = " " * self.depthbegin
|
depth = " " * self.depthbegin
|
||||||
flinear.write(" {:2} {} *end {}\n".format(self.depthbegin, depth, args))
|
flinear.write(f" {self.depthbegin:2} {depth} *end {args}\n")
|
||||||
if not args:
|
if not args:
|
||||||
args = " "
|
args = " "
|
||||||
popargs = self.stackbegin.pop()
|
popargs = self.stackbegin.pop()
|
||||||
if popargs != args.lower():
|
if popargs != args.lower():
|
||||||
message = "!! ERROR mismatch in BEGIN/END labels pop!=push '{}'!='{}'\n{}".format(popargs, args, self. stackbegin)
|
message = f"!! ERROR mismatch in BEGIN/END labels pop!=push '{popargs}'!='{args}'\n{self.stackbegin}"
|
||||||
print(message)
|
print(message)
|
||||||
print(message,file=flinear)
|
print(message,file=flinear)
|
||||||
print(message,file=sys.stderr)
|
print(message,file=sys.stderr)
|
||||||
@ -1418,7 +1418,7 @@ class LoadingSurvex():
|
|||||||
pass
|
pass
|
||||||
elif re.match("(?i)title$", cmd):
|
elif re.match("(?i)title$", cmd):
|
||||||
depth = " " * self.depthbegin
|
depth = " " * self.depthbegin
|
||||||
flinear.write(" {:2} {} *title {}\n".format(self.depthbegin, depth, args))
|
flinear.write(f" {self.depthbegin:2} {depth} *title {args}\n")
|
||||||
pass
|
pass
|
||||||
|
|
||||||
indent = " " * self.depthinclude
|
indent = " " * self.depthinclude
|
||||||
@ -1443,7 +1443,7 @@ class LoadingSurvex():
|
|||||||
#print(message,file=sys.stderr)
|
#print(message,file=sys.stderr)
|
||||||
DataIssue.objects.create(parser='survex', message=message, url=get_offending_filename(path))
|
DataIssue.objects.create(parser='survex', message=message, url=get_offending_filename(path))
|
||||||
if self.svxfileslist.count(path) > 2:
|
if self.svxfileslist.count(path) > 2:
|
||||||
message = " ! ERROR. Should have been caught before this. Survex file already *included 2x. Probably an infinite loop so fix your *include statements that include this. Aborting. {}".format(path)
|
message = f" ! ERROR. Should have been caught before this. Survex file already *included 2x. Probably an infinite loop so fix your *include statements that include this. Aborting. {path}"
|
||||||
print(message)
|
print(message)
|
||||||
print(message,file=flinear)
|
print(message,file=flinear)
|
||||||
#print(message,file=sys.stderr)
|
#print(message,file=sys.stderr)
|
||||||
@ -1537,7 +1537,7 @@ class LoadingSurvex():
|
|||||||
self.caverndate = now - 2*365*24*3600
|
self.caverndate = now - 2*365*24*3600
|
||||||
|
|
||||||
if not self.caverndate:
|
if not self.caverndate:
|
||||||
sp = subprocess.run(["which", "{}".format(settings.CAVERN)],
|
sp = subprocess.run(["which", f"{settings.CAVERN}"],
|
||||||
capture_output=True, check=False, text=True)
|
capture_output=True, check=False, text=True)
|
||||||
if sp.returncode != 0:
|
if sp.returncode != 0:
|
||||||
message = f' ! Error running "which" on {settings.CAVERN}'
|
message = f' ! Error running "which" on {settings.CAVERN}'
|
||||||
@ -1573,7 +1573,7 @@ def FindAndLoadSurvex(survexblockroot):
|
|||||||
# Redirect sys.stdout to the file
|
# Redirect sys.stdout to the file
|
||||||
sys.stdout = open('svxblks.log', 'w')
|
sys.stdout = open('svxblks.log', 'w')
|
||||||
|
|
||||||
print(' - Scanning Survex Blocks tree from {}.svx ...'.format(settings.SURVEX_TOPNAME),file=sys.stderr)
|
print(f' - Scanning Survex Blocks tree from {settings.SURVEX_TOPNAME}.svx ...',file=sys.stderr)
|
||||||
survexfileroot = survexblockroot.survexfile # i.e. SURVEX_TOPNAME only
|
survexfileroot = survexblockroot.survexfile # i.e. SURVEX_TOPNAME only
|
||||||
collatefilename = "_" + survexfileroot.path + ".svx"
|
collatefilename = "_" + survexfileroot.path + ".svx"
|
||||||
|
|
||||||
@ -1582,7 +1582,7 @@ def FindAndLoadSurvex(survexblockroot):
|
|||||||
svx_scan.depthinclude = 0
|
svx_scan.depthinclude = 0
|
||||||
fullpathtotop = os.path.join(survexfileroot.survexdirectory.path, survexfileroot.path)
|
fullpathtotop = os.path.join(survexfileroot.survexdirectory.path, survexfileroot.path)
|
||||||
|
|
||||||
print(" - RunSurvexIfNeeded cavern on '{}'".format(fullpathtotop), file=sys.stderr)
|
print(f" - RunSurvexIfNeeded cavern on '{fullpathtotop}'", file=sys.stderr)
|
||||||
svx_scan.RunSurvexIfNeeded(fullpathtotop, fullpathtotop)
|
svx_scan.RunSurvexIfNeeded(fullpathtotop, fullpathtotop)
|
||||||
svx_scan.checkUniqueness(fullpathtotop)
|
svx_scan.checkUniqueness(fullpathtotop)
|
||||||
|
|
||||||
@ -1590,14 +1590,14 @@ def FindAndLoadSurvex(survexblockroot):
|
|||||||
fcollate = open(collatefilename, 'w')
|
fcollate = open(collatefilename, 'w')
|
||||||
|
|
||||||
mem0 = get_process_memory()
|
mem0 = get_process_memory()
|
||||||
print(" - MEM:{:7.2f} MB START".format(mem0),file=sys.stderr)
|
print(f" - MEM:{mem0:7.2f} MB START",file=sys.stderr)
|
||||||
flinear = open('svxlinear.log', 'w')
|
flinear = open('svxlinear.log', 'w')
|
||||||
flinear.write(" - MEM:{:7.2f} MB START {}\n".format(mem0,survexfileroot.path))
|
flinear.write(f" - MEM:{mem0:7.2f} MB START {survexfileroot.path}\n")
|
||||||
print(" ", file=sys.stderr,end='')
|
print(" ", file=sys.stderr,end='')
|
||||||
|
|
||||||
finrootname = Path(settings.SURVEX_DATA, survexfileroot.path + ".svx")
|
finrootname = Path(settings.SURVEX_DATA, survexfileroot.path + ".svx")
|
||||||
fcollate.write(";*include {}\n".format(survexfileroot.path))
|
fcollate.write(f";*include {survexfileroot.path}\n")
|
||||||
flinear.write("{:2} {} *include {}\n".format(svx_scan.depthinclude, indent, survexfileroot.path))
|
flinear.write(f"{svx_scan.depthinclude:2} {indent} *include {survexfileroot.path}\n")
|
||||||
|
|
||||||
import cProfile, pstats
|
import cProfile, pstats
|
||||||
from pstats import SortKey
|
from pstats import SortKey
|
||||||
@ -1612,19 +1612,19 @@ def FindAndLoadSurvex(survexblockroot):
|
|||||||
ps.sort_stats(SortKey.CUMULATIVE)
|
ps.sort_stats(SortKey.CUMULATIVE)
|
||||||
ps.print_stats()
|
ps.print_stats()
|
||||||
|
|
||||||
flinear.write("{:2} {} *edulcni {}\n".format(svx_scan.depthinclude, indent, survexfileroot.path))
|
flinear.write(f"{svx_scan.depthinclude:2} {indent} *edulcni {survexfileroot.path}\n")
|
||||||
fcollate.write(";*edulcni {}\n".format(survexfileroot.path))
|
fcollate.write(f";*edulcni {survexfileroot.path}\n")
|
||||||
mem1 = get_process_memory()
|
mem1 = get_process_memory()
|
||||||
flinear.write("\n - MEM:{:.2f} MB STOP {}\n".format(mem1,survexfileroot.path))
|
flinear.write(f"\n - MEM:{mem1:.2f} MB STOP {survexfileroot.path}\n")
|
||||||
flinear.write(" - MEM:{:.3f} MB ADDITIONALLY USED\n".format(mem1-mem0))
|
flinear.write(f" - MEM:{mem1 - mem0:.3f} MB ADDITIONALLY USED\n")
|
||||||
flinear.write(" - {:,} survex files in linear include list \n".format(len(svx_scan.svxfileslist)))
|
flinear.write(f" - {len(svx_scan.svxfileslist):,} survex files in linear include list \n")
|
||||||
|
|
||||||
print("\n - {:,} runs of survex 'cavern' refreshing .3d files".format(svx_scan.caverncount),file=sys.stderr)
|
print(f"\n - {svx_scan.caverncount:,} runs of survex 'cavern' refreshing .3d files",file=sys.stderr)
|
||||||
print(" - {:,} survex files from tree in linear include list".format(len(svx_scan.svxfileslist)),file=sys.stderr)
|
print(f" - {len(svx_scan.svxfileslist):,} survex files from tree in linear include list",file=sys.stderr)
|
||||||
|
|
||||||
mem1 = get_process_memory()
|
mem1 = get_process_memory()
|
||||||
print(" - MEM:{:7.2f} MB END ".format(mem1),file=sys.stderr)
|
print(f" - MEM:{mem1:7.2f} MB END ",file=sys.stderr)
|
||||||
print(" - MEM:{:7.3f} MB ADDITIONALLY USED".format(mem1-mem0),file=sys.stderr)
|
print(f" - MEM:{mem1 - mem0:7.3f} MB ADDITIONALLY USED",file=sys.stderr)
|
||||||
#
|
#
|
||||||
# Process all the omitted files in :loser: with some exceptions
|
# Process all the omitted files in :loser: with some exceptions
|
||||||
#
|
#
|
||||||
@ -1679,43 +1679,43 @@ def FindAndLoadSurvex(survexblockroot):
|
|||||||
svx_scan.svxfileslist = [] # free memory
|
svx_scan.svxfileslist = [] # free memory
|
||||||
svx_scan = None # Hmm. Does this actually delete all the instance variables if they are lists, dicts etc.?
|
svx_scan = None # Hmm. Does this actually delete all the instance variables if they are lists, dicts etc.?
|
||||||
|
|
||||||
print(" - RunSurvexIfNeeded cavern on '{}'".format(fullpathtotop), file=sys.stderr)
|
print(f" - RunSurvexIfNeeded cavern on '{fullpathtotop}'", file=sys.stderr)
|
||||||
omit_scan.RunSurvexIfNeeded(fullpathtotop, fullpathtotop)
|
omit_scan.RunSurvexIfNeeded(fullpathtotop, fullpathtotop)
|
||||||
omit_scan.checkUniqueness(fullpathtotop)
|
omit_scan.checkUniqueness(fullpathtotop)
|
||||||
|
|
||||||
mem0 = get_process_memory()
|
mem0 = get_process_memory()
|
||||||
print(" - MEM:{:7.2f} MB START '_unseens'".format(mem0),file=sys.stderr)
|
print(f" - MEM:{mem0:7.2f} MB START '_unseens'",file=sys.stderr)
|
||||||
#flinear = open('svxlinear.log', 'w')
|
#flinear = open('svxlinear.log', 'w')
|
||||||
flinear.write(f" - MEM:{mem0:7.2f} MB START '_unseens'\n")
|
flinear.write(f" - MEM:{mem0:7.2f} MB START '_unseens'\n")
|
||||||
print(" ", file=sys.stderr,end='')
|
print(" ", file=sys.stderr,end='')
|
||||||
|
|
||||||
finrootname = fullpathtotop
|
finrootname = fullpathtotop
|
||||||
fcollate.write(";*include {}\n".format('_unseens.svx'))
|
fcollate.write(";*include _unseens.svx\n")
|
||||||
flinear.write("{:2} {} *include {}\n".format(omit_scan.depthinclude, indent, '_unseens'))
|
flinear.write(f"{omit_scan.depthinclude:2} {indent} *include _unseens\n")
|
||||||
stop_dup_warning = True
|
stop_dup_warning = True
|
||||||
#----------------------------------------------------------------
|
#----------------------------------------------------------------
|
||||||
omit_scan.PushdownStackScan(survexblockroot, '_unseens', finrootname, flinear, fcollate)
|
omit_scan.PushdownStackScan(survexblockroot, '_unseens', finrootname, flinear, fcollate)
|
||||||
#----------------------------------------------------------------
|
#----------------------------------------------------------------
|
||||||
stop_dup_warning = False
|
stop_dup_warning = False
|
||||||
|
|
||||||
flinear.write("{:2} {} *edulcni {}\n".format(omit_scan.depthinclude, indent, '_unseens'))
|
flinear.write(f"{omit_scan.depthinclude:2} {indent} *edulcni _unseens\n")
|
||||||
fcollate.write(";*edulcni {}\n".format('_unseens.svx'))
|
fcollate.write(";*edulcni _unseens.svx\n")
|
||||||
mem1 = get_process_memory()
|
mem1 = get_process_memory()
|
||||||
flinear.write("\n - MEM:{:.2f} MB STOP {} OMIT\n".format(mem1,'_unseens.svx'))
|
flinear.write(f"\n - MEM:{mem1:.2f} MB STOP _unseens.svx OMIT\n")
|
||||||
flinear.write(" - MEM:{:.3f} MB ADDITIONALLY USED OMIT\n".format(mem1-mem0))
|
flinear.write(f" - MEM:{mem1 - mem0:.3f} MB ADDITIONALLY USED OMIT\n")
|
||||||
flinear.write(" - {:,} survex files in linear include list OMIT \n".format(len(omit_scan.svxfileslist)))
|
flinear.write(f" - {len(omit_scan.svxfileslist):,} survex files in linear include list OMIT \n")
|
||||||
|
|
||||||
flinear.close()
|
flinear.close()
|
||||||
fcollate.close()
|
fcollate.close()
|
||||||
|
|
||||||
print("\n - {:,} runs of survex 'cavern' refreshing .3d files in the unseen list".format(omit_scan.caverncount),file=sys.stderr)
|
print(f"\n - {omit_scan.caverncount:,} runs of survex 'cavern' refreshing .3d files in the unseen list",file=sys.stderr)
|
||||||
|
|
||||||
print(" - {:,} survex files in linear include list including previously unseen ones \n".format(len(omit_scan.svxfileslist)),file=sys.stderr)
|
print(f" - {len(omit_scan.svxfileslist):,} survex files in linear include list including previously unseen ones \n",file=sys.stderr)
|
||||||
omit_scan = None # Hmm. Does this actually delete all the instance variables if they are lists, dicts etc.?
|
omit_scan = None # Hmm. Does this actually delete all the instance variables if they are lists, dicts etc.?
|
||||||
|
|
||||||
mem1 = get_process_memory()
|
mem1 = get_process_memory()
|
||||||
print(" - MEM:{:7.2f} MB END ".format(mem1),file=sys.stderr)
|
print(f" - MEM:{mem1:7.2f} MB END ",file=sys.stderr)
|
||||||
print(" - MEM:{:7.3f} MB ADDITIONALLY USED".format(mem1-mem0),file=sys.stderr)
|
print(f" - MEM:{mem1 - mem0:7.3f} MB ADDITIONALLY USED",file=sys.stderr)
|
||||||
|
|
||||||
|
|
||||||
# Before doing this, it would be good to identify the *equate and *entrance we need that are relevant to the
|
# Before doing this, it would be good to identify the *equate and *entrance we need that are relevant to the
|
||||||
@ -1741,8 +1741,8 @@ def FindAndLoadSurvex(survexblockroot):
|
|||||||
# ps.sort_stats(SortKey.CUMULATIVE)
|
# ps.sort_stats(SortKey.CUMULATIVE)
|
||||||
# ps.print_stats()
|
# ps.print_stats()
|
||||||
mem1 = get_process_memory()
|
mem1 = get_process_memory()
|
||||||
print("\n - MEM:{:7.2f} MB STOP".format(mem1),file=sys.stderr)
|
print(f"\n - MEM:{mem1:7.2f} MB STOP",file=sys.stderr)
|
||||||
print(" - MEM:{:7.3f} MB ADDITIONALLY USED".format(mem1-mem0),file=sys.stderr)
|
print(f" - MEM:{mem1 - mem0:7.3f} MB ADDITIONALLY USED",file=sys.stderr)
|
||||||
|
|
||||||
# Close the logging file, Restore sys.stdout to our old saved file handle
|
# Close the logging file, Restore sys.stdout to our old saved file handle
|
||||||
sys.stdout.close()
|
sys.stdout.close()
|
||||||
@ -1753,7 +1753,7 @@ def FindAndLoadSurvex(survexblockroot):
|
|||||||
legsnumber = svx_load.legsnumber
|
legsnumber = svx_load.legsnumber
|
||||||
mem1 = get_process_memory()
|
mem1 = get_process_memory()
|
||||||
|
|
||||||
print(" - Number of SurvexDirectories: {:,}".format(len(svx_load.survexdict)))
|
print(f" - Number of SurvexDirectories: {len(svx_load.survexdict):,}")
|
||||||
tf=0
|
tf=0
|
||||||
for d in svx_load.survexdict:
|
for d in svx_load.survexdict:
|
||||||
tf += len(svx_load.survexdict[d])
|
tf += len(svx_load.survexdict[d])
|
||||||
@ -1790,7 +1790,7 @@ def MakeOmitFileRoot(fn):
|
|||||||
|
|
||||||
def LoadSurvexBlocks():
|
def LoadSurvexBlocks():
|
||||||
mem1 = get_process_memory()
|
mem1 = get_process_memory()
|
||||||
print(" - MEM:{:7.2f} MB now ".format(mem1),file=sys.stderr)
|
print(f" - MEM:{mem1:7.2f} MB now ",file=sys.stderr)
|
||||||
|
|
||||||
print(' - Flushing All Survex Blocks...')
|
print(' - Flushing All Survex Blocks...')
|
||||||
# why does this increase memory use by 20 MB ?!
|
# why does this increase memory use by 20 MB ?!
|
||||||
@ -1803,7 +1803,7 @@ def LoadSurvexBlocks():
|
|||||||
SurvexPersonRole.objects.all().delete()
|
SurvexPersonRole.objects.all().delete()
|
||||||
SurvexStation.objects.all().delete()
|
SurvexStation.objects.all().delete()
|
||||||
mem1 = get_process_memory()
|
mem1 = get_process_memory()
|
||||||
print(" - MEM:{:7.2f} MB now. Foreign key objects loaded on deletion. ".format(mem1),file=sys.stderr)
|
print(f" - MEM:{mem1:7.2f} MB now. Foreign key objects loaded on deletion. ",file=sys.stderr)
|
||||||
|
|
||||||
print(" - Flushing survex Data Issues ")
|
print(" - Flushing survex Data Issues ")
|
||||||
DataIssue.objects.filter(parser='survex').delete()
|
DataIssue.objects.filter(parser='survex').delete()
|
||||||
@ -1814,7 +1814,7 @@ def LoadSurvexBlocks():
|
|||||||
DataIssue.objects.filter(parser='xEntrances').delete()
|
DataIssue.objects.filter(parser='xEntrances').delete()
|
||||||
print(" - survex Data Issues flushed")
|
print(" - survex Data Issues flushed")
|
||||||
mem1 = get_process_memory()
|
mem1 = get_process_memory()
|
||||||
print(" - MEM:{:7.2f} MB now ".format(mem1),file=sys.stderr)
|
print(f" - MEM:{mem1:7.2f} MB now ",file=sys.stderr)
|
||||||
|
|
||||||
survexfileroot = MakeSurvexFileRoot()
|
survexfileroot = MakeSurvexFileRoot()
|
||||||
# this next makes a block_object assciated with a file_object.path = SURVEX_TOPNAME
|
# this next makes a block_object assciated with a file_object.path = SURVEX_TOPNAME
|
||||||
@ -1838,7 +1838,7 @@ def LoadSurvexBlocks():
|
|||||||
FindAndLoadSurvex(survexblockroot)
|
FindAndLoadSurvex(survexblockroot)
|
||||||
#----------------------------------------------------------------
|
#----------------------------------------------------------------
|
||||||
memend = get_process_memory()
|
memend = get_process_memory()
|
||||||
print(" - MEMORY start:{:.3f} MB end:{:.3f} MB increase={:.3f} MB".format(memstart,memend, memend-memstart))
|
print(f" - MEMORY start:{memstart:.3f} MB end:{memend:.3f} MB increase={memend - memstart:.3f} MB")
|
||||||
|
|
||||||
survexblockroot.save()
|
survexblockroot.save()
|
||||||
|
|
||||||
@ -1904,14 +1904,14 @@ def LoadPositions():
|
|||||||
print(message)
|
print(message)
|
||||||
|
|
||||||
topdata = os.fspath(Path(settings.SURVEX_DATA) / settings.SURVEX_TOPNAME)
|
topdata = os.fspath(Path(settings.SURVEX_DATA) / settings.SURVEX_TOPNAME)
|
||||||
print(' - Generating a list of Pos from %s.svx and then loading...' % (topdata))
|
print(f' - Generating a list of Pos from {topdata}.svx and then loading...')
|
||||||
|
|
||||||
found = 0
|
found = 0
|
||||||
skip = {}
|
skip = {}
|
||||||
print("\n") # extra line because cavern overwrites the text buffer somehow
|
print("\n") # extra line because cavern overwrites the text buffer somehow
|
||||||
# cavern defaults to using same cwd as supplied input file
|
# cavern defaults to using same cwd as supplied input file
|
||||||
|
|
||||||
completed_process = subprocess.run(["which", "{}".format(settings.CAVERN)],
|
completed_process = subprocess.run(["which", f"{settings.CAVERN}"],
|
||||||
capture_output=True, check=True, text=True)
|
capture_output=True, check=True, text=True)
|
||||||
cav_t = os.path.getmtime(completed_process.stdout.strip())
|
cav_t = os.path.getmtime(completed_process.stdout.strip())
|
||||||
|
|
||||||
@ -1976,17 +1976,17 @@ def LoadPositions():
|
|||||||
if len(sbqs)==1:
|
if len(sbqs)==1:
|
||||||
sb = sbqs[0]
|
sb = sbqs[0]
|
||||||
if len(sbqs)>1:
|
if len(sbqs)>1:
|
||||||
message = " ! MULTIPLE SurvexBlocks {:3} matching Entrance point {} {} '{}'".format(len(sbqs), blockpath, sid, id)
|
message = f" ! MULTIPLE SurvexBlocks {len(sbqs):3} matching Entrance point {blockpath} {sid} '{id}'"
|
||||||
print(message)
|
print(message)
|
||||||
DataIssue.objects.create(parser='entrances', message=message)
|
DataIssue.objects.create(parser='entrances', message=message)
|
||||||
sb = sbqs[0]
|
sb = sbqs[0]
|
||||||
elif len(sbqs)<=0:
|
elif len(sbqs)<=0:
|
||||||
message = " ! ZERO SurvexBlocks matching Entrance point {} {} '{}'".format(blockpath, sid, id)
|
message = f" ! ZERO SurvexBlocks matching Entrance point {blockpath} {sid} '{id}'"
|
||||||
print(message)
|
print(message)
|
||||||
DataIssue.objects.create(parser='entrances', message=message)
|
DataIssue.objects.create(parser='entrances', message=message)
|
||||||
sb = survexblockroot
|
sb = survexblockroot
|
||||||
except:
|
except:
|
||||||
message = ' ! FAIL in getting SurvexBlock matching Entrance point {} {}'.format(blockpath, sid)
|
message = f' ! FAIL in getting SurvexBlock matching Entrance point {blockpath} {sid}'
|
||||||
print(message)
|
print(message)
|
||||||
DataIssue.objects.create(parser='entrances', message=message)
|
DataIssue.objects.create(parser='entrances', message=message)
|
||||||
try:
|
try:
|
||||||
@ -1997,9 +1997,9 @@ def LoadPositions():
|
|||||||
ss.save()
|
ss.save()
|
||||||
found += 1
|
found += 1
|
||||||
except:
|
except:
|
||||||
message = ' ! FAIL to create SurvexStation Entrance point {} {}'.format(blockpath, sid)
|
message = f' ! FAIL to create SurvexStation Entrance point {blockpath} {sid}'
|
||||||
print(message)
|
print(message)
|
||||||
DataIssue.objects.create(parser='entrances', message=message)
|
DataIssue.objects.create(parser='entrances', message=message)
|
||||||
raise
|
raise
|
||||||
print(" - {} SurvexStation entrances found.".format(found))
|
print(f" - {found} SurvexStation entrances found.")
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user