Docstrings for all modules

This commit is contained in:
Philip Sargent 2021-04-13 01:37:42 +01:00
parent 267741fa8b
commit 0820d7c0dc
15 changed files with 50 additions and 17 deletions

View File

@ -1,5 +1,13 @@
from django.conf import settings from django.conf import settings
from troggle.core.models.troggle import Expedition from troggle.core.models.troggle import Expedition
'''This is the only troglle-specific 'context processor' that troggle uses
in the processing of Django templates
This seems to mean that every page produced has bundled in its context the complete 'settings' and
the expedition class object, so all templates can doe queries on Expedition.
https://betterprogramming.pub/django-quick-tips-context-processors-da74f887f1fc
'''
def troggle_context(request): def troggle_context(request):
return { 'settings':settings, 'Expedition':Expedition } return { 'settings':settings, 'Expedition':Expedition }

View File

@ -11,6 +11,10 @@ from django.contrib.admin.widgets import AdminDateWidget
from troggle.core.models.troggle import Person, PersonExpedition, Expedition from troggle.core.models.troggle import Person, PersonExpedition, Expedition
from troggle.core.models.caves import Cave, LogbookEntry, QM, Entrance, CaveAndEntrance from troggle.core.models.caves import Cave, LogbookEntry, QM, Entrance, CaveAndEntrance
'''These are all the Forms used by troggle
Some are not used and need renovating or destroying.
'''
class CaveForm(ModelForm): class CaveForm(ModelForm):
underground_description = forms.CharField(required = False, widget=forms.Textarea()) underground_description = forms.CharField(required = False, widget=forms.Textarea())
explorers = forms.CharField(required = False, widget=forms.Textarea()) explorers = forms.CharField(required = False, widget=forms.Textarea())

View File

@ -2,6 +2,7 @@ from django.conf import settings
from django import http from django import http
from django.urls import reverse, resolve,Resolver404 from django.urls import reverse, resolve,Resolver404
"""Non-standard django middleware is loaded from this file. """Non-standard django middleware is loaded from this file.
It needs re-writing to be compatible with Django v2.0+
""" """
class SmartAppendSlashMiddleware(object): class SmartAppendSlashMiddleware(object):

View File

@ -5,8 +5,8 @@ import logging
from django.conf import settings from django.conf import settings
from django.shortcuts import render from django.shortcuts import render
"""Oddball mixture of critical, superfluous and useful functions which should """Oddball mixture of apparently now superfluous functions which should
be re-located more sensibly to other modules: be deleted
various HTML/wiki functions presumably for logbooks? various HTML/wiki functions presumably for logbooks?

View File

