sort imports using isort. tested.

This commit is contained in:
Philip Sargent 2023-01-19 18:33:04 +00:00
parent e5a9330a91
commit 939d3970aa
8 changed files with 57 additions and 49 deletions

View File

@ -5,8 +5,8 @@ from datetime import date
from django.conf import settings from django.conf import settings
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.models.troggle import DataIssue
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 '''Reads the CSV files containg QMs for a select few caves

View File

@ -6,9 +6,11 @@ from pathlib import Path
from django.conf import settings from django.conf import settings
from django.db import transaction from django.db import transaction
from troggle.settings import SURVEX_DATA, EXPOWEB, CAVEDESCRIPTIONS, ENTRANCEDESCRIPTIONS from troggle.core.models.caves import (Area, Cave, CaveAndEntrance, CaveSlug,
Entrance, EntranceSlug, GetCaveLookup)
from troggle.core.models.troggle import DataIssue from troggle.core.models.troggle import DataIssue
from troggle.core.models.caves import Area, Cave, Entrance, CaveSlug, EntranceSlug, CaveAndEntrance, GetCaveLookup from troggle.settings import (CAVEDESCRIPTIONS, ENTRANCEDESCRIPTIONS, EXPOWEB,
SURVEX_DATA)
'''Reads all the cave description data by parsing the xml files (stored as e.g. :EXPOWEB:/cave_data/1623-161.html ) '''Reads all the cave description data by parsing the xml files (stored as e.g. :EXPOWEB:/cave_data/1623-161.html )
and creating the various Cave, Entrance and necessary Area objects. and creating the various Cave, Entrance and necessary Area objects.

View File

@ -1,16 +1,15 @@
import sys
import os
import types
import stat
import csv import csv
import re
import datetime import datetime
import os
import re
import stat
import sys
import types
from functools import reduce
from pathlib import Path from pathlib import Path
from functools import reduce
import settings import settings
from troggle.core.models.survex import SingleScan, Wallet, DrawingFile from troggle.core.models.survex import DrawingFile, SingleScan, Wallet
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

View File

@ -1,20 +1,20 @@
import sys
import os import os
import sys
import django import django
from django.core import management
from django.db import connection, close_old_connections, connections
from django.contrib.auth.models import User from django.contrib.auth.models import User
from django.core import management
from django.db import (close_old_connections, connection, connections,
transaction)
from django.http import HttpResponse from django.http import HttpResponse
from django.db import transaction
import troggle.settings
import troggle.parsers.caves import troggle.parsers.caves
import troggle.parsers.people
import troggle.parsers.drawings import troggle.parsers.drawings
import troggle.parsers.logbooks import troggle.parsers.logbooks
import troggle.parsers.people
import troggle.parsers.QMs import troggle.parsers.QMs
import troggle.parsers.scans import troggle.parsers.scans
import troggle.settings
'''Master data import. '''Master data import.
Used only by databaseReset.py and online controlpanel. Used only by databaseReset.py and online controlpanel.

View File

@ -2,18 +2,19 @@ import csv
import os import os
import re import re
import time import time
from random import randint from datetime import date, datetime
from datetime import datetime, date
from pathlib import Path from pathlib import Path
from random import randint
from django.conf import settings from django.conf import settings
from django.template.defaultfilters import slugify from django.template.defaultfilters import slugify
from django.utils.timezone import get_current_timezone, make_aware from django.utils.timezone import get_current_timezone, make_aware
from parsers.people import GetPersonExpeditionNameLookup
from troggle.core.models.caves import (Cave, GetCaveLookup, LogbookEntry,
PersonTrip)
from troggle.core.models.troggle import DataIssue, Expedition from troggle.core.models.troggle import DataIssue, Expedition
from troggle.core.utils import TROG, save_carefully from troggle.core.utils import TROG, save_carefully
from troggle.core.models.caves import Cave, LogbookEntry, PersonTrip, GetCaveLookup
from parsers.people import GetPersonExpeditionNameLookup
''' '''
Parses and imports logbooks in all their wonderful confusion Parses and imports logbooks in all their wonderful confusion

View File

@ -1,13 +1,17 @@
import csv, re, datetime, os, shutil import csv
import datetime
import os
import re
import shutil
from html import unescape from html import unescape
from unidecode import unidecode
from pathlib import Path from pathlib import Path
from django.conf import settings from django.conf import settings
from unidecode import unidecode
from troggle.core.models.troggle import Expedition, Person, PersonExpedition from troggle.core.models.troggle import (DataIssue, Expedition, Person,
from troggle.core.models.troggle import DataIssue PersonExpedition)
from troggle.core.utils import save_carefully, TROG from troggle.core.utils import TROG, save_carefully
'''These functions do not match how the stand-alone folk script works. So the script produces an HTML file which has '''These functions do not match how the stand-alone folk script works. So the script produces an HTML file which has
href links to pages in troggle which troggle does not think are right. href links to pages in troggle which troggle does not think are right.

View File

@ -1,18 +1,18 @@
import sys
import os
import subprocess
import types
import stat
import csv import csv
import re
import datetime import datetime
import shutil, filecmp import filecmp
import os
import re
import shutil
import stat
import subprocess
import sys
import types
from functools import reduce from functools import reduce
from pathlib import Path from pathlib import Path
import settings import settings
from troggle.core.models.survex import SingleScan, Wallet, DrawingFile from troggle.core.models.survex import DrawingFile, SingleScan, Wallet
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
from troggle.core.views.scans import datewallet from troggle.core.views.scans import datewallet

View File

@ -1,23 +1,24 @@
import sys import copy
import os import os
import re import re
import time
import copy
import subprocess import subprocess
import sys
import time
from datetime import date, datetime, timedelta, timezone
from pathlib import Path from pathlib import Path
from datetime import datetime, timedelta, date, timezone
from django.utils.timezone import get_current_timezone from django.utils.timezone import get_current_timezone, make_aware
from django.utils.timezone import make_aware
import troggle.settings as settings import troggle.settings as settings
from troggle.core.models.caves import Cave, Entrance, QM, LogbookEntry from troggle.core.models.caves import QM, Cave, Entrance, LogbookEntry
from troggle.core.utils import get_process_memory, chaosmonkey from troggle.core.models.survex import (SurvexBlock, SurvexDirectory,
from troggle.parsers.people import GetPersonExpeditionNameLookup, known_foreigner SurvexFile, SurvexPersonRole,
from troggle.parsers.logbooks import GetCaveLookup SurvexStation, Wallet)
from troggle.core.models.troggle import DataIssue, Expedition from troggle.core.models.troggle import DataIssue, Expedition
from troggle.core.models.survex import SurvexPersonRole, Wallet, SurvexDirectory, SurvexFile, SurvexBlock, SurvexStation from troggle.core.utils import chaosmonkey, get_process_memory
from troggle.parsers.logbooks import GetCaveLookup
from troggle.parsers.people import (GetPersonExpeditionNameLookup,
known_foreigner)
'''Imports the tree of survex files following from a defined root .svx file '''Imports the tree of survex files following from a defined root .svx file
It also scans the Loser repo for all the svx files, which it loads individually afterwards. It also scans the Loser repo for all the svx files, which it loads individually afterwards.
@ -1602,7 +1603,8 @@ def FindAndLoadSurvex(survexblockroot):
fcollate.write(f";*include {survexfileroot.path}\n") fcollate.write(f";*include {survexfileroot.path}\n")
flinear.write(f"{svx_scan.depthinclude:2} {indent} *include {survexfileroot.path}\n") flinear.write(f"{svx_scan.depthinclude:2} {indent} *include {survexfileroot.path}\n")
import cProfile, pstats import cProfile
import pstats
from pstats import SortKey from pstats import SortKey
pr = cProfile.Profile() pr = cProfile.Profile()
pr.enable() pr.enable()