From c2818b4c97e2c6a635acf5d46883e1d11470e50e Mon Sep 17 00:00:00 2001 From: Philip Sargent Date: Thu, 29 Jan 2026 12:29:01 +0000 Subject: [PATCH] apparently working, after *fix fiasco --- parsers/survex.py | 24 ++++-------------------- 1 file changed, 4 insertions(+), 20 deletions(-) diff --git a/parsers/survex.py b/parsers/survex.py index 9837a83..aad2e60 100644 --- a/parsers/survex.py +++ b/parsers/survex.py @@ -261,21 +261,6 @@ def hack_save(survexblock): sb.save() # #### Horrible hack to be properly written as a cache - -def blockid_raw(survexfile, name): - if name and survexfile: - return f"{survexfile}-{name}" - return False - -def blockid(survexblock): - """When parsing all the survex file we need to maintain a number of caches as we want to - hit the database with updates only when we have collected all the data. - - But since we have not saved to the database, we don't have a unique survexblock.id that we can - use. So we have to roll our own. - """ - return survexblock._blockid # new UUID - class LoadingSurvex: """A 'survex block' is a *begin...*end set of cave data. A survex file can contain many begin-end blocks, which can be nested, and which can *include @@ -578,13 +563,12 @@ class LoadingSurvex: self.person_pending_cache[survexblock._blockid].add(tm) print(f"-- person_pending_cache {survexblock}, {self.person_pending_cache[survexblock._blockid]}, {tm}") - def get_team_pending(self, survexblock): + def get_team_pending(self, blockid): """A set of *team names added at the end of the survex block """ - if blockid in self.person_pending_cache: - teamnames = person_pending_cache[blockid] # a set of names - person_pending_cache[blockid] = set() #re zero the cache + teamnames = self.person_pending_cache[blockid] # a set of names + self.person_pending_cache[blockid] = set() #re zero the cache return teamnames return @@ -856,7 +840,6 @@ class LoadingSurvex: - fixid = blockid(survexblock) rx_fixline = re.compile(r"(?i)^\s*[*]fix\s+([\w\d_\.\-]+)\s+(?:reference)?\s*([\d\.]*)\s+([\d\.]*)\s+([\d\.]*)\s*;?(.*)$") @@ -872,6 +855,7 @@ class LoadingSurvex: #print(fixline.group(1), fixline.group(5)) #print(f"'{line}'") name = fixdata[0] + fixid = f"{survexblock.survexfile.path}-{name}" if fixid in self.fixes: message = f"! Duplicate *FIX: id '{line}' '{fixid}' ({survexblock}) {survexblock.survexfile.path} " print(self.insp + message)