mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2025-12-15 03:17:12 +00:00
Fix odd glitches in cave parsing
This commit is contained in:
@@ -47,8 +47,9 @@ ROOTBLOCK = "rootblock"
|
||||
METRESINFEET = 3.28084
|
||||
UNSEENS = "_unseens.svx"
|
||||
|
||||
IGNOREPREFIX = ["surface", "kataster", "fixedpts", "gpx", "deprecated", "dummy_"]
|
||||
EXCEPTPREFIX = ["surface/terrain", "kataster/kataster-boundaries", "gpx/gpx_publish/essentials", "template", "docs", "deprecated", "subsections", "1623-and-1626-no-schoenberg-hs", "1623-and-1624-and-1626-and-1627", "1623-and-1626", "dummy_file"]
|
||||
IGNOREFILES = ["dummy_file"]
|
||||
IGNOREPREFIX = ["surface", "kataster", "fixedpts", "gpx", "deprecated"]
|
||||
EXCEPTPREFIX = ["surface/terrain", "kataster/kataster-boundaries", "gpx/gpx_publish/essentials", "template", "docs", "deprecated", "subsections", "1623-and-1626-no-schoenberg-hs", "1623-and-1624-and-1626-and-1627", "1623-and-1626"]
|
||||
# ignorenoncave = [
|
||||
# "caves-1623",
|
||||
# "caves-1623/2007-NEU",
|
||||
@@ -1185,12 +1186,15 @@ class LoadingSurvex:
|
||||
cave = self.caveslist[key]
|
||||
print(f"Cave<{cave}> -- {key}")
|
||||
|
||||
for f in IGNOREFILES:
|
||||
if svxid.lower().startswith(f):
|
||||
return False
|
||||
for i in IGNOREPREFIX:
|
||||
if cavepath.lower().startswith(i) or cavepath[11:].lower().startswith(i):
|
||||
message = (f" - {cavepath} starts with <IGNOREPREFIX> (while creating '{svxid}.svx' )")
|
||||
# message = (f" - {cavepath} is an <IGNOREPREFIX> (while looking at '{svxid}.svx' )")
|
||||
# print(message, file=sys.stderr)
|
||||
return False
|
||||
|
||||
|
||||
if cavepath.lower() in self.caveslist: # primed with GCaveLookup
|
||||
return self.caveslist[cavepath.lower()]
|
||||
|
||||
@@ -1200,30 +1204,31 @@ class LoadingSurvex:
|
||||
if path_match:
|
||||
area = path_match.group(1)
|
||||
caveid = path_match.group(2)
|
||||
sluggy = f"{area}-{caveid}"
|
||||
seek = [sluggy, sluggy.replace("1623-","")] # to catch '2023-kt-02' etc . 3-digit searches only work for 1623 area
|
||||
sluggy = f"{area}-{caveid}".lower() # GCaveLookup is all UPPER() and all lower() but not mixed
|
||||
# if this comes from editing a survex file, we may already have loaded 3-digit aliases for 1623- from old wallets,
|
||||
# so be careful here..
|
||||
seek = {sluggy, sluggy.replace("1623-","")} # {} is a set
|
||||
for s in seek:
|
||||
if s in self.caveslist:
|
||||
self.caveslist[cavepath] = self.caveslist[s] # set "caves-1626/107/107" as index to cave 1626-107
|
||||
return self.caveslist[s]
|
||||
|
||||
if cavepath[6:10] in ARGEAREAS:
|
||||
#print(f"ARGE {area=} {caveid=} {cavepath} - {cavepath[11:]}", file=sys.stderr)
|
||||
return do_ARGE_cave(sluggy, caveid, area, svxid)
|
||||
|
||||
cave = create_new_cave(cavepath, svxid, f"Cave mentioned only in a survex file {svxid=}") # uses the pending code to create pending cave descriptions
|
||||
cave = create_new_cave(cavepath, svxid, f"Cave mentioned only in a survex file {svxid=}") # uses the pending code
|
||||
self.caveslist[cavepath.lower()] = cave
|
||||
message = f"\n ! MAKING cave {sluggy} for {cavepath=} {svxid=}"
|
||||
# stash_data_issue(parser="survex", message=message, url="/survexfile/{svxid}.svx", sb=(svxid))
|
||||
return cave
|
||||
else:
|
||||
path_match = rx_svxcollection.search(svxid)
|
||||
if path_match:
|
||||
message = f" ! Recognised survex file which is not a cave at {svxid=}"
|
||||
# message = f" ! Recognised survex file in area {path_match.group(1)} which is not a cave at {svxid=}"
|
||||
# stash_data_issue(parser="survex", message=message, url=None, sb=(svxid))
|
||||
# print(message, file=sys.stderr)
|
||||
return False
|
||||
else:
|
||||
message = f" ! ERROR: no cave at '{svxid}.svx - is not a known cavename format. "
|
||||
message = f" ! ERROR: no cave at '{svxid}.svx' {cavepath=} "
|
||||
print("\n" + message)
|
||||
print("\n" + message, file=sys.stderr)
|
||||
stash_data_issue(parser="survex", message=message, url="{svxid}.svx", sb=(svxid))
|
||||
|
||||
Reference in New Issue
Block a user