diff --git a/parsers/survex.py b/parsers/survex.py index 1214e0c..15a4c67 100644 --- a/parsers/survex.py +++ b/parsers/survex.py @@ -399,6 +399,10 @@ class LoadingSurvex: but inheriting dates across *include files is almost certainly NOT expected behaviour, even though it is syntactically "correct", so triggers a Warning. + + In fact, rather than give a warning, I think this is where troggle should diverge from + a strict interpretation of how survex works. So I will change this so that *date + is NOT inherited between different files. """ if survexblock.parent.name == "troggle_unseens": # Bolluxed up if we try to inherit from this random junk, so don't. @@ -429,27 +433,30 @@ class LoadingSurvex: # parser="survex", message=message, url=None, sb=(survexblock.survexfile.path) # child # ) if survexblock.survexfile != survexblock.parent.survexfile: - # This is noteworthy, however. + # This is noteworthy, however. FORBID inheriting dates between files. NOT documented survex behaviour !! + survexblock.date = None + self.currentdate = None # unecessary duplication + return None - 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) + # 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}" # ) - 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 + # print(self.insp + message) + # stash_data_issue( + # parser="survex", message=message, url=None, sb=(survexblock.survexfile.path) # not the parent + # ) + # return self.inheritdate else: # This is not an error in the Expo dataset. # Many files just holding *include lines do not have dates.