2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2024-11-28 10:02:10 +00:00

more raw strings

This commit is contained in:
Your Name 2023-11-22 17:09:22 +00:00
parent e1945feef5
commit c0e35e964b

View File

@ -270,9 +270,9 @@ class LoadingSurvex:
rx_flagsnot = re.compile(r"not\s") rx_flagsnot = re.compile(r"not\s")
rx_linelen = re.compile(r"[\d\-+.]+$") 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)" 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_teammem = re.compile(r"(?i)" + instruments + r"?(?:es|s)?\s+(.*)$")
rx_teamold = re.compile(r"(?i)(.*)\s+" + instruments + "?(?:es|s)?$") rx_teamold = re.compile(r"(?i)(.*)\s+" + instruments + r"?(?:es|s)?$")
rx_teamabs = re.compile(r"(?i)^\s*(" + instruments + ")?(?:es|s)?\s*$") rx_teamabs = re.compile(r"(?i)^\s*(" + instruments + r")?(?:es|s)?\s*$")
rx_person = re.compile(r"(?i) and |/| / |, | , |&| & | \+ |^both$|^none$") rx_person = re.compile(r"(?i) and |/| / |, | , |&| & | \+ |^both$|^none$")
rx_qm = re.compile( rx_qm = re.compile(
# r"(?i)^\s*QM(\d+)\s+(.+)\s+([\w\-\_]+)\.([\w\.\-]+)\s+(([\w\-]+)\.([\w\.\-]+)|\-)\s+(.+)$" # r"(?i)^\s*QM(\d+)\s+(.+)\s+([\w\-\_]+)\.([\w\.\-]+)\s+(([\w\-]+)\.([\w\.\-]+)|\-)\s+(.+)$"
@ -657,7 +657,7 @@ class LoadingSurvex:
def LoadSurvexAlias(self, survexblock, line): def LoadSurvexAlias(self, survexblock, line):
# *alias station - .. # *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: if splayalias:
self.flagsstar["splayalias"] = True self.flagsstar["splayalias"] = True
print(line) print(line)
@ -672,7 +672,7 @@ class LoadingSurvex:
tapeunits = self.rx_tapelng.match(line) # tape|length tapeunits = self.rx_tapelng.match(line) # tape|length
if not tapeunits: if not tapeunits:
return return
convert = re.match("(?i)(\w*)\s*([\.\d]+)\s*(\w*)", line) convert = re.match(r"(?i)(\w*)\s*([\.\d]+)\s*(\w*)", line)
if convert: if convert:
factor = convert.groups()[1] factor = convert.groups()[1]
self.unitsfactor = float(factor) self.unitsfactor = float(factor)
@ -683,8 +683,8 @@ class LoadingSurvex:
print(self.insp + message) print(self.insp + message)
stash_data_issue(parser="survexunits", message=message) stash_data_issue(parser="survexunits", message=message)
feet = re.match("(?i).*feet$", line) feet = re.match(r"(?i).*feet$", line)
metres = re.match("(?i).*(METRIC|METRES|METERS)$", line) metres = re.match(r"(?i).*(METRIC|METRES|METERS)$", line)
if feet: if feet:
self.units = "feet" self.units = "feet"
elif metres: elif metres:
@ -1929,8 +1929,8 @@ class LoadingSurvex:
cmd, args = star.groups() cmd, args = star.groups()
cmd = cmd.lower() cmd = cmd.lower()
if self.rx_include2.match(cmd): if self.rx_include2.match(cmd):
# rx_include2 = re.compile("(?i)include$") # rx_include2 = re.compile(r"(?i)include$")
# if re.match("(?i)include$", cmd): # 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 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): if self.never_seen(includepath, path):
fullpath = os.path.join(settings.SURVEX_DATA, includepath + ".svx") fullpath = os.path.join(settings.SURVEX_DATA, includepath + ".svx")
@ -1965,7 +1965,7 @@ class LoadingSurvex:
print(message, file=sys.stderr) print(message, file=sys.stderr)
stash_data_issue(parser="survex", message=message, url=None, sb=(path)) stash_data_issue(parser="survex", message=message, url=None, sb=(path))
elif self.rx_begin2.match(cmd): elif self.rx_begin2.match(cmd):
#elif re.match("(?i)begin$", cmd): #elif re.match(r"(?i)begin$", cmd):
self.depthbegin += 1 self.depthbegin += 1
depth = " " * self.depthbegin depth = " " * self.depthbegin
if args: if args:
@ -1976,7 +1976,7 @@ class LoadingSurvex:
flinear.write(f" {self.depthbegin:2} {depth} *begin {args}\n") flinear.write(f" {self.depthbegin:2} {depth} *begin {args}\n")
pass pass
elif self.rx_end2.match(cmd): elif self.rx_end2.match(cmd):
# elif re.match("(?i)end$", cmd): # elif re.match(r"(?i)end$", cmd):
depth = " " * self.depthbegin depth = " " * self.depthbegin
flinear.write(f" {self.depthbegin:2} {depth} *end {args}\n") flinear.write(f" {self.depthbegin:2} {depth} *end {args}\n")
if not args: if not args:
@ -1994,7 +1994,7 @@ class LoadingSurvex:
self.depthbegin -= 1 self.depthbegin -= 1
pass pass
elif self.rx_title2.match(cmd): elif self.rx_title2.match(cmd):
# elif re.match("(?i)title$", cmd): # elif re.match(r"(?i)title$", cmd):
depth = " " * self.depthbegin depth = " " * self.depthbegin
flinear.write(f" {self.depthbegin:2} {depth} *title {args}\n") flinear.write(f" {self.depthbegin:2} {depth} *title {args}\n")
pass pass