diff --git a/parsers/survex.py b/parsers/survex.py index ead5ac8..4c0a6e5 100644 --- a/parsers/survex.py +++ b/parsers/survex.py @@ -270,9 +270,9 @@ class LoadingSurvex: rx_flagsnot = re.compile(r"not\s") rx_linelen = re.compile(r"[\d\-+.]+$") instruments = "(bitch|bodger|bolt|bolter|bolting|book|clino|comp|compass|consultant|disto|distox|distox2|dog|dogsbody|drawing|drill|gps|helper|inst|instr|instrument|monkey|nagging|nail|nail_polish|nail_polish_bitch|nail_polish_monkey|nail_varnish|nail_varnish_bitch|note|paint|photo|pic|point|polish|powerdrill|rig|rigger|rigging|shoot|sketch|slacker|something|tape|topodroid|unknown|useless|varnish|waiting_patiently)" - rx_teammem = re.compile(r"(?i)" + instruments + "?(?:es|s)?\s+(.*)$") - rx_teamold = re.compile(r"(?i)(.*)\s+" + instruments + "?(?:es|s)?$") - rx_teamabs = re.compile(r"(?i)^\s*(" + instruments + ")?(?:es|s)?\s*$") + rx_teammem = re.compile(r"(?i)" + instruments + r"?(?:es|s)?\s+(.*)$") + rx_teamold = re.compile(r"(?i)(.*)\s+" + instruments + r"?(?:es|s)?$") + rx_teamabs = re.compile(r"(?i)^\s*(" + instruments + r")?(?:es|s)?\s*$") rx_person = re.compile(r"(?i) and |/| / |, | , |&| & | \+ |^both$|^none$") rx_qm = re.compile( # r"(?i)^\s*QM(\d+)\s+(.+)\s+([\w\-\_]+)\.([\w\.\-]+)\s+(([\w\-]+)\.([\w\.\-]+)|\-)\s+(.+)$" @@ -657,7 +657,7 @@ class LoadingSurvex: def LoadSurvexAlias(self, survexblock, line): # *alias station - .. - splayalias = re.match("(?i)\s*station\s*\-\s*\.\.\s*$", line) + splayalias = re.match(r"(?i)\s*station\s*\-\s*\.\.\s*$", line) if splayalias: self.flagsstar["splayalias"] = True print(line) @@ -672,7 +672,7 @@ class LoadingSurvex: tapeunits = self.rx_tapelng.match(line) # tape|length if not tapeunits: return - convert = re.match("(?i)(\w*)\s*([\.\d]+)\s*(\w*)", line) + convert = re.match(r"(?i)(\w*)\s*([\.\d]+)\s*(\w*)", line) if convert: factor = convert.groups()[1] self.unitsfactor = float(factor) @@ -683,8 +683,8 @@ class LoadingSurvex: print(self.insp + message) stash_data_issue(parser="survexunits", message=message) - feet = re.match("(?i).*feet$", line) - metres = re.match("(?i).*(METRIC|METRES|METERS)$", line) + feet = re.match(r"(?i).*feet$", line) + metres = re.match(r"(?i).*(METRIC|METRES|METERS)$", line) if feet: self.units = "feet" elif metres: @@ -1929,8 +1929,8 @@ class LoadingSurvex: cmd, args = star.groups() cmd = cmd.lower() if self.rx_include2.match(cmd): - # rx_include2 = re.compile("(?i)include$") - # if re.match("(?i)include$", cmd): + # rx_include2 = re.compile(r"(?i)include$") + # if re.match(r"(?i)include$", cmd): includepath = os.path.normpath(os.path.join(os.path.split(path)[0], re.sub(r"\.svx$", "", args))) # normalises path syntax if self.never_seen(includepath, path): fullpath = os.path.join(settings.SURVEX_DATA, includepath + ".svx") @@ -1965,7 +1965,7 @@ class LoadingSurvex: print(message, file=sys.stderr) stash_data_issue(parser="survex", message=message, url=None, sb=(path)) elif self.rx_begin2.match(cmd): - #elif re.match("(?i)begin$", cmd): + #elif re.match(r"(?i)begin$", cmd): self.depthbegin += 1 depth = " " * self.depthbegin if args: @@ -1976,7 +1976,7 @@ class LoadingSurvex: flinear.write(f" {self.depthbegin:2} {depth} *begin {args}\n") pass elif self.rx_end2.match(cmd): - # elif re.match("(?i)end$", cmd): + # elif re.match(r"(?i)end$", cmd): depth = " " * self.depthbegin flinear.write(f" {self.depthbegin:2} {depth} *end {args}\n") if not args: @@ -1994,7 +1994,7 @@ class LoadingSurvex: self.depthbegin -= 1 pass elif self.rx_title2.match(cmd): - # elif re.match("(?i)title$", cmd): + # elif re.match(r"(?i)title$", cmd): depth = " " * self.depthbegin flinear.write(f" {self.depthbegin:2} {depth} *title {args}\n") pass