2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2025-12-18 15:07:15 +00:00

fixing redundant messages

This commit is contained in:
2025-07-27 16:16:32 +02:00
parent f0c5168067
commit 57fb3a0078
3 changed files with 24 additions and 20 deletions

View File

@@ -53,9 +53,9 @@ ROOTBLOCK = "rootblock"
METRESINFEET = 3.28084
UNSEENS = "_unseens.svx"
IGNOREFILES = ["dummy_file"]
IGNOREFILES = ["dummy_file", "_dummy_file"]
IGNOREPREFIX = ["surface", "kataster", "gpx", "deprecated"] #"fixedpts",
EXCEPTPREFIX = ["surface/terrain", "kataster/kataster-boundaries", "gpx/gpx_publish", "template", "docs", "deprecated", "subsections", "1623-and-1626-no-schoenberg-hs", "1623-and-1624-and-1626-and-1627", "1623-and-1626", "1623.svx", "1626.svx", "smk-system.svx"]
EXCEPTPREFIX = ["surface/terrain", "kataster/kataster-boundaries", "gpx", "template", "docs", "deprecated", "subsections", "1623-and-1626-no-schoenberg-hs", "1623-and-1624-and-1626-and-1627", "1623-and-1626", "1623.svx", "1626.svx", "smk-system.svx"]
# ignorenoncave = [
# "caves-1623",
# "caves-1623/2007-NEU",
@@ -737,7 +737,7 @@ class LoadingSurvex:
splayalias = re.match(r"(?i)\s*station\s*\-\s*\.\.\s*$", line)
if splayalias:
self.flagsstar["splayalias"] = True
print(line)
print(f"==splayalias {line} in {survexblock=} {survexblock.survexfile.path=}")
else:
message = f"! Bad *ALIAS: '{line}' ({survexblock}) {survexblock.survexfile.path}"
print(self.insp + message)
@@ -941,7 +941,7 @@ class LoadingSurvex:
return
if debugprint:
print(f"! LEG datastar type:{self.datastar['type'].upper()}++{survexblock.survexfile.path}\n{sline} ")
print(f"! LEG datastar type:{self.datastar['type'].upper()}++{survexblock.survexfile.path}\n{sline=} ")
if self.datastar["type"] == "passage":
return
if self.datastar["type"] == "cartesian":
@@ -1137,7 +1137,8 @@ class LoadingSurvex:
refline = self.rx_ref_text.match(args)
if refline:
# a textual reference such as "1996-1999 Not-KH survey book pp 92-95"
print(f"{self.insp} *REF quoted text so ignored:{args} in {survexblock.survexfile.path}")
# this produces a lot of printout, so don't print it
# print(f"{self.insp} *REF quoted text so ignored:{args} in {survexblock.survexfile.path}")
return
if len(args) < 4:
@@ -1268,7 +1269,7 @@ class LoadingSurvex:
# stash_data_issue(parser='survex', message=message)
self.datastar["type"] = ls[0]
elif ls[0] == "cartesian": # We should not ignore this ?! Default for Germans ?
# message = " ! - *data {} blocks ignored. {}|{}" '{}' .format(ls[0].upper(), survexblock.name, args)
# message = f" ! - *data {ls[0].upper()} blocks ignored. {survexblock.name}|{args}"
# print(message)
# print(message,file=sys.stderr)
# stash_data_issue(parser='survex', message=message)
@@ -1354,7 +1355,7 @@ class LoadingSurvex:
print(f"BAD CAVE TYPE '{type(cave)}'{cave}' -- {key}'")
for key in self.caveslist:
cave = self.caveslist[key]
print(f"Cave<{cave}> -- {key}")
# print(f"Cave<{cave}> -- {key}")
for f in IGNOREFILES:
if svxid.lower().startswith(f):
@@ -1405,8 +1406,8 @@ class LoadingSurvex:
return False
def LoadSurvexFile(self, svxid):
"""Creates SurvexFile in the database, and SurvexDirectory if needed
Creates a new current survexfile and valid .survexdirectory
"""Creates SurvexFile in the database if needed
Creates a new current survexfile a
Inspects the parent folder of the survexfile and uses that to decide if this is
a cave we know.
@@ -1425,7 +1426,7 @@ class LoadingSurvex:
print("")
depth = " " * self.depthbegin
print("{:2}{} - NEW survexfile:'{}'".format(self.depthbegin, depth, svxid))
# print(f"{self.depthbegin:2}{depth} - NEW survexfile:'{svxid}' in LoadSurvexFile")
headpath = os.path.dirname(svxid)
newfile, created = SurvexFile.objects.update_or_create(path=svxid)
@@ -1855,7 +1856,7 @@ class LoadingSurvex:
legslength=0.0,
)
newsurvexblock.save()
print(f"SB: #{newsurvexblock.id} '{newsurvexblock}' parent:{newsurvexblock.parent} f:{newsurvexblock.survexfile}")
# print(f"SB: #{newsurvexblock.id} '{newsurvexblock}' parent:{newsurvexblock.parent} f:{newsurvexblock.survexfile}")
newsurvexblock.title = (
"(" + survexblock.title + ")"
) # copy parent inititally, overwrite if it has its own
@@ -1876,12 +1877,12 @@ class LoadingSurvex:
try:
survexblock.parent.save() # django insists on this although it is already saved !?
except:
print(survexblock.parent, file=sys.stderr)
print(f"{survexblock.parent=}", file=sys.stderr)
raise
try:
survexblock.save() # save to db at end of block
except:
print(survexblock, file=sys.stderr)
print(f"{survexblock=}", file=sys.stderr)
raise
confirm_team_on_trip(survexblock)
# POP state ++++++++++++++
@@ -1918,9 +1919,10 @@ class LoadingSurvex:
elif self.rx_data.match(cmd):
if self.LoadSurvexDataNormal(survexblock, args):
# print(f"just normal data {cmd=} {args=} {survexblock=}", file=sys.stderr)
pass
else:
# Abort, we do not cope with this *data format
# returns false i.e. something we do not need to worry about
return
elif self.rx_alias.match(cmd):
self.LoadSurvexAlias(survexblock, args)
@@ -1945,6 +1947,8 @@ class LoadingSurvex:
message=message,
)
else:
if cmd not in ["equate", "export", "instrument", "calibrate", "cs", "require", "declination", "infer", "case"]:
print(f"FALLTHROUGH *{cmd=} {survexblock=} {survexblock.parent=}")
self.LoadSurvexFallThrough(survexblock, args, cmd)
# this is a python generator idiom.
@@ -2037,7 +2041,7 @@ class LoadingSurvex:
# -----------------
pop = self.includestack.pop()
if pop != push:
message = "!! ERROR mismatch *include pop!=push {}".format(pop, push, self.includestack)
message = "!! ERROR mismatch *include pop!=push {pop=} {push=} at {self.includestack)}"
print(message)
print(message, file=flinear)
print(message, file=sys.stderr)
@@ -2575,8 +2579,6 @@ def display_contents(blocks):
sfs = SurvexFile.objects.filter(survexblock=b)
for sf in sfs:
print(f" SF {sf}")
# print(f" SD {sf.survexdirectory} {sf.survexdirectory.cave}")
# print(f" SD {sf.survexdirectory} {sf.survexdirectory.path}")
ws = Wallet.objects.filter(survexblock=b)
for w in ws:
@@ -2683,8 +2685,7 @@ def parse_one_file(fpath): # --------------------------------------in progress--
later.
This all needs refactoring.
We also need to re-plumb the fileroot after importing, so that
the new survexfile appears in the survexdirectory lists?
We also need to re-plumb the fileroot after importing?
Rather than just arbitrarily creating something,
we should see if this is a known cave first. If it isn't dont' bother