Skip to content

Commit

Permalink
Merge pull request #3244 from SEED-platform/upgrade-isort
Browse files Browse the repository at this point in the history
upgrade isort to 5.10
  • Loading branch information
nllong committed May 8, 2022
2 parents 3b8e88b + 3b938ba commit 75292eb
Show file tree
Hide file tree
Showing 280 changed files with 331 additions and 61 deletions.
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ repos:
- id: pretty-format-json
args: ['--autofix', '--no-sort-keys', '--no-ensure-ascii']
- repo: https://github.com/pre-commit/mirrors-isort
rev: v4.3.4
rev: v5.10.1
hooks:
- id: isort
args: ['-m 3'] # vertical hanging
args: [-m=VERTICAL_HANGING_INDENT, --skip=seed/models/__init__.py, --filter-files]
1 change: 1 addition & 0 deletions config/settings/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

from django.utils.translation import gettext_lazy as _
from kombu.serialization import register

from seed.serializers.celery import CeleryDatetimeSerializer

BASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
Expand Down
3 changes: 2 additions & 1 deletion config/settings/docker.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@

import os

from config.settings.common import * # noqa
from kombu import Exchange, Queue

from config.settings.common import * # noqa

# Gather all the settings from the docker environment variables
ENV_VARS = ['POSTGRES_DB', 'POSTGRES_PORT', 'POSTGRES_USER', 'POSTGRES_PASSWORD', ]

Expand Down
3 changes: 2 additions & 1 deletion config/settings/docker_dev.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@
import sys

from celery.utils import LOG_LEVELS
from config.settings.common import * # noqa
from kombu import Exchange, Queue

from config.settings.common import * # noqa

# override MEDIA_URL (requires nginx which dev stack doesn't use)
MEDIA_URL = '/media/'

Expand Down
1 change: 1 addition & 0 deletions config/settings/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import os

from celery.utils import LOG_LEVELS

from config.settings.common import * # noqa