@ -15,13 +15,18 @@ from django.shortcuts import get_object_or_404, render
from django.core.exceptions import ObjectDoesNotExist, MultipleObjectsReturned from django.core.exceptions import ObjectDoesNotExist, MultipleObjectsReturned
import troggle.settings as settings import troggle.settings as settings
#import troggle.core.models as models
from troggle.core.views import expo from troggle.core.views import expo
from troggle.core.models.troggle import Expedition, DataIssue from troggle.core.models.troggle import Expedition, DataIssue
from troggle.core.models.caves import CaveSlug, Cave, CaveAndEntrance, QM, EntranceSlug, Entrance, Area, SurvexStation, GetCaveLookup from troggle.core.models.caves import CaveSlug, Cave, CaveAndEntrance, QM, EntranceSlug, Entrance, Area, SurvexStation, GetCaveLookup
from troggle.core.forms import CaveForm, CaveAndEntranceFormSet, VersionControlCommentForm, EntranceForm, EntranceLetterForm from troggle.core.forms import CaveForm, CaveAndEntranceFormSet, VersionControlCommentForm, EntranceForm, EntranceLetterForm
from .login import login_required_if_public from .login import login_required_if_public
'''Manages the complex procedures to assemble a cave description out of the compnoents
Manages the use of cavern to parse survex files to produce 3d and pos files
Also generates the prospecting guide document.
'''
class MapLocations(object): class MapLocations(object):
p = [ p = [
("laser.0_7", "BNase", "Reference", "Bräuning Nase laser point"), ("laser.0_7", "BNase", "Reference", "Bräuning Nase laser point"),

View File

@ -17,6 +17,9 @@ from troggle.core.models.survex import SurvexBlock
import troggle.settings as settings import troggle.settings as settings
'''Very simple report pages summarizing data about the whole set of expeditions and of
the status of data inconsistencies
'''
def pathsreport(request): def pathsreport(request):
pathsdict = OrderedDict() pathsdict = OrderedDict()

View File

@ -19,6 +19,10 @@ from troggle.core.models.survex import SurvexBlock, SurvexPersonRole, SurvexFile
from troggle.core.models.caves import Cave, PersonTrip, LogbookEntry from troggle.core.models.caves import Cave, PersonTrip, LogbookEntry
from troggle.parsers.people import GetPersonExpeditionNameLookup from troggle.parsers.people import GetPersonExpeditionNameLookup
'''Everything that views survexfiles
but also displays data on a cave or caves when there is ambiguity
'''
survexdatasetpath = Path(settings.SURVEX_DATA) survexdatasetpath = Path(settings.SURVEX_DATA)
survextemplatefile = """; *** THIS IS A TEMPLATE FILE NOT WHAT YOU MIGHT BE EXPECTING *** survextemplatefile = """; *** THIS IS A TEMPLATE FILE NOT WHAT YOU MIGHT BE EXPECTING ***

View File

@ -1,6 +0,0 @@
/mnt/d/CUCC-Expo/t37/lib/python3.7/site-packages/django/db/models/sql/query.py:11: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3,and in 3.9 it will stop working
from collections import Counter, Iterator, Mapping, OrderedDict
/mnt/d/CUCC-Expo/t37/lib/python3.7/site-packages/django/db/models/sql/query.py:11: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3,and in 3.9 it will stop working
from collections import Counter, Iterator, Mapping, OrderedDict
/mnt/d/CUCC-Expo/t37/lib/python3.7/site-packages/django/core/paginator.py:126: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3,and in 3.9 it will stop working
class Page(collections.Sequence):

View File

@ -74,6 +74,7 @@ JSLIB_URL = urllib.parse.urljoin(URL_ROOT , '/javascript/') # used for CaveView
PUBLIC_SITE = True PUBLIC_SITE = True
DEBUG = True # Always keep this True, even when on public server. Otherwise NO USEFUL ERROR MESSAGES ! DEBUG = True # Always keep this True, even when on public server. Otherwise NO USEFUL ERROR MESSAGES !
CACHEDPAGES = True # experimental page cache for a handful of page types
# executables: # executables:
CAVERN = 'cavern' # for parsing .svx files and producing .3d files CAVERN = 'cavern' # for parsing .svx files and producing .3d files
@ -171,4 +172,3 @@ JSLIB_ROOT = os.fspath(JSLIB_ROOT)
JSLIB_ROOT = os.fspath(JSLIB_ROOT) JSLIB_ROOT = os.fspath(JSLIB_ROOT)
JSLIB_ROOT = os.fspath(JSLIB_ROOT) JSLIB_ROOT = os.fspath(JSLIB_ROOT)
SURVEY_SCANS = os.fspath(SURVEY_SCANS) SURVEY_SCANS = os.fspath(SURVEY_SCANS)
print(" + finished importing troggle/localsettings.py")

View File

@ -9,6 +9,7 @@ from troggle.core.models.troggle import DataIssue
from troggle.core.models.caves import QM, Cave, LogbookEntry from troggle.core.models.caves import QM, Cave, LogbookEntry
from troggle.core.utils import save_carefully from troggle.core.utils import save_carefully
'''Reads the CSV files containg QMs for a select few caves'''
def deleteQMs(): def deleteQMs():
QM.objects.all().delete() QM.objects.all().delete()

View File

@ -15,6 +15,9 @@ import troggle.parsers.surveys
import troggle.parsers.logbooks import troggle.parsers.logbooks
import troggle.parsers.QMs import troggle.parsers.QMs
'''Master data importUsed only by databaseReset.py currently
'''
def import_caves(): def import_caves():
print("-- Importing Caves to ",end="") print("-- Importing Caves to ",end="")
print(django.db.connections.databases['default']['NAME']) print(django.db.connections.databases['default']['NAME'])

View File

@ -15,10 +15,12 @@ from troggle.core.utils import TROG, save_carefully
from troggle.core.models.caves import Cave, LogbookEntry, PersonTrip, GetCaveLookup from troggle.core.models.caves import Cave, LogbookEntry, PersonTrip, GetCaveLookup
from parsers.people import GetPersonExpeditionNameLookup from parsers.people import GetPersonExpeditionNameLookup
# '''
Parses and imports logbooks in all their wonderful confusion
# When we edit logbook entries, allow a "?" after any piece of data to say we've frigged it and # When we edit logbook entries, allow a "?" after any piece of data to say we've frigged it and
# it can be checked up later from the hard-copy if necessary; or it's not possible to determin (name, trip place, etc) # it can be checked up later from the hard-copy if necessary; or it's not possible to determin (name, trip place, etc)
# '''
# #
# the logbook loading section # the logbook loading section

View File

@ -20,6 +20,10 @@ from troggle.core.views.caves import MapLocations
from troggle.core.models.troggle import DataIssue, Expedition from troggle.core.models.troggle import DataIssue, Expedition
from troggle.core.models.survex import SurvexPersonRole, ScansFolder, SurvexDirectory, SurvexFile, SurvexBlock, SurvexStation from troggle.core.models.survex import SurvexPersonRole, ScansFolder, SurvexDirectory, SurvexFile, SurvexBlock, SurvexStation
'''Imports the tree of survex files following form a defined root .svx file
It does also NOT scan the Loser repo for all the svx files - though it should !
'''
survexblockroot = None survexblockroot = None
ROOTBLOCK = "rootblock" ROOTBLOCK = "rootblock"
METRESINFEET = 3.28084 METRESINFEET = 3.28084

View File

@ -15,6 +15,10 @@ from troggle.core.models.survex import SingleScan, ScansFolder, TunnelFile
from troggle.core.models.troggle import DataIssue from troggle.core.models.troggle import DataIssue
from troggle.core.utils import save_carefully from troggle.core.utils import save_carefully
'''Scans through all the :drawings: repository looking
for tunnel and therion files
'''
def get_or_create_placeholder(year): def get_or_create_placeholder(year):
""" All surveys must be related to a logbookentry. We don't have a way to """ All surveys must be related to a logbookentry. We don't have a way to

View File

@ -1,8 +1,8 @@
confusable-homoglyphs==3.2.0 confusable-homoglyphs==3.2.0
Django==2.2.19 Django==2.2.19
docutils==0.17 docutils==0.14
gunicorn==20.1.0 gunicorn==20.1.0
Pillow==8.2.0 Pillow==5.4.1
pytz==2021.1 pytz==2019.1
sqlparse==0.4.1 sqlparse==0.2.4
Unidecode==1.2.0 Unidecode==1.0.23