diff options
author | Philip Sargent <philip.sargent@gmail.com> | 2025-02-25 01:16:04 +0000 |
---|---|---|
committer | Philip Sargent <philip.sargent@gmail.com> | 2025-02-25 01:16:04 +0000 |
commit | b1d10a41d5fbe4ba3334255fd8496e1d87e99afe (patch) | |
tree | 957f09313be04c463aa8ec7f3741fe3d9d7b8363 | |
parent | 54717a436c4654a13989ad798801ccdab513ab5e (diff) | |
download | troggle-b1d10a41d5fbe4ba3334255fd8496e1d87e99afe.tar.gz troggle-b1d10a41d5fbe4ba3334255fd8496e1d87e99afe.tar.bz2 troggle-b1d10a41d5fbe4ba3334255fd8496e1d87e99afe.zip |
Now matching 2025 survex standard *team
-rw-r--r-- | parsers/survex.py | 48 |
1 files changed, 9 insertions, 39 deletions
diff --git a/parsers/survex.py b/parsers/survex.py index cf6c23d..270bcea 100644 --- a/parsers/survex.py +++ b/parsers/survex.py @@ -568,8 +568,8 @@ class LoadingSurvex: return def LoadSurvexTeam(self, survexblock, line): - """Interpeting the *team fields means interpreting older style survex as well as current survex standard, - *team Insts Anthony Day - this is how most of our files specify the team member + """Interpeting the *team fields has been updated to current 2025 survex standard, + *team Insts Anthony Day - this is how most of our files used to specify the team member *team "Anthony Day" notes pictures tape - this is how the survex documentation says it should be done We have a huge variety of abbreviations and mispellings. The most laconic being *team gb, bl @@ -621,30 +621,14 @@ class LoadingSurvex: message = ( f"- Team before Date: {line} ({survexblock}) {survexblock.survexfile.path}" ) - # print(self.insp + message) - # stash_data_issue( - # parser="survex team", message=message, url=None, sb=(survexblock.survexfile.path) - # ) - # teamfix = r"(?i)(.*?)\s+" + roles + r"?(?:es|s)?$" -- (.*?) means a non-greedy capture if fixstyle := self.rx_teamfix.match(line): # matches the optional role at the the end of the string WALRUS tmlist = fixstyle.group(1).strip('\"') # remove quotes, if present for tm in self.rx_person.split(tmlist): if tm.lower() =="": - # message = f"! *team {survexblock.survexfile.path} ({survexblock}) NONE PERSON '{line=}'" - # print(self.insp + message) - # stash_data_issue( - # parser="survex", message=message, url=None, sb=(survexblock.survexfile.path) - # ) pass # does not add any information troggle is interested in else: record_team_member(tm.strip('\"'), survexblock) - # else: - # message = f"! *team {survexblock.survexfile.path} ({survexblock}) Weird '{fixstyle.group(1)}' strictstyle {line=} {tm=}" - # print(self.insp + message) - # stash_data_issue( - # parser="survex", message=message, url=None, sb=(survexblock.survexfile.path) - # ) elif nullperson := self.rx_teamabs.match(line): # matches role but no person. Ignore these. WALRUS return elif line.startswith("unknown "): @@ -654,33 +638,19 @@ class LoadingSurvex: parser="survex", message=message, url=None, sb=(survexblock.survexfile.path) ) record_team_member(line.replace("unknown ","").strip('\"'), survexblock) - elif no_role_person := self.rx_teamone.match(line): - nrp = no_role_person.group(1).strip('\"') - # message = f"! *team {survexblock.survexfile.path} ({survexblock}) person {nrp=} has no role '{line=}'" - # print(self.insp + message) - # stash_data_issue( - # parser="survex", message=message, url=None, sb=(survexblock.survexfile.path) - # ) - record_team_member(nrp, survexblock) + elif no_role_people := self.rx_teamone.match(line): + nrp = no_role_people.group(1).strip('\"') + for tm in self.rx_person.split(nrp): + if tm.lower() =="": + pass # does not add any information troggle is interested in + else: + record_team_member(tm.strip('\"'), survexblock) else: message = f"! *team {survexblock.survexfile.path} ({survexblock}) Bad '{line=}'" print(self.insp + message) stash_data_issue( parser="survex", message=message, url=None, sb=(survexblock.survexfile.path) ) - # mteammember = self.rx_teammem.match(line) # matches the role at the beginning [deprecated after 24/2/2025] - # if not mteammember: - # else: - # for tm in self.rx_person.split(mteammember.group(2)): - # if tm: - # record_team_member(tm, survexblock) - # else: - # if mteammember.group(2).lower() not in ("none", "both"): - # message = f"! Weird *team '{mteammember.group(2)}' expostyle line: '{line}' ({survexblock}) {survexblock.survexfile.path}" - # print(self.insp + message) - # stash_data_issue( - # parser="survex", message=message, url=None, sb=(survexblock.survexfile.path) - # ) def LoadSurvexSet(self, survexblock, line): """survex *set can reset the character for space, decinmal point, field separator |