PASSWORD_HASHERS = (
Expand Down
1 change: 1 addition & 0 deletions config/tests/test_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

from django.core.management import call_command
from django.test import TestCase

from seed.landing.models import SEEDUser as User
from seed.lib.superperms.orgs.models import Organization, OrganizationUser

Expand Down
3 changes: 2 additions & 1 deletion config/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
:copyright (c) 2014 - 2022, The Regents of the University of California, through Lawrence Berkeley National Laboratory (subject to receipt of any required approvals from the U.S. Department of Energy) and contributors. All rights reserved.
:author
"""
from config.views import robots_txt
from django.conf import settings
from django.conf.urls import include, re_path
from django.conf.urls.static import static
Expand All @@ -13,6 +12,8 @@
from drf_yasg import openapi
from drf_yasg.views import get_schema_view
from rest_framework import permissions

from config.views import robots_txt
from seed.api.base.urls import urlpatterns as api
from seed.landing.views import (
password_reset_complete,
Expand Down
1 change: 1 addition & 0 deletions seed/admin.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from django.contrib import admin

from seed.models import (
Column,
Cycle,
Expand Down
6 changes: 3 additions & 3 deletions seed/analysis_pipelines/better/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from seed.analysis_pipelines.better.pipeline import ( # noqa: F401
BETTERPipeline,
_prepare_all_properties,
_finish_preparation,
_start_analysis,
_finish_analysis,
_finish_preparation,
_prepare_all_properties,
_start_analysis
)
1 change: 1 addition & 0 deletions seed/analysis_pipelines/better/buildingsync.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from lxml import etree
from lxml.builder import ElementMaker
from quantityfield.units import ureg

from seed.analysis_pipelines.pipeline import AnalysisPipelineException
from seed.building_sync.mappings import BUILDINGSYNC_URI, NAMESPACES
from seed.models import Meter
Expand Down
1 change: 1 addition & 0 deletions seed/analysis_pipelines/better/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import polling
import requests
from django.conf import settings

from seed.analysis_pipelines.pipeline import AnalysisPipelineException

logger = logging.getLogger(__name__)
Expand Down
1 change: 1 addition & 0 deletions seed/analysis_pipelines/better/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from collections import namedtuple

from django.core.files.base import File as BaseFile

from seed.analysis_pipelines.better.buildingsync import (
_parse_analysis_property_view_id
)
Expand Down
1 change: 1 addition & 0 deletions seed/analysis_pipelines/better/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from celery import chain, shared_task
from django.core.files.base import ContentFile
from django.db.models import Count

from seed.analysis_pipelines.better.buildingsync import (
SEED_TO_BSYNC_RESOURCE_TYPE,
_build_better_input
Expand Down
1 change: 1 addition & 0 deletions seed/analysis_pipelines/bsyncr.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
from django.db.models import Count
from lxml import etree
from lxml.builder import ElementMaker

from seed.analysis_pipelines.pipeline import (
AnalysisPipeline,
AnalysisPipelineException,
Expand Down
1 change: 1 addition & 0 deletions seed/analysis_pipelines/co2.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import logging

from celery import chain, shared_task

from seed.analysis_pipelines.pipeline import (
AnalysisPipeline,
AnalysisPipelineException,
Expand Down
1 change: 1 addition & 0 deletions seed/analysis_pipelines/eui.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import logging

from celery import chain, shared_task

from seed.analysis_pipelines.pipeline import (
AnalysisPipeline,
AnalysisPipelineException,
Expand Down
5 changes: 3 additions & 2 deletions seed/analysis_pipelines/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from django.db import transaction
from django.db.utils import OperationalError
from django.utils import timezone as tz

from seed.decorators import get_prog_key
from seed.lib.progress_data.progress_data import ProgressData
from seed.models import Analysis, AnalysisMessage, AnalysisPropertyView
Expand Down Expand Up @@ -264,10 +265,10 @@ def factory(cls, analysis):
:returns: An implementation of AnalysisPipeline, e.g. BsyncrPipeline
"""
# import here to avoid circular dependencies
from seed.analysis_pipelines.bsyncr import BsyncrPipeline
from seed.analysis_pipelines.better import BETTERPipeline
from seed.analysis_pipelines.eui import EUIPipeline
from seed.analysis_pipelines.bsyncr import BsyncrPipeline
from seed.analysis_pipelines.co2 import CO2Pipeline
from seed.analysis_pipelines.eui import EUIPipeline

if analysis.service == Analysis.BSYNCR:
return BsyncrPipeline(analysis.id)
Expand Down
1 change: 1 addition & 0 deletions seed/api/base/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"""
from django.conf import settings
from django.conf.urls import include, re_path

from seed.api.v1.urls import urlpatterns as apiv1
from seed.api.v2.urls import urlpatterns as apiv2
from seed.api.v2_1.urls import urlpatterns as apiv2_1
Expand Down
1 change: 1 addition & 0 deletions seed/api/base/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from rest_framework import viewsets
from rest_framework.decorators import action
from rest_framework.reverse import reverse

from seed.decorators import ajax_request


Expand Down
1 change: 1 addition & 0 deletions seed/api/v1/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

from django.conf.urls import include, re_path
from rest_framework import routers

from seed.views.main import (
delete_organization_inventory,
get_default_building_detail_columns,
Expand Down
1 change: 1 addition & 0 deletions seed/api/v2/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"""
from django.conf.urls import include, re_path
from rest_framework import routers

from seed.api.base.views import TestReverseViewSet, test_view_with_arg
from seed.api.v2.views import ProgressViewSetV2
from seed.data_importer.views import (
Expand Down
1 change: 1 addition & 0 deletions seed/api/v2/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from django.http import JsonResponse
from rest_framework import viewsets

from seed.decorators import ajax_request_class
from seed.utils.api import api_endpoint_class
from seed.utils.cache import get_cache
Expand Down
1 change: 1 addition & 0 deletions seed/api/v2_1/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"""
from django.conf.urls import include, re_path
from rest_framework_nested import routers

from seed.api.v2_1.views import PropertyViewSetV21
from seed.views.notes import NoteViewSet
from seed.views.portfoliomanager import PortfolioManagerViewSet
Expand Down
1 change: 1 addition & 0 deletions seed/api/v2_1/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from django_filters.rest_framework import FilterSet
from rest_framework import status
from rest_framework.decorators import action

from seed.building_sync.building_sync import BuildingSync
from seed.hpxml.hpxml import HPXML
from seed.lib.superperms.orgs.decorators import has_perm_class
Expand Down
1 change: 1 addition & 0 deletions seed/api/v3/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from django.conf.urls import include, re_path
from rest_framework import routers
from rest_framework_nested import routers as nested_routers

from seed.views.v3.analyses import AnalysisViewSet
from seed.views.v3.analysis_messages import AnalysisMessageViewSet
from seed.views.v3.analysis_views import AnalysisPropertyViewViewSet
Expand Down
1 change: 1 addition & 0 deletions seed/authentication.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"""

from rest_framework import authentication

from seed.landing.models import SEEDUser as User


Expand Down
3 changes: 2 additions & 1 deletion seed/building_sync/building_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@

import xmlschema
from buildingsync_asset_extractor.processor import BSyncProcessor as BAE
from config.settings.common import BASE_DIR
from django.core.exceptions import FieldDoesNotExist
from lxml import etree
from quantityfield.units import ureg

from config.settings.common import BASE_DIR
from seed.building_sync.mappings import (
BASE_MAPPING_V2,
BUILDINGSYNC_URI,
Expand Down
1 change: 1 addition & 0 deletions seed/building_sync/tests/test_buildingsync.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

from django.core.files.uploadedfile import SimpleUploadedFile
from django.test import TestCase

from seed.models import User
from seed.models.building_file import BuildingFile
from seed.models.meters import Meter, MeterReading
Expand Down
3 changes: 2 additions & 1 deletion seed/building_sync/tests/test_buildingsync_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@
from datetime import datetime
from os import path

from config.settings.common import BASE_DIR
from django.urls import reverse
from django.utils import timezone

from config.settings.common import BASE_DIR
from seed.landing.models import SEEDUser as User
from seed.models import ColumnMappingProfile, PropertyView, StatusLabel
from seed.test_helpers.fake import (
Expand Down
1 change: 1 addition & 0 deletions seed/building_sync/tests/test_mappings.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

from django.test import TestCase
from lxml import etree

from seed.building_sync.building_sync import BuildingSync
from seed.building_sync.mappings import (
BUILDINGSYNC_URI,
Expand Down
3 changes: 2 additions & 1 deletion seed/building_sync/tests/test_validation_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@
import os
from unittest.mock import patch

from config.settings.common import BASE_DIR
from django.test import TestCase
from requests.models import Response

from config.settings.common import BASE_DIR
from seed.building_sync.validation_client import (
DEFAULT_SCHEMA_VERSION,
DEFAULT_USE_CASE,
Expand Down
1 change: 1 addition & 0 deletions seed/building_sync/validation_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import zipfile

import requests

from seed.building_sync.building_sync import BuildingSync

VALIDATION_API_URL = "https://buildingsync.net/api/validate"
Expand Down
1 change: 1 addition & 0 deletions seed/data_importer/equivalence_partitioner.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import collections

from celery.utils.log import get_task_logger

from seed.models import PropertyState, TaxLotState

_log = get_task_logger(__name__)
Expand Down
1 change: 1 addition & 0 deletions seed/data_importer/match.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from django.contrib.postgres.aggregates.general import ArrayAgg
from django.db import IntegrityError, transaction
from django.db.models import Subquery

from seed.data_importer.models import ImportFile
from seed.decorators import lock_and_track
from seed.lib.merging import merging
Expand Down
3 changes: 2 additions & 1 deletion seed/data_importer/meters_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@
from calendar import monthrange
from datetime import datetime, timedelta

from config.settings.common import TIME_ZONE
from django.db.models import Subquery
from django.utils.timezone import make_aware
from pytz import timezone

from config.settings.common import TIME_ZONE
from seed.data_importer.utils import (
kbtu_thermal_conversion_factors,
usage_point_id
Expand Down
9 changes: 3 additions & 6 deletions seed/data_importer/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@
import tempfile
from urllib.parse import unquote

from config.utils import de_camel_case
from django.db import models
from django.db.models import Q
from django.urls import reverse
from django_extensions.db.models import TimeStampedModel

from config.utils import de_camel_case
from seed.data_importer.managers import NotDeletedManager
from seed.lib.mcm.reader import ROW_DELIMITER
from seed.lib.superperms.orgs.models import Organization as SuperOrganization
Expand Down Expand Up @@ -912,11 +913,7 @@ def find_unmatched_states(self, kls):
:return: QuerySet, list of model objects [either PropertyState or TaxLotState]
"""

from seed.models import (
PropertyState,
TaxLotState,
DATA_STATE_MAPPING
)
from seed.models import DATA_STATE_MAPPING, PropertyState, TaxLotState

assert kls in [PropertyState,
TaxLotState], 'Must be one of our State objects [PropertyState, TaxLotState]!'
Expand Down
3 changes: 2 additions & 1 deletion seed/data_importer/sensor_readings_parser.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# !/usr/bin/env python
# encoding: utf-8

from config.settings.common import TIME_ZONE
from pytz import timezone

from config.settings.common import TIME_ZONE
from seed.lib.mcm import reader
from seed.models import Sensor

Expand Down
3 changes: 2 additions & 1 deletion seed/data_importer/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
from django.utils import timezone as tz
from django.utils.timezone import make_naive
from past.builtins import basestring
from unidecode import unidecode

from seed.building_sync import validation_client
from seed.building_sync.building_sync import BuildingSync
from seed.data_importer.equivalence_partitioner import EquivalencePartitioner
Expand Down Expand Up @@ -85,7 +87,6 @@
from seed.utils.geocode import MapQuestAPIKeyError, geocode_buildings
from seed.utils.match import update_sub_progress_total
from seed.utils.ubid import decode_unique_ids
from unidecode import unidecode

# from seed.utils.cprofile import cprofile

Expand Down
1 change: 1 addition & 0 deletions seed/data_importer/tests/integration/test_case_a.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import pathlib

from django.core.files.uploadedfile import SimpleUploadedFile

from seed.data_importer import tasks
from seed.data_importer.tests.util import FAKE_MAPPINGS
from seed.models import (
Expand Down

0 comments on commit 75292eb

Please sign in to comment.