From 30760654b7a3d7a394028fdf357d6f257def1fd5 Mon Sep 17 00:00:00 2001 From: Philip Sargent Date: Sun, 15 Dec 2024 18:54:47 +0000 Subject: [PATCH] import order fixed by ruff --- core/TESTS/test_caves.py | 7 +++---- core/TESTS/test_imports.py | 5 +++-- core/TESTS/test_logins.py | 6 +++--- core/TESTS/test_parsers.py | 10 +++++----- core/TESTS/test_urls.py | 3 ++- core/TESTS/tests-cuyc-ignored.py | 5 ++--- core/TESTS/tests_copilot.py | 2 +- core/admin.py | 2 +- core/forms.py | 10 ++++------ core/management/commands/dummycmd.py | 1 - core/models/caves.py | 5 ++--- core/models/logbooks.py | 4 +--- core/models/survex.py | 5 +++-- core/models/wallets.py | 2 +- core/utils.py | 4 +--- core/views/auth.py | 3 +-- core/views/caves.py | 23 ++++++++++------------- core/views/editor_helpers.py | 3 +-- core/views/expo.py | 2 +- core/views/logbooks.py | 7 ++----- core/views/other.py | 5 +++-- core/views/scans.py | 6 ++---- core/views/statistics.py | 4 ++-- core/views/survex.py | 11 +++++------ core/views/uploads.py | 8 +++----- core/views/wallets_edit.py | 12 +++--------- databaseReset.py | 3 ++- modelviz.py | 3 +-- parsers/caves.py | 5 ++--- parsers/locations.py | 5 ++--- parsers/logbooks.py | 7 +++---- parsers/people.py | 2 +- parsers/survex.py | 8 +++----- photomap/pmap.py | 7 ++++--- 34 files changed, 83 insertions(+), 112 deletions(-) diff --git a/core/TESTS/test_caves.py b/core/TESTS/test_caves.py index 10dd9db..ae79a6f 100644 --- a/core/TESTS/test_caves.py +++ b/core/TESTS/test_caves.py @@ -5,15 +5,14 @@ Modified for Expo April 2021. import re from http import HTTPStatus -from django.test import Client, TestCase from django.contrib.auth.models import User +from django.test import Client, TestCase import settings - from troggle.core.models.caves import Cave -from troggle.core.models.troggle import Person, PersonExpedition, Expedition +from troggle.core.models.troggle import Expedition, Person, PersonExpedition from troggle.core.utils import current_expo - + current_year = current_expo() diff --git a/core/TESTS/test_imports.py b/core/TESTS/test_imports.py index 92bacc3..e81054b 100644 --- a/core/TESTS/test_imports.py +++ b/core/TESTS/test_imports.py @@ -83,7 +83,7 @@ class SimpleTest(SimpleTestCase): import troggle.core.views.expo from troggle.core.forms import CaveForm, EntranceForm, EntranceLetterForm - from troggle.core.models.caves import Cave, CaveAndEntrance, Entrance, SurvexStation #EntranceSlug, + from troggle.core.models.caves import Cave, CaveAndEntrance, Entrance, SurvexStation #EntranceSlug, from troggle.core.models.troggle import Expedition from troggle.core.views.auth import login_required_if_public @@ -107,6 +107,7 @@ class SimpleTest(SimpleTestCase): def test_import_urls(self): from django.conf import settings + #from django.conf.urls import include, url from django.contrib import admin, auth from django.urls import resolve, reverse @@ -146,7 +147,7 @@ class ImportTest(TestCase): @classmethod def setUpTestData(cls): import troggle.settings as settings - from troggle.parsers.logbooks import LOGBOOKS_DIR, DEFAULT_LOGBOOK_FILE + from troggle.parsers.logbooks import DEFAULT_LOGBOOK_FILE, LOGBOOKS_DIR LOGBOOKS_PATH = settings.EXPOWEB / LOGBOOKS_DIR test_year = "1986" diff --git a/core/TESTS/test_logins.py b/core/TESTS/test_logins.py index 83a92ec..80802ca 100644 --- a/core/TESTS/test_logins.py +++ b/core/TESTS/test_logins.py @@ -9,14 +9,14 @@ import pathlib import re from http import HTTPStatus +from django.contrib.auth.models import User from django.test import Client, TestCase import troggle.settings as settings -from troggle.core.models.wallets import Wallet from troggle.core.models.troggle import Expedition -from django.contrib.auth.models import User +from troggle.core.models.wallets import Wallet from troggle.core.utils import current_expo - + current_year = current_expo() diff --git a/core/TESTS/test_parsers.py b/core/TESTS/test_parsers.py index 2d4435d..66e058d 100644 --- a/core/TESTS/test_parsers.py +++ b/core/TESTS/test_parsers.py @@ -22,14 +22,14 @@ import subprocess import unittest from http import HTTPStatus -from django.test import Client, SimpleTestCase, TestCase from django.contrib.auth.models import User +from django.test import Client, SimpleTestCase, TestCase -from troggle.core.models.logbooks import LogbookEntry -from troggle.core.models.troggle import Expedition, DataIssue, Person, PersonExpedition -from troggle.core.utils import current_expo import troggle.parsers.logbooks as lbp - +from troggle.core.models.logbooks import LogbookEntry +from troggle.core.models.troggle import DataIssue, Expedition, Person, PersonExpedition +from troggle.core.utils import current_expo + current_year = current_expo() diff --git a/core/TESTS/test_urls.py b/core/TESTS/test_urls.py index 6cee23e..e7a30cf 100644 --- a/core/TESTS/test_urls.py +++ b/core/TESTS/test_urls.py @@ -91,7 +91,8 @@ import re from http import HTTPStatus from django.test import Client, TestCase -from django.urls import reverse, path +from django.urls import path, reverse + # class SimplePageTest(unittest.TestCase): class URLTests(TestCase): diff --git a/core/TESTS/tests-cuyc-ignored.py b/core/TESTS/tests-cuyc-ignored.py index 976c97f..eedddf3 100644 --- a/core/TESTS/tests-cuyc-ignored.py +++ b/core/TESTS/tests-cuyc-ignored.py @@ -29,8 +29,7 @@ class ImportTest(TestCase): #ed to go through all modules and copy all imports here from io import StringIO - from cuy.club.models import (Article, Event, Member, Webpage, - WebpageCategory) + from cuy.club.models import Article, Event, Member, Webpage, WebpageCategory from cuy.website.views.generic import PUBLIC_LOGIN from django.conf import settings from django.contrib.auth.decorators import login_required @@ -371,7 +370,7 @@ class ComplexLoginTests(TestCase): self.assertIsNotNone(t, 'Logged in as \'' + u.username + '\' but failed to get /committee/ content') def test_user_force(self): - from django.conf import settings + from django.conf import settings c = self.client u = self.user m = self.member diff --git a/core/TESTS/tests_copilot.py b/core/TESTS/tests_copilot.py index 1812d32..103bfc4 100644 --- a/core/TESTS/tests_copilot.py +++ b/core/TESTS/tests_copilot.py @@ -1,6 +1,6 @@ # Copilot: Sure, based on your `urls.py` file, here's how you might write end-to-end tests for the `survey_scans` endpoints: -from django.test import TestCase, Client +from django.test import Client, TestCase from django.urls import reverse # Copilot does not know that there is no data in the database, so that the tests need to pre-populate with diff --git a/core/admin.py b/core/admin.py index fa04b12..00bb41c 100644 --- a/core/admin.py +++ b/core/admin.py @@ -12,8 +12,8 @@ from troggle.core.models.survex import ( SurvexPersonRole, SurvexStation, ) -from troggle.core.models.wallets import Wallet from troggle.core.models.troggle import DataIssue, Expedition, Person, PersonExpedition +from troggle.core.models.wallets import Wallet """This code significantly adds to the capabilities of the Django Management control panel for Troggle data. In particular, it enables JSON export of any data with 'export_as_json' diff --git a/core/forms.py b/core/forms.py index 822afa5..6ab7d91 100644 --- a/core/forms.py +++ b/core/forms.py @@ -1,17 +1,15 @@ +# from tinymce.widgets import TinyMCE +import re + import django.forms as forms +from django.core.exceptions import ValidationError from django.forms import ModelForm from django.forms.models import modelformset_factory from troggle.core.models.caves import Cave, CaveAndEntrance, Entrance from troggle.core.views.editor_helpers import HTMLarea -from django.core.exceptions import ValidationError - -# from tinymce.widgets import TinyMCE -import re - - """These are all the class-based Forms used by troggle. There are other, simpler, upload forms in view/uploads.py diff --git a/core/management/commands/dummycmd.py b/core/management/commands/dummycmd.py index 6424260..9c3c09a 100644 --- a/core/management/commands/dummycmd.py +++ b/core/management/commands/dummycmd.py @@ -1,7 +1,6 @@ from django.core.management.base import BaseCommand - """this is now replaced by databaseRest.py This is an example of how to create our own bespoke commandline diff --git a/core/models/caves.py b/core/models/caves.py index 9d508fc..12941d0 100644 --- a/core/models/caves.py +++ b/core/models/caves.py @@ -1,18 +1,17 @@ import os -import os import re from collections import defaultdict from datetime import datetime, timezone from pathlib import Path -from django.db import models, DataError +from django.db import DataError, models from django.template import loader import settings from troggle.core.models.logbooks import QM from troggle.core.models.survex import SurvexStation, utmToLatLng from troggle.core.models.troggle import DataIssue, TroggleModel -from troggle.core.utils import TROG, writetrogglefile, parse_aliases +from troggle.core.utils import TROG, parse_aliases, writetrogglefile # Use the TROG global object to cache the cave lookup list. No good for multi-user.., or even multi-page. Pointless in fact. Gcavelookup = TROG["caves"]["gcavelookup"] diff --git a/core/models/logbooks.py b/core/models/logbooks.py index 7bad58f..a5239f7 100644 --- a/core/models/logbooks.py +++ b/core/models/logbooks.py @@ -1,16 +1,14 @@ import re - from pathlib import Path from urllib.parse import urljoin from django.db import models -from django.urls import reverse from django.template import loader +from django.urls import reverse import settings from troggle.core.models.troggle import Expedition, TroggleModel - """The model declarations LogBookEntry, PersonLogEntry, QM """ diff --git a/core/models/survex.py b/core/models/survex.py index cb5c26e..6b9a818 100644 --- a/core/models/survex.py +++ b/core/models/survex.py @@ -1,12 +1,13 @@ -import math +import math import os import re -from urllib.parse import urljoin from pathlib import Path +from urllib.parse import urljoin from django.conf import settings from django.db import models from django.urls import reverse + from troggle.core.utils import height_from_utm, throw # from troggle.core.models.troggle import DataIssue # circular import. Hmm diff --git a/core/models/wallets.py b/core/models/wallets.py index 5c8202c..288608a 100644 --- a/core/models/wallets.py +++ b/core/models/wallets.py @@ -10,8 +10,8 @@ from django.conf import settings from django.db import models from django.urls import reverse -from troggle.core.models.troggle import DataIssue from troggle.core.models.caves import get_cave_leniently +from troggle.core.models.troggle import DataIssue # from troggle.core.models.survex import SurvexBlock # from troggle.core.models.troggle import DataIssue # circular import. Hmm diff --git a/core/utils.py b/core/utils.py index 721e7fe..a958d36 100644 --- a/core/utils.py +++ b/core/utils.py @@ -2,15 +2,13 @@ import hashlib import logging import math import os -import re import random +import re import resource import string import subprocess from datetime import datetime, timezone - from decimal import getcontext - from pathlib import Path from django.contrib.auth.models import User diff --git a/core/views/auth.py b/core/views/auth.py index 59a6c50..966a100 100644 --- a/core/views/auth.py +++ b/core/views/auth.py @@ -1,8 +1,7 @@ from django.conf import settings -from django.contrib.auth import authenticate +from django.contrib.auth import authenticate, login, logout from django.contrib.auth import forms as auth_forms -from django.contrib.auth import login, logout from django.contrib.auth.decorators import login_required from django.http import HttpResponse, HttpResponseRedirect from django.shortcuts import redirect, render diff --git a/core/views/caves.py b/core/views/caves.py index 56f0d36..70a7a84 100644 --- a/core/views/caves.py +++ b/core/views/caves.py @@ -1,32 +1,29 @@ import os import re -import django import subprocess import tempfile -import zipfile import urllib -from bs4 import BeautifulSoup - +import zipfile from pathlib import Path +import django +from bs4 import BeautifulSoup from django.core.exceptions import MultipleObjectsReturned, ObjectDoesNotExist -from django.http import HttpResponse, HttpResponseNotFound, HttpResponseRedirect, FileResponse -from django.shortcuts import render, redirect +from django.http import FileResponse, HttpResponse, HttpResponseNotFound, HttpResponseRedirect +from django.shortcuts import redirect, render +from django.template import loader from django.urls import NoReverseMatch, reverse +from django.utils.safestring import mark_safe import troggle.settings as settings -from troggle.core.forms import CaveForm, EntranceForm, EntranceLetterForm # CaveAndEntranceFormSet, +from troggle.core.forms import CaveForm, EntranceForm, EntranceLetterForm # CaveAndEntranceFormSet, from troggle.core.models.caves import Cave, CaveAndEntrance, Entrance, GetCaveLookup, get_cave_leniently from troggle.core.models.logbooks import QM from troggle.core.models.wallets import Wallet -from troggle.core.utils import write_and_commit -from troggle.core.utils import current_expo +from troggle.core.utils import current_expo, write_and_commit from troggle.core.views import expo -from troggle.settings import CAVEDESCRIPTIONS, ENTRANCEDESCRIPTIONS from troggle.parsers.caves import read_cave, read_entrance - -from django.template import loader -from django.utils.safestring import mark_safe +from troggle.settings import CAVEDESCRIPTIONS, ENTRANCEDESCRIPTIONS from .auth import login_required_if_public diff --git a/core/views/editor_helpers.py b/core/views/editor_helpers.py index 252d92e..7f80a9b 100644 --- a/core/views/editor_helpers.py +++ b/core/views/editor_helpers.py @@ -2,6 +2,7 @@ import io from pathlib import Path import django.forms as forms +import piexif from django.http import JsonResponse from django.shortcuts import render from django.template import loader @@ -9,8 +10,6 @@ from django.urls import reverse from django.views.decorators.csrf import ensure_csrf_cookie from PIL import Image -import piexif - import troggle.settings as settings from troggle.core.utils import WriteAndCommitError, write_and_commit diff --git a/core/views/expo.py b/core/views/expo.py index f0751d6..411aaec 100644 --- a/core/views/expo.py +++ b/core/views/expo.py @@ -14,7 +14,7 @@ from django.views.decorators.csrf import ensure_csrf_cookie import troggle.core.views.caves import troggle.settings as settings from troggle.core.models.caves import Cave -from troggle.core.utils import WriteAndCommitError, write_and_commit, current_expo +from troggle.core.utils import WriteAndCommitError, current_expo, write_and_commit from troggle.core.views.editor_helpers import HTMLarea from troggle.core.views.uploads import edittxtpage diff --git a/core/views/logbooks.py b/core/views/logbooks.py index 75f5c7d..4c88d03 100644 --- a/core/views/logbooks.py +++ b/core/views/logbooks.py @@ -1,20 +1,17 @@ import re from django.db.models import Q -from django.shortcuts import render +from django.shortcuts import redirect, render from django.views.generic.list import ListView -from django.shortcuts import render, redirect - import troggle.settings as settings -from troggle.core.models.logbooks import LogbookEntry, PersonLogEntry, QM, writelogbook +from troggle.core.models.logbooks import QM, LogbookEntry, PersonLogEntry, writelogbook from troggle.core.models.survex import SurvexBlock, SurvexFile from troggle.core.models.troggle import Expedition, Person from troggle.core.models.wallets import Wallet from troggle.core.utils import TROG, current_expo from troggle.parsers.imports import import_logbook - """These views are for logbook items when they appear in an 'expedition' page and for persons: their individual pages and their perseonexpedition pages. diff --git a/core/views/other.py b/core/views/other.py index ed03516..7c4c232 100644 --- a/core/views/other.py +++ b/core/views/other.py @@ -11,6 +11,7 @@ from troggle.core.models.logbooks import LogbookEntry, writelogbook # , PersonL # from databaseReset import reinit_db # don't do this. databaseRest runs code *at import time* from troggle.core.models.troggle import Expedition +from troggle.core.utils import current_expo from troggle.parsers.imports import ( import_caves, import_drawingsfiles, @@ -20,7 +21,7 @@ from troggle.parsers.imports import ( import_survex, import_surveyscans, ) -from troggle.core.utils import current_expo + from .auth import login_required_if_public """Utility functions and code to serve the control panel and individual user's @@ -37,11 +38,11 @@ def todos(request, module): """produces todo text from module We could automate this to find all those strings automatically """ - from troggle.core.TESTS.tests import todo as tests from troggle.core.forms import todo as forms from troggle.core.middleware import todo as middleware from troggle.core.models.caves import todo as modelcaves from troggle.core.models.logbooks import todo as modellogbooks + from troggle.core.TESTS.tests import todo as tests from troggle.core.views.caves import todo as viewcaves from troggle.core.views.drawings import todo as viewdrawings from troggle.core.views.logbooks import todo as viewlogbooks diff --git a/core/views/scans.py b/core/views/scans.py index 1d86d18..62251de 100644 --- a/core/views/scans.py +++ b/core/views/scans.py @@ -6,17 +6,15 @@ from django.conf import settings from django.http import HttpResponse from django.shortcuts import render - from troggle.core.models.caves import GetCaveLookup from troggle.core.models.survex import SingleScan, SurvexBlock, SurvexPersonRole -from troggle.core.models.wallets import Wallet from troggle.core.models.troggle import DataIssue, Expedition, Person, PersonExpedition +from troggle.core.models.wallets import Wallet +from troggle.core.utils import DatabaseResetOngoing, current_expo from troggle.core.views.expo import getmimetype from troggle.parsers.caves import add_cave_to_pending_list from troggle.parsers.people import GetPersonExpeditionNameLookup from troggle.parsers.survex import set_walletdate -from troggle.core.utils import current_expo, DatabaseResetOngoing - """ Note that caveifywallet() etc do NOT save the object to the db. They are ephemeral, just for the page rendering of the diff --git a/core/views/statistics.py b/core/views/statistics.py index 01e5d2f..ff0c879 100644 --- a/core/views/statistics.py +++ b/core/views/statistics.py @@ -7,11 +7,11 @@ from django.shortcuts import render import troggle.settings as settings from troggle.core.models.caves import Cave, Entrance from troggle.core.models.logbooks import LogbookEntry -from troggle.core.models.survex import SurvexStation, SurvexPersonRole +from troggle.core.models.survex import SurvexPersonRole, SurvexStation from troggle.core.models.troggle import DataIssue, Expedition, Person, PersonExpedition from troggle.core.models.wallets import Wallet -from troggle.parsers.people import GetPersonExpeditionNameLookup, foreign_friends from troggle.core.utils import current_expo +from troggle.parsers.people import GetPersonExpeditionNameLookup, foreign_friends # from django.views.generic.list import ListView """Very simple report pages summarizing data about the whole set of expeditions and of diff --git a/core/views/survex.py b/core/views/survex.py index 83d9d79..aae2c0c 100644 --- a/core/views/survex.py +++ b/core/views/survex.py @@ -3,24 +3,23 @@ import difflib import os import re import socket -from pathlib import Path from collections import namedtuple +from pathlib import Path from django import forms +from django.core.exceptions import MultipleObjectsReturned, ObjectDoesNotExist from django.db import models from django.db.models import Q - -from django.core.exceptions import MultipleObjectsReturned, ObjectDoesNotExist from django.http import HttpResponse from django.shortcuts import render from django.views.decorators.csrf import ensure_csrf_cookie import troggle.settings as settings -from troggle.core.models.logbooks import LogbookEntry from troggle.core.models.caves import Cave, GetCaveLookup -from troggle.core.models.survex import SurvexFile, SurvexBlock #, SurvexDirectory +from troggle.core.models.logbooks import LogbookEntry +from troggle.core.models.survex import SurvexBlock, SurvexFile #, SurvexDirectory from troggle.core.models.wallets import Wallet -from troggle.core.utils import only_commit, current_expo +from troggle.core.utils import current_expo, only_commit from troggle.parsers.survex import parse_one_file """Everything that views survexfiles diff --git a/core/views/uploads.py b/core/views/uploads.py index eae6f0a..9ef11ac 100644 --- a/core/views/uploads.py +++ b/core/views/uploads.py @@ -1,23 +1,21 @@ import subprocess -from datetime import datetime, timezone, timedelta +from datetime import datetime, timedelta, timezone from pathlib import Path from django import forms from django.core.files.storage import FileSystemStorage from django.http import HttpResponseRedirect -from django.shortcuts import render, redirect +from django.shortcuts import redirect, render import settings - from troggle.core.models.caves import GetCaveLookup -from troggle.core.models.logbooks import LogbookEntry, writelogbook, PersonLogEntry +from troggle.core.models.logbooks import LogbookEntry, PersonLogEntry, writelogbook from troggle.core.models.survex import DrawingFile from troggle.core.models.troggle import DataIssue, Expedition, PersonExpedition from troggle.core.utils import alphabet_suffix, current_expo, sanitize_name, unique_slug, write_and_commit from troggle.parsers.people import GetPersonExpeditionNameLookup, known_foreigner # from databaseReset import reinit_db # don't do this. databaseRest runs code *at import time* - from .auth import login_required_if_public """File upload 'views' diff --git a/core/views/wallets_edit.py b/core/views/wallets_edit.py index ea2cf80..83198fe 100644 --- a/core/views/wallets_edit.py +++ b/core/views/wallets_edit.py @@ -14,24 +14,18 @@ from django.http import HttpResponseRedirect from django.shortcuts import render import settings -from troggle.core.utils import current_expo, sanitize_name - from troggle.core.models.caves import Cave from troggle.core.models.logbooks import LogbookEntry # , PersonLogEntry from troggle.core.models.survex import SurvexBlock, SurvexFile, SurvexPersonRole from troggle.core.models.troggle import DataIssue, Expedition -from troggle.core.models.wallets import Wallet, YEAR_RANGE, make_valid_date - +from troggle.core.models.wallets import YEAR_RANGE, Wallet, make_valid_date +from troggle.core.utils import current_expo, sanitize_name from troggle.core.views.auth import login_required_if_public -from troggle.core.views.caves import getCave, get_cave_leniently +from troggle.core.views.caves import get_cave_leniently, getCave from troggle.core.views.scans import caveifywallet, oldwallet from troggle.core.views.uploads import FilesForm - -from troggle.core.utils import current_expo - from troggle.parsers.scans import contentsjson - """Main wallet editing form, which includes scan file upload into the wallet """ diff --git a/databaseReset.py b/databaseReset.py index ada1c62..37cdd4b 100644 --- a/databaseReset.py +++ b/databaseReset.py @@ -5,10 +5,11 @@ import resource import sys import time -import settings from django.core.management import call_command from django.core.management.commands import flush +import settings + """ 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, diff --git a/modelviz.py b/modelviz.py index a9a1f36..b82f123 100644 --- a/modelviz.py +++ b/modelviz.py @@ -42,8 +42,7 @@ else: from django.db import models from django.db.models import get_models -from django.db.models.fields.related import (ForeignKey, ManyToManyField, - OneToOneField) +from django.db.models.fields.related import ForeignKey, ManyToManyField, OneToOneField from django.template import Context, Template try: diff --git a/parsers/caves.py b/parsers/caves.py index 1954dbb..4ae5b29 100644 --- a/parsers/caves.py +++ b/parsers/caves.py @@ -2,14 +2,13 @@ import os import re import string import sys - from pathlib import Path from django.conf import settings from django.db import transaction -from troggle.core.models.caves import Cave, CaveAndEntrance, Entrance, GetCaveLookup -from troggle.core.models.survex import SurvexStation +from troggle.core.models.caves import Cave, CaveAndEntrance, Entrance, GetCaveLookup +from troggle.core.models.survex import SurvexStation from troggle.core.models.troggle import DataIssue from troggle.settings import CAVEDESCRIPTIONS, ENTRANCEDESCRIPTIONS, EXPOWEB, SURVEX_DATA diff --git a/parsers/locations.py b/parsers/locations.py index d89ea76..ec0a4ff 100644 --- a/parsers/locations.py +++ b/parsers/locations.py @@ -7,17 +7,16 @@ import time from datetime import datetime, timezone from pathlib import Path - import troggle.settings as settings from troggle.core.models.caves import Cave, Entrance from troggle.core.models.logbooks import QM from troggle.core.models.survex import SurvexBlock, SurvexFile, SurvexPersonRole, SurvexStation -from troggle.core.models.wallets import Wallet from troggle.core.models.troggle import DataIssue, Expedition +from troggle.core.models.wallets import Wallet from troggle.core.utils import chaosmonkey, get_process_memory from troggle.parsers.logbooks import GetCaveLookup from troggle.parsers.people import GetPersonExpeditionNameLookup, known_foreigner -from troggle.parsers.survex import stash_data_issue, store_data_issues, ROOTBLOCK +from troggle.parsers.survex import ROOTBLOCK, stash_data_issue, store_data_issues """Uses the imported data to find the locations of the survey stations labelled as entrances diff --git a/parsers/logbooks.py b/parsers/logbooks.py index abcf199..2ede83f 100644 --- a/parsers/logbooks.py +++ b/parsers/logbooks.py @@ -1,9 +1,8 @@ import os import re -import sys import string +import sys import time - from datetime import date, datetime from pathlib import Path from random import randint @@ -11,11 +10,11 @@ from random import randint from django.conf import settings from django.template.defaultfilters import slugify -from parsers.people import GetPersonExpeditionNameLookup, load_people_expos, known_foreigner +from parsers.people import GetPersonExpeditionNameLookup, known_foreigner, load_people_expos from troggle.core.models.caves import GetCaveLookup from troggle.core.models.logbooks import LogbookEntry, PersonLogEntry from troggle.core.models.troggle import DataIssue, Expedition -from troggle.core.utils import get_process_memory, alphabet_suffix, unique_slug +from troggle.core.utils import alphabet_suffix, get_process_memory, unique_slug EPOCH = settings.EPOCH """ diff --git a/parsers/people.py b/parsers/people.py index 2d7c5b0..5037dae 100644 --- a/parsers/people.py +++ b/parsers/people.py @@ -3,9 +3,9 @@ import os import re from html import unescape from pathlib import Path -from unidecode import unidecode from django.conf import settings +from unidecode import unidecode from troggle.core.models.troggle import DataIssue, Expedition, Person, PersonExpedition diff --git a/parsers/survex.py b/parsers/survex.py index bdfb1f4..22f5ef5 100644 --- a/parsers/survex.py +++ b/parsers/survex.py @@ -11,12 +11,10 @@ import troggle.settings as settings from troggle.core.models.caves import Cave, Entrance, GetCaveLookup from troggle.core.models.logbooks import QM from troggle.core.models.survex import SurvexBlock, SurvexFile, SurvexPersonRole, SurvexStation -from troggle.core.models.wallets import Wallet from troggle.core.models.troggle import DataIssue, Expedition -from troggle.core.utils import chaosmonkey, get_process_memory -from troggle.core.utils import write_and_commit - -from troggle.parsers.caves import create_new_cave, do_ARGE_cave, AREACODES, ARGEAREAS +from troggle.core.models.wallets import Wallet +from troggle.core.utils import chaosmonkey, get_process_memory, write_and_commit +from troggle.parsers.caves import AREACODES, ARGEAREAS, create_new_cave, do_ARGE_cave from troggle.parsers.people import GetPersonExpeditionNameLookup, known_foreigner """Imports the tree of survex files following from a defined root .svx file diff --git a/photomap/pmap.py b/photomap/pmap.py index 055b735..aa4ad3b 100644 --- a/photomap/pmap.py +++ b/photomap/pmap.py @@ -1,8 +1,9 @@ import os -import folium -from pathlib import Path -from PIL import Image, ExifTags from itertools import chain +from pathlib import Path + +import folium +from PIL import ExifTags, Image """To do - create gpx file for adding in to existing GPSprune maps