summaryrefslogtreecommitdiffstats
path: root/parsers/survex.py
diff options
context:
space:
mode:
authorPhilip Sargent <philip.sargent@gmail.com>2023-07-24 15:26:36 +0300
committerPhilip Sargent <philip.sargent@gmail.com>2023-07-24 15:26:36 +0300
commitc31615b1ff48273e0e2a03139cd8eff33fbf788e (patch)
treede7da22760ad3d51b92b545aae479eed4156a4b6 /parsers/survex.py
parent3bd7684d4b41e72a336f7ae0e738f7c3ea9ff522 (diff)
downloadtroggle-c31615b1ff48273e0e2a03139cd8eff33fbf788e.tar.gz
troggle-c31615b1ff48273e0e2a03139cd8eff33fbf788e.tar.bz2
troggle-c31615b1ff48273e0e2a03139cd8eff33fbf788e.zip
clean up after Mark changed things a bit
Diffstat (limited to 'parsers/survex.py')
-rw-r--r--parsers/survex.py35
1 files changed, 23 insertions, 12 deletions
diff --git a/parsers/survex.py b/parsers/survex.py
index 8ba7866..2be2217 100644
--- a/parsers/survex.py
+++ b/parsers/survex.py
@@ -435,23 +435,34 @@ class LoadingSurvex:
self.currentdate = self.inheritdate # unecessary duplication
# Not an error, so not put in DataIssues, but is printed to debug output
message = (
- f"- No *date. INHERITING date from ({survexblock.parent})-{survexblock.parent.survexfile.path} to ({survexblock})-{survexblock.survexfile.path} {self.inheritdate:%Y-%m-%d}"
+ f"- No *date. INHERITING date '{self.inheritdate:%Y-%m-%d}' from ({survexblock.parent})-{survexblock.parent.survexfile.path} to ({survexblock})-{survexblock.survexfile.path} {self.inheritdate:%Y-%m-%d}"
)
print(self.insp + message)
# stash_data_issue(
# parser="survex", message=message, url=None, sb=(survexblock.survexfile.path) # child
# )
if survexblock.survexfile != survexblock.parent.survexfile:
- # This is noteworthy, however.
- message = (
- f"- Warning *date INHERITED from DIFFERENT file:\n ({survexblock.parent})-{survexblock.parent.survexfile.path} to ({survexblock})-{survexblock.survexfile.path} {self.inheritdate:%Y-%m-%d}\n {self.stackbegin} {self.inheritdate:%Y-%m-%d}"
- )
- print(self.insp + message)
- stash_data_issue(
- parser="survex", message=message, url=None, sb=(survexblock.parent.survexfile.path) # PARENT
- )
-
- return self.inheritdate
+ # This is noteworthy, however.
+
+ if survexblock.parent.name == "rootblock":
+ # Not a sensible thing to inherit a date from, even if a date exists, which it shouldn't...
+ message = (
+ f"- No *date. But not sensible to inherit from rootblock. From ({survexblock.parent})-{survexblock.parent.survexfile.path} to ({survexblock})-{survexblock.survexfile.path} {self.inheritdate:%Y-%m-%d}"
+ )
+ print(self.insp + message)
+ # stash_data_issue(
+ # parser="survex", message=message, url=None, sb=(survexblock.survexfile.path)
+ # )
+ return
+ else:
+ message = (
+ f"- Warning *date '{self.inheritdate:%Y-%m-%d}' INHERITED from DIFFERENT file:\n ({survexblock.parent})-{survexblock.parent.survexfile.path} to ({survexblock})-{survexblock.survexfile.path} {self.inheritdate:%Y-%m-%d}\n {self.stackbegin} {self.inheritdate:%Y-%m-%d}"
+ )
+ print(self.insp + message)
+ stash_data_issue(
+ parser="survex", message=message, url=None, sb=(survexblock.parent.survexfile.path) # PARENT
+ )
+ return self.inheritdate
else:
# This is not an error in the Expo dataset.
# Many files just holding *include lines do not have dates.
@@ -2203,7 +2214,7 @@ def FindAndLoadSurvex(survexblockroot):
)
check_team_cache()
print(f" -- Now loading the previously-omitted survex files.", file=sys.stderr)
- print(f" - (except the exceptions: {excpts})", file=sys.stderr)
+ print(f" - (except: {excpts})", file=sys.stderr)
with open(Path(settings.SURVEX_DATA, UNSEENS), "w") as u:
u.write(