mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2024-11-27 01:31:57 +00:00
reordering import statements using isort
This commit is contained in:
parent
1b70ccea3e
commit
e5a9330a91
@ -1,12 +1,13 @@
|
|||||||
import sys
|
import json
|
||||||
|
import locale
|
||||||
import os
|
import os
|
||||||
|
import resource
|
||||||
|
import sys
|
||||||
import time
|
import time
|
||||||
import timeit
|
import timeit
|
||||||
import json
|
|
||||||
import resource
|
|
||||||
import locale
|
|
||||||
|
|
||||||
import settings
|
import settings
|
||||||
|
|
||||||
""" Command-line utility for loading cave data files into troggle's database.
|
""" Command-line utility for loading cave data files into troggle's database.
|
||||||
|
|
||||||
The command line options select which combination of classes of data will be imported,
|
The command line options select which combination of classes of data will be imported,
|
||||||
@ -34,20 +35,22 @@ except:
|
|||||||
raise
|
raise
|
||||||
print(f" - Memory footprint after loading Django: {resource.getrusage(resource.RUSAGE_SELF)[2] / 1024.0:.3f} MB")
|
print(f" - Memory footprint after loading Django: {resource.getrusage(resource.RUSAGE_SELF)[2] / 1024.0:.3f} MB")
|
||||||
|
|
||||||
from troggle.core.models.troggle import DataIssue
|
from django.contrib.auth.models import User
|
||||||
import troggle.core.models.survex
|
|
||||||
|
|
||||||
from django.core import management
|
from django.core import management
|
||||||
from django.db import connection, close_old_connections, connections
|
from django.db import (close_old_connections, connection, connections,
|
||||||
|
transaction)
|
||||||
from django.http import HttpResponse
|
from django.http import HttpResponse
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
from django.contrib.auth.models import User
|
|
||||||
from django.db import transaction
|
|
||||||
|
|
||||||
from troggle.core.utils import get_process_memory
|
import troggle.core.models.survex
|
||||||
from troggle.core.models.caves import Cave, Entrance
|
from troggle.core.models.caves import Cave, Entrance
|
||||||
from troggle.parsers.imports import import_caves, import_people, import_surveyscans, import_ents, \
|
from troggle.core.models.troggle import DataIssue
|
||||||
import_logbooks, import_logbook, import_QMs, import_survex, import_loadpos, import_drawingsfiles
|
from troggle.core.utils import get_process_memory
|
||||||
|
from troggle.parsers.imports import (import_caves, import_drawingsfiles,
|
||||||
|
import_ents, import_loadpos,
|
||||||
|
import_logbook, import_logbooks,
|
||||||
|
import_people, import_QMs, import_survex,
|
||||||
|
import_surveyscans)
|
||||||
|
|
||||||
if os.geteuid() == 0:
|
if os.geteuid() == 0:
|
||||||
# This protects the server from having the wrong file permissions written on logs and caches
|
# This protects the server from having the wrong file permissions written on logs and caches
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
"""This file is the route to run the standard Django utilities on the command line.
|
"""This file is the route to run the standard Django utilities on the command line.
|
||||||
These are the most useful for troggle:
|
These are the most useful for troggle:
|
||||||
|
|
||||||
|
@ -28,7 +28,8 @@ __contributors__ = [
|
|||||||
"Justin Findlay <jfindlay@gmail.com>",
|
"Justin Findlay <jfindlay@gmail.com>",
|
||||||
]
|
]
|
||||||
|
|
||||||
import getopt, sys
|
import getopt
|
||||||
|
import sys
|
||||||
|
|
||||||
from django.core.management import setup_environ
|
from django.core.management import setup_environ
|
||||||
|
|
||||||
@ -39,11 +40,11 @@ except ImportError:
|
|||||||
else:
|
else:
|
||||||
setup_environ(settings)
|
setup_environ(settings)
|
||||||
|
|
||||||
from django.template import Template, Context
|
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.db.models import get_models
|
from django.db.models import get_models
|
||||||
from django.db.models.fields.related import \
|
from django.db.models.fields.related import (ForeignKey, ManyToManyField,
|
||||||
ForeignKey, OneToOneField, ManyToManyField
|
OneToOneField)
|
||||||
|
from django.template import Context, Template
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from django.db.models.fields.generic import GenericRelation
|
from django.db.models.fields.generic import GenericRelation
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
|
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
"""Cleans all django-created files and compiled python. Used by the
|
"""Cleans all django-created files and compiled python. Used by the
|
||||||
pre-run.sh script which cleans and initialises everything before
|
pre-run.sh script which cleans and initialises everything before
|
||||||
running:
|
running:
|
||||||
|
@ -144,5 +144,5 @@ QM_PATTERN="\[\[\s*[Qq][Mm]:([ABC]?)(\d{4})-(\d*)-(\d*)\]\]"
|
|||||||
TEST_RUNNER = 'django.test.runner.DiscoverRunner'
|
TEST_RUNNER = 'django.test.runner.DiscoverRunner'
|
||||||
|
|
||||||
from localsettings import *
|
from localsettings import *
|
||||||
#localsettings needs to take precedence. Call it to override any existing vars.
|
|
||||||
|
|
||||||
|
#localsettings needs to take precedence. Call it to override any existing vars.
|
||||||
|
41
urls.py
41
urls.py
@ -1,29 +1,34 @@
|
|||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.urls import include, re_path
|
from django.contrib import admin, auth
|
||||||
|
from django.urls import include, path, re_path, resolve, reverse
|
||||||
from django.views.generic.base import RedirectView
|
from django.views.generic.base import RedirectView
|
||||||
from django.views.generic.edit import UpdateView
|
from django.views.generic.edit import UpdateView
|
||||||
from django.views.generic.list import ListView
|
from django.views.generic.list import ListView
|
||||||
from django.contrib import admin
|
|
||||||
from django.contrib import auth
|
|
||||||
from django.urls import path, reverse, resolve
|
|
||||||
|
|
||||||
from troggle.core.views import statistics, survex
|
from troggle.core.views import statistics, survex
|
||||||
from troggle.core.views.scans import scansingle, allscans, cavewallets, walletslistyear, walletslistperson
|
|
||||||
from troggle.core.views.drawings import dwgallfiles, dwgfilesingle
|
|
||||||
from troggle.core.views.uploads import dwgupload, scanupload, photoupload
|
|
||||||
from troggle.core.views.other import troggle404, frontpage, todos, controlpanel, frontpage
|
|
||||||
from troggle.core.views.other import exportlogbook
|
|
||||||
from troggle.core.views.caves import ent, cavepage, caveindex, get_entrances, edit_cave, cave3d, caveEntrance, edit_entrance, caveQMs, qm
|
|
||||||
from troggle.core.views.logbooks import get_logbook_entries, logbookentry
|
|
||||||
from troggle.core.views.logbooks import notablepersons, person, get_people
|
|
||||||
from troggle.core.views.logbooks import expedition, personexpedition, Expeditions_tsvListView, Expeditions_jsonListView
|
|
||||||
from troggle.core.views.prospect import prospecting_image
|
|
||||||
from troggle.core.views.prospect import prospecting
|
|
||||||
from troggle.core.views.statistics import pathsreport, stats, dataissues
|
|
||||||
from troggle.core.views.expo import expofiles_redirect, expofilessingle, expopage, editexpopage, mediapage, map, mapfile
|
|
||||||
from troggle.core.views.survex import survexcaveslist, survexcavesingle, svx
|
|
||||||
from troggle.core.views.auth import expologin, expologout
|
from troggle.core.views.auth import expologin, expologout
|
||||||
|
from troggle.core.views.caves import (cave3d, caveEntrance, caveindex,
|
||||||
|
cavepage, caveQMs, edit_cave,
|
||||||
|
edit_entrance, ent, get_entrances, qm)
|
||||||
|
from troggle.core.views.drawings import dwgallfiles, dwgfilesingle
|
||||||
from troggle.core.views.editor_helpers import image_selector, new_image_form
|
from troggle.core.views.editor_helpers import image_selector, new_image_form
|
||||||
|
from troggle.core.views.expo import (editexpopage, expofiles_redirect,
|
||||||
|
expofilessingle, expopage, map, mapfile,
|
||||||
|
mediapage)
|
||||||
|
from troggle.core.views.logbooks import (Expeditions_jsonListView,
|
||||||
|
Expeditions_tsvListView, expedition,
|
||||||
|
get_logbook_entries, get_people,
|
||||||
|
logbookentry, notablepersons, person,
|
||||||
|
personexpedition)
|
||||||
|
from troggle.core.views.other import (controlpanel, exportlogbook, frontpage,
|
||||||
|
todos, troggle404)
|
||||||
|
from troggle.core.views.prospect import prospecting, prospecting_image
|
||||||
|
from troggle.core.views.scans import (allscans, cavewallets, scansingle,
|
||||||
|
walletslistperson, walletslistyear)
|
||||||
|
from troggle.core.views.statistics import dataissues, pathsreport, stats
|
||||||
|
from troggle.core.views.survex import survexcavesingle, survexcaveslist, svx
|
||||||
|
from troggle.core.views.uploads import dwgupload, photoupload, scanupload
|
||||||
|
|
||||||
"""This sets the actualurlpatterns[] and urlpatterns[] lists which django uses
|
"""This sets the actualurlpatterns[] and urlpatterns[] lists which django uses
|
||||||
to resolve urls - in both directions as these are declarative.
|
to resolve urls - in both directions as these are declarative.
|
||||||
|
|
||||||
|
2
wsgi.py
2
wsgi.py
@ -8,7 +8,9 @@ https://docs.djangoproject.com/en/1.11/howto/deployment/wsgi/
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings")
|
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings")
|
||||||
|
|
||||||
from django.core.wsgi import get_wsgi_application
|
from django.core.wsgi import get_wsgi_application
|
||||||
|
|
||||||
application = get_wsgi_application()
|
application = get_wsgi_application()
|
||||||
|
Loading…
Reference in New Issue
Block a user