2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2024-11-22 07:11:52 +00:00

Remove unneeded code now svx files have been edited

This commit is contained in:
Philip Sargent 2022-09-15 22:55:16 +03:00
parent e28f04a51c
commit f12d0bd580

View File

@ -134,15 +134,12 @@ class LoadingSurvex():
rx_commcni = re.compile(r'(?i)^\|\*edulcni[\s]*([-\w/]*).*$') # inserted by linear collate ;*edulcni
rx_include = re.compile(r'(?i)^\s*(\*include[\s].*)$')
rx_commref = re.compile(r'(?i)^\s*ref(?:erence)?[\s.:]*(\d+)\s*#\s*(X)?\s*(\d+)')
rx_wallet = re.compile(r'(?i)^\s*wallet[\s.:]*(\d+)\s*#\s*(X)?\s*(\d+)')
rx_implicit= re.compile(r'(?i)^[\s.:]*(\d+)\s*#\s*(X)?\s*(\d+)')
rx_ref_text= re.compile(r'(?i)^\s*\"[^"]*\"\s*$')
rx_star = re.compile(r'(?i)\s*\*[\s,]*(\w+)\s*(.*?)\s*(?:;.*)?$')
rx_starref = re.compile(r'(?i)^\s*\*ref[\s.:]*((?:19[6789]\d)|(?:20[0123]\d))\s*#?\s*(X)?\s*(.*?\d+.*?)$')
rx_argsref = re.compile(r'(?i)^[\s.:]*((?:19[6789]\d)|(?:20[0123]\d))\s*#?\s*(X)?\s*(.*?\d+.*?)$')
rx_argsref = re.compile(r'(?i)^[\s.:]*((?:19[6789]\d)|(?:20[012345]\d))\s*#?\s*(X)?\s*(.*?\d+.*?)$')
rx_badmerge= re.compile(r'(?i).*(\>\>\>\>\>)|(\=\=\=\=\=)|(\<\<\<\<\<).*$')
rx_ref2 = re.compile(r'(?i)\s*ref[.;]?')
rx_ref3 = re.compile(r'(?i)\s*wallet[.;]?')
# This interprets the survex "*data normal" command which sets out the order of the fields in the data, e.g.
@ -493,7 +490,7 @@ class LoadingSurvex():
letterx = "X"
if len(wallet)<2:
wallet = "0" + wallet
if not (int(yr)>1960 and int(yr)<2039):
if not (int(yr)>1960 and int(yr)<2050):
message = " ! Wallet year out of bounds {yr} '{refscan}' {survexblock.survexfile.path}"
print(self.insp+message)
DataIssue.objects.create(parser='survex', message=message, url=url)
@ -505,20 +502,21 @@ class LoadingSurvex():
print(self.insp+message)
DataIssue.objects.create(parser='survex', message=message, url=url)
except:
message = " ! Wallet *REF {} - not numeric in '{}' -- parsing continues".format(refscan, survexblock.survexfile.path)
message = " ! Wallet *REF {} - not numeric in '{}'".format(refscan, survexblock.survexfile.path)
print(self.insp+message)
DataIssue.objects.create(parser='survex', message=message, url=url)
manywallets = Wallet.objects.filter(walletname=refscan)
manywallets = Wallet.objects.filter(walletname=refscan) # assumes all wallets found in earlier pass of data import
if manywallets:
survexblock.scanswallet = manywallets[0] # this is a ForeignKey field
print(manywallets[0])
message = f' - Wallet {manywallets[0]=} successfully found in db. *ref in {survexblock.survexfile.path}'
# print(self.insp+message)
survexblock.save()
if len(manywallets) > 1:
message = " ! Wallet *REF {} - more than one found {} scan folders in block {}".format(refscan, len(manywallets), survexblock.survexfile.path)
message = " ! Wallet *REF {} - more than one found {} wallets in block {}".format(refscan, len(manywallets), survexblock.survexfile.path)
print(self.insp+message)
DataIssue.objects.create(parser='survex', message=message, url=url)
else:
message = " ! Wallet *REF '{}' - NOT found '{}'".format(refscan, survexblock.survexfile.path)
message = " ! Wallet *REF '{}' - NOT found '{}' in database".format(refscan, survexblock.survexfile.path)
print(self.insp+message)
DataIssue.objects.create(parser='survex', message=message, url=url)
@ -842,7 +840,6 @@ class LoadingSurvex():
def LoadSurvexComment(self, survexblock, comment):
# ignore all comments except ;ref, ; wallet and ;QM and ;*include (for collated survex file)
# rx_ref2 = re.compile(r'(?i)\s*ref[.;]?')
# rx_ref3 = re.compile(r'(?i)\s*wallet[.;]?')
# This should also check that the QM survey point rxists in the block
@ -850,14 +847,7 @@ class LoadingSurvex():
if refline:
#comment = re.sub('(?i)\s*ref[.;]?',"",comment.strip())
comment = self.rx_ref2.sub("",comment.strip())
self.LoadSurvexRef(survexblock, comment)
walletline = self.rx_wallet.match(comment)
if walletline:
#comment = re.sub('(?i)\s*wallet[.;]?',"",comment.strip())
comment = self.rx_ref3.sub("",comment.strip())
self.LoadSurvexRef(survexblock, comment)
implicitline = self.rx_implicit.match(comment)
if implicitline:
print(f'rx_ref2 -- {comment=} in {survexblock.survexfile.path} :: {survexblock}')
self.LoadSurvexRef(survexblock, comment)
qml = self.rx_qm0.match(comment)