diff options
author | Philip Sargent <philip.sargent@gmail.com> | 2023-03-03 15:15:17 +0000 |
---|---|---|
committer | Philip Sargent <philip.sargent@gmail.com> | 2023-03-03 15:15:17 +0000 |
commit | 6ab7a340e2c635dca0578cce3ebf4d85d5f9c9c3 (patch) | |
tree | e39b979eeb1dc0f2746ea06b065fc6b1981b2558 /parsers/survex.py | |
parent | 1cb81cbb093575bdc4b8eaf7c3b3b352ef248c94 (diff) | |
download | troggle-6ab7a340e2c635dca0578cce3ebf4d85d5f9c9c3.tar.gz troggle-6ab7a340e2c635dca0578cce3ebf4d85d5f9c9c3.tar.bz2 troggle-6ab7a340e2c635dca0578cce3ebf4d85d5f9c9c3.zip |
Now 99 tests
Diffstat (limited to 'parsers/survex.py')
-rw-r--r-- | parsers/survex.py | 43 |
1 files changed, 40 insertions, 3 deletions
diff --git a/parsers/survex.py b/parsers/survex.py index 838b47e..4a4cb85 100644 --- a/parsers/survex.py +++ b/parsers/survex.py @@ -1849,7 +1849,7 @@ class LoadingSurvex: Path(svxpath).parent if not svxpath.is_file(): - message = f' ! BAD survex file "{fullpath}" specified in *include in {calledpath} ' + message = f' ! BAD. "{fullpath}" is not a file, specified in *include in {calledpath} ' stash_data_issue(parser="survex", message=message) print(message) return @@ -2033,8 +2033,6 @@ def FindAndLoadSurvex(survexblockroot): svx_scan.svxfileslist = [] # free memory svx_scan = None # Hmm. Does this actually delete all the instance variables if they are lists, dicts etc.? - print(f" - RunSurvexIfNeeded cavern on '{fullpathtotop}'", file=sys.stderr) - omit_scan.RunSurvexIfNeeded(fullpathtotop, fullpathtotop) omit_scan.check_unique_name(fullpathtotop) omit_scan.uniquefile[unseensroot] = ["0"] @@ -2130,6 +2128,45 @@ def FindAndLoadSurvex(survexblockroot): return legsnumber +def parse_one_file(fpath): # --------------------------------------in progress------------------- + """Parse just one file. Use when re-loading after editing. + NB careful of *include lines, which may exist! Ignore them. + """ + print("\n - Loading One Survex file (LinearLoad)", file=sys.stderr) + svx_load = LoadingSurvex() + + omitsfileroot = MakeOmitFileRoot(fpath) # NO! This always creats a SurvexFile object. We are overwriting one.. + survexomitsroot = SurvexBlock( + name=OMITBLOCK, survexpath="", survexfile=omitsfileroot, legsall=0, legslength=0.0 + ) + survexomitsroot.save() + # SurvexBlock.objects.all().delete() + # SurvexFile.objects.all().delete() + # SurvexDirectory.objects.all().delete() + # SurvexPersonRole.objects.all().delete() + # SurvexStation.objects.all().delete() + print(" - Loading Survex Blocks...") + + svx_load.survexdict[survexfileroot.survexdirectory] = [] + svx_load.survexdict[survexfileroot.survexdirectory].append(survexfileroot) + svx_load.svxdirs[""] = survexfileroot.survexdirectory + + # ---------------------------------------------------------------- + svx_load.LinearLoad(survexblockroot, survexfileroot.path, collatefilename) + # ---------------------------------------------------------------- + + legsnumber = svx_load.legsnumber + + print(f" - Number of SurvexDirectories: {len(svx_load.survexdict):,}") + tf = 0 + for d in svx_load.survexdict: + tf += len(svx_load.survexdict[d]) + print(f" - Number of SurvexFiles: {tf:,}") + print(f" - Number of Survex legs: {legsnumber:,}") + + # Now set Django SurvexFile object.. + + svx_load = None def MakeSurvexFileRoot(): """Returns a file_object.path = SURVEX_TOPNAME associated with directory_object.path = SURVEX_DATA""" |