mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2025-12-14 21:17:11 +00:00
ruff removed unused imports
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
from django.conf import settings
|
||||
@@ -44,7 +43,7 @@ def dummy_entrance(k, slug, msg="DUMMY"):
|
||||
if ent:
|
||||
ent.save() # must save to have id before foreign keys work.
|
||||
try: # Now create a entrance slug ID
|
||||
es = EntranceSlug(entrance=ent, slug=slug, primary=False)
|
||||
EntranceSlug(entrance=ent, slug=slug, primary=False)
|
||||
except:
|
||||
message = f" ! {k:11s} {msg}-{slug} entrance create failure"
|
||||
DataIssue.objects.create(parser="caves", message=message, url=f"{slug}")
|
||||
@@ -66,9 +65,8 @@ def set_dummy_entrance(id, slug, cave, msg="DUMMY"):
|
||||
global entrances_xslug
|
||||
try:
|
||||
entrance = dummy_entrance(id, slug, msg="DUMMY")
|
||||
letter = ""
|
||||
entrances_xslug[slug] = entrance
|
||||
ce = CaveAndEntrance.objects.update_or_create(cave=cave, entrance_letter="", entrance=entrance)
|
||||
CaveAndEntrance.objects.update_or_create(cave=cave, entrance_letter="", entrance=entrance)
|
||||
message = f" ! Warning: Dummy Entrance successfully set for entrance {id} on cave {cave}"
|
||||
|
||||
DataIssue.objects.create(parser="caves", message=message, url=f"{cave.url}")
|
||||
@@ -134,37 +132,37 @@ def do_pending_cave(k, url, area):
|
||||
print(message)
|
||||
return
|
||||
|
||||
default_note = f"_Survex file found in loser repo but no description in expoweb <br><br><br>\n"
|
||||
default_note += f"INSTRUCTIONS: First open 'This survex file' (link above the CaveView panel) to find the date and info. Then "
|
||||
default_note += f'<br><br>\n\n - (0) look in the <a href="/noinfo/cave-number-index">cave number index</a> for notes on this cave, '
|
||||
default_note += f"<br><br>\n\n - (1) search in the survex file for the *ref to find a "
|
||||
default_note += f"relevant wallet, e.g.<a href='/survey_scans/2009%252311/'>2009#11</a> and read the notes image files <br>\n - "
|
||||
default_note = "_Survex file found in loser repo but no description in expoweb <br><br><br>\n"
|
||||
default_note += "INSTRUCTIONS: First open 'This survex file' (link above the CaveView panel) to find the date and info. Then "
|
||||
default_note += '<br><br>\n\n - (0) look in the <a href="/noinfo/cave-number-index">cave number index</a> for notes on this cave, '
|
||||
default_note += "<br><br>\n\n - (1) search in the survex file for the *ref to find a "
|
||||
default_note += "relevant wallet, e.g.<a href='/survey_scans/2009%252311/'>2009#11</a> and read the notes image files <br>\n - "
|
||||
default_note += (
|
||||
f"<br><br>\n\n - (2) search in the Expo for that year e.g. <a href='/expedition/2009'>2009</a> to find a "
|
||||
"<br><br>\n\n - (2) search in the Expo for that year e.g. <a href='/expedition/2009'>2009</a> to find a "
|
||||
)
|
||||
default_note += f"relevant logbook entry, remember that the date may have been recorded incorrectly, "
|
||||
default_note += "relevant logbook entry, remember that the date may have been recorded incorrectly, "
|
||||
default_note += (
|
||||
f"so check for trips i.e. logbook entries involving the same people as were listed in the survex file, "
|
||||
"so check for trips i.e. logbook entries involving the same people as were listed in the survex file, "
|
||||
)
|
||||
default_note += (
|
||||
f"and you should also check the scanned copy of the logbook (linked from each logbook entry page) "
|
||||
"and you should also check the scanned copy of the logbook (linked from each logbook entry page) "
|
||||
)
|
||||
default_note += f"just in case a vital trip was not transcribed, then <br>\n - "
|
||||
default_note += "just in case a vital trip was not transcribed, then <br>\n - "
|
||||
default_note += (
|
||||
f"click on 'Edit this cave' and copy the information you find in the survex file and the logbook"
|
||||
"click on 'Edit this cave' and copy the information you find in the survex file and the logbook"
|
||||
)
|
||||
default_note += f"and delete all the text in the 'Notes' section - which is the text you are reading now."
|
||||
default_note += f"<br><br>\n\n - Only two fields on this form are essential. "
|
||||
default_note += f"Documentation of all the fields on 'Edit this cave' form is in <a href='/handbook/survey/caveentryfields.html'>handbook/survey/caveentryfields</a>"
|
||||
default_note += f"<br><br>\n\n - "
|
||||
default_note += f"You will also need to create a new entrance from the 'Edit this cave' page. Ignore the existing dummy one, it will evaporate on the next full import."
|
||||
default_note += f"<br><br>\n\n - "
|
||||
default_note += f"When you Submit it will create a new file in expoweb/cave_data/ "
|
||||
default_note += "and delete all the text in the 'Notes' section - which is the text you are reading now."
|
||||
default_note += "<br><br>\n\n - Only two fields on this form are essential. "
|
||||
default_note += "Documentation of all the fields on 'Edit this cave' form is in <a href='/handbook/survey/caveentryfields.html'>handbook/survey/caveentryfields</a>"
|
||||
default_note += "<br><br>\n\n - "
|
||||
default_note += "You will also need to create a new entrance from the 'Edit this cave' page. Ignore the existing dummy one, it will evaporate on the next full import."
|
||||
default_note += "<br><br>\n\n - "
|
||||
default_note += "When you Submit it will create a new file in expoweb/cave_data/ "
|
||||
default_note += (
|
||||
f"<br><br>\n\n - Now you can edit the entrance info: click on Edit below for the dummy entrance. "
|
||||
"<br><br>\n\n - Now you can edit the entrance info: click on Edit below for the dummy entrance. "
|
||||
)
|
||||
default_note += f"and then Submit to save it (if you forget to do this, a dummy entrance will be created for your new cave description)."
|
||||
default_note += f"<br><br>\n\n - Finally, you need to find a nerd to edit the file '<var>expoweb/cave_data/pending.txt</var>' "
|
||||
default_note += "and then Submit to save it (if you forget to do this, a dummy entrance will be created for your new cave description)."
|
||||
default_note += "<br><br>\n\n - Finally, you need to find a nerd to edit the file '<var>expoweb/cave_data/pending.txt</var>' "
|
||||
default_note += (
|
||||
f"to remove the line <br><var>{slug}</var><br> as it is no longer 'pending' but 'done. Well Done."
|
||||
)
|
||||
@@ -187,7 +185,7 @@ def do_pending_cave(k, url, area):
|
||||
print(message)
|
||||
|
||||
try: # Now create a cave slug ID
|
||||
cs = CaveSlug.objects.update_or_create(cave=cave, slug=slug, primary=False)
|
||||
CaveSlug.objects.update_or_create(cave=cave, slug=slug, primary=False)
|
||||
except:
|
||||
message = f" ! {k:11s} PENDING cave SLUG create failure"
|
||||
DataIssue.objects.create(parser="caves", message=message)
|
||||
@@ -292,7 +290,7 @@ def readentrance(filename):
|
||||
for slug in slugs:
|
||||
# print("entrance slug:{} filename:{}".format(slug, filename))
|
||||
try:
|
||||
cs = EntranceSlug.objects.update_or_create(entrance=e, slug=slug, primary=primary)
|
||||
EntranceSlug.objects.update_or_create(entrance=e, slug=slug, primary=primary)
|
||||
except:
|
||||
# need to cope with duplicates
|
||||
message = f" ! FAILED to get precisely one ENTRANCE when updating using: cave_entrance/{filename}"
|
||||
@@ -303,10 +301,9 @@ def readentrance(filename):
|
||||
DataIssue.objects.create(parser="caves", message=message, url=f"/cave/{slug}/edit/")
|
||||
print(message)
|
||||
for k in kents:
|
||||
if k.slug() != None:
|
||||
if k.slug() is not None:
|
||||
print(" ! - OVERWRITING this one: slug:" + str(k.slug()))
|
||||
k.notes = "DUPLICATE entrance found on import. Please fix\n" + k.notes
|
||||
c = k
|
||||
primary = False
|
||||
# else: # more than one item in long list. But this is not an error, and the max and min have been checked by getXML
|
||||
# slug = Path(filename).stem
|
||||
@@ -417,7 +414,7 @@ def readcave(filename):
|
||||
DataIssue.objects.create(parser="caves", message=message)
|
||||
print(message)
|
||||
for k in kaves:
|
||||
if k.slug() != None:
|
||||
if k.slug() is not None:
|
||||
print(" ! - OVERWRITING this one: slug:" + str(k.slug()))
|
||||
k.notes = "DUPLICATE kataster number found on import. Please fix\n" + k.notes
|
||||
c = k
|
||||
@@ -466,7 +463,7 @@ def readcave(filename):
|
||||
else:
|
||||
entrance = Entrance.objects.get(entranceslug__slug=eslug)
|
||||
entrances_xslug[eslug] = entrance
|
||||
ce = CaveAndEntrance.objects.update_or_create(
|
||||
CaveAndEntrance.objects.update_or_create(
|
||||
cave=c, entrance_letter=letter, entrance=entrance
|
||||
)
|
||||
except:
|
||||
@@ -586,7 +583,7 @@ def readcaves():
|
||||
readcave(filename)
|
||||
|
||||
print(" - Setting up all the variously useful alias names")
|
||||
mycavelookup = GetCaveLookup()
|
||||
GetCaveLookup()
|
||||
|
||||
print(" - Setting pending caves")
|
||||
# Do this last, so we can detect if they are created and no longer 'pending'
|
||||
|
||||
Reference in New Issue
Block a user