Skip to content

Commit 3bdc2a9

Browse files
committed
fix linting issues from black version update
1 parent e68ce6b commit 3bdc2a9

File tree

8 files changed

+59
-54
lines changed

8 files changed

+59
-54
lines changed

caps/dataframe/la.py

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
local authority data
44
55
"""
6+
67
from functools import lru_cache
78
from typing import Callable, Optional, List
89
import string

caps/forms.py

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
Forms for the CAPS app
33
"""
44

5-
65
from django.forms import CharField, ChoiceField, ModelChoiceField, RadioSelect, Select
76
from haystack.forms import SearchForm
87
from haystack.inputs import Exact

caps/management/commands/import_emissions_data.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""
22
Import local authority_emissions
33
"""
4+
45
import pandas as pd
56
from caps.models import Council, DataPoint, DataType
67
from django.core.management.base import BaseCommand

caps/management/commands/import_polling_data.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""
22
Import local authority_emissions
33
"""
4+
45
import pandas as pd
56
from caps.models import Council, DataPoint, DataType
67
from django.core.management.base import BaseCommand

caps/search_funcs.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""
22
Functions for use by the semantic search features
33
"""
4+
45
import re
56
from collections import namedtuple
67
from itertools import groupby

caps/views.py

+12-12
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,9 @@ def get_context_data(self, **kwargs):
108108
)
109109
context = add_context_for_plans_download_and_search(context)
110110
context["page_title"] = "Local Climate Assemblies - CAPE"
111-
context[
112-
"page_description"
113-
] = "Search and view reports from local climate assemblies."
111+
context["page_description"] = (
112+
"Search and view reports from local climate assemblies."
113+
)
114114
return context
115115

116116

@@ -156,19 +156,19 @@ def get_emissions_context(self, council: Council) -> dict[str, Any]:
156156
latest_year_total_emissions = council_emissions_data.get(
157157
year=latest_year, data_type__name="Total Emissions"
158158
).value
159-
context[
160-
"latest_year_per_capita_emissions"
161-
] = latest_year_per_capita_emissions
159+
context["latest_year_per_capita_emissions"] = (
160+
latest_year_per_capita_emissions
161+
)
162162
context["latest_year_per_km2_emissions"] = latest_year_per_km2_emissions
163163
context["latest_year_total_emissions"] = latest_year_total_emissions
164164
context["emissions_data"] = True
165165
except DataPoint.DoesNotExist as e:
166166
pass
167167

168168
if context["emissions_data"]:
169-
context[
170-
"current_emissions_breakdown"
171-
] = council.current_emissions_breakdown(year=latest_year)
169+
context["current_emissions_breakdown"] = (
170+
council.current_emissions_breakdown(year=latest_year)
171+
)
172172
multi_emission_chart = charts.multi_emissions_chart(council, latest_year)
173173
context["chart_collection"] = ChartCollection()
174174
context["chart_collection"].register(multi_emission_chart)
@@ -231,9 +231,9 @@ def get_scorecard_context(self, council: Council) -> dict[str, Any]:
231231
"num_sections": len(top_scoring_sections),
232232
}
233233
if len(top_scoring_sections) > 0:
234-
context["scoring_accolades"][
235-
"example_section"
236-
] = top_scoring_sections[0]["description"]
234+
context["scoring_accolades"]["example_section"] = (
235+
top_scoring_sections[0]["description"]
236+
)
237237

238238
context["scoring_hidden"] = getattr(settings, "SCORECARDS_PRIVATE", False)
239239

scoring/views.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -1159,12 +1159,12 @@ def get_context_data(self, **kwargs):
11591159

11601160
context["methodology_year"] = methodology_year
11611161
context["toc_template"] = f"scoring/methodology/{methodology_year}/_toc.html"
1162-
context[
1163-
"intro_template"
1164-
] = f"scoring/methodology/{methodology_year}/_intro.html"
1165-
context[
1166-
"details_template"
1167-
] = f"scoring/methodology/{methodology_year}/_details.html"
1162+
context["intro_template"] = (
1163+
f"scoring/methodology/{methodology_year}/_intro.html"
1164+
)
1165+
context["details_template"] = (
1166+
f"scoring/methodology/{methodology_year}/_details.html"
1167+
)
11681168

11691169
questions = (
11701170
PlanQuestion.objects.filter(section__year=methodology_year)

scoring2022/views.py

+37-35
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,9 @@ def get_missing_councils(self, council_ids, authority_type):
9090

9191
def get_context_data(self, **kwargs):
9292
context = super().get_context_data(**kwargs)
93-
context[
94-
"all_councils"
95-
] = Council.objects.all() # for location search autocomplete
93+
context["all_councils"] = (
94+
Council.objects.all()
95+
) # for location search autocomplete
9696

9797
authority_type = self.get_authority_type()
9898

@@ -139,9 +139,11 @@ def get_context_data(self, **kwargs):
139139
sorted_by = sort
140140
councils = sorted(
141141
councils,
142-
key=lambda council: 0
143-
if council["score"] == 0 or council["score"] is None
144-
else council["all_scores"][sort]["score"],
142+
key=lambda council: (
143+
0
144+
if council["score"] == 0 or council["score"] is None
145+
else council["all_scores"][sort]["score"]
146+
),
145147
reverse=True,
146148
)
147149
councils = sorted(councils, key=itemgetter("code"))
@@ -304,18 +306,18 @@ def get_context_data(self, **kwargs):
304306
)
305307

306308
context["comparisons"] = comparisons
307-
context[
308-
"page_description"
309-
] = "Want to know how effective {name}’s climate plans are? Check out {name}’s Council Climate Scorecard to understand how their climate plans compare to local authorities across the UK.".format(
310-
name=council.name
309+
context["page_description"] = (
310+
"Want to know how effective {name}’s climate plans are? Check out {name}’s Council Climate Scorecard to understand how their climate plans compare to local authorities across the UK.".format(
311+
name=council.name
312+
)
311313
)
312-
context[
313-
"twitter_tweet_text"
314-
] = "Up to 30% of the UK’s transition to zero carbon is within the influence of local councils - that’s why I’m checking {name}’s Climate Action Plan on 📋 #CouncilClimateScorecards".format(
315-
name=(
316-
"@{}".format(council.twitter_name)
317-
if council.twitter_name
318-
else council.name
314+
context["twitter_tweet_text"] = (
315+
"Up to 30% of the UK’s transition to zero carbon is within the influence of local councils - that’s why I’m checking {name}’s Climate Action Plan on 📋 #CouncilClimateScorecards".format(
316+
name=(
317+
"@{}".format(council.twitter_name)
318+
if council.twitter_name
319+
else council.name
320+
)
319321
)
320322
)
321323
return context
@@ -339,9 +341,9 @@ def get_authority_type(self):
339341

340342
def get_context_data(self, **kwargs):
341343
context = super().get_context_data(**kwargs)
342-
context[
343-
"all_councils"
344-
] = Council.objects.all() # for location search autocomplete
344+
context["all_councils"] = (
345+
Council.objects.all()
346+
) # for location search autocomplete
345347

346348
filter_args = {
347349
"data": self.request.GET or None,
@@ -496,9 +498,9 @@ class LocationResultsView(PrivateScorecardsAccessMixin, BaseLocationResultsView)
496498

497499
def get_context_data(self, **kwargs):
498500
context = super().get_context_data(**kwargs)
499-
context[
500-
"all_councils"
501-
] = Council.objects.all() # for location search autocomplete
501+
context["all_councils"] = (
502+
Council.objects.all()
503+
) # for location search autocomplete
502504
context["page_title"] = "Choose a council"
503505
return context
504506

@@ -509,9 +511,9 @@ class MethodologyView(PrivateScorecardsAccessMixin, TemplateView):
509511

510512
def get_context_data(self, **kwargs):
511513
context = super().get_context_data(**kwargs)
512-
context[
513-
"all_councils"
514-
] = Council.objects.all() # for location search autocomplete
514+
context["all_councils"] = (
515+
Council.objects.all()
516+
) # for location search autocomplete
515517

516518
# questions = PlanQuestion.objects.all()
517519
# sections = PlanSection.objects.all()
@@ -562,9 +564,9 @@ class AboutView(PrivateScorecardsAccessMixin, TemplateView):
562564

563565
def get_context_data(self, **kwargs):
564566
context = super().get_context_data(**kwargs)
565-
context[
566-
"all_councils"
567-
] = Council.objects.all() # for location search autocomplete
567+
context["all_councils"] = (
568+
Council.objects.all()
569+
) # for location search autocomplete
568570
context["page_title"] = "About"
569571
context["current_page"] = "about-page"
570572
return context
@@ -576,9 +578,9 @@ class ContactView(PrivateScorecardsAccessMixin, TemplateView):
576578

577579
def get_context_data(self, **kwargs):
578580
context = super().get_context_data(**kwargs)
579-
context[
580-
"all_councils"
581-
] = Council.objects.all() # for location search autocomplete
581+
context["all_councils"] = (
582+
Council.objects.all()
583+
) # for location search autocomplete
582584
context["page_title"] = "Contact"
583585
context["current_page"] = "contact-page"
584586
return context
@@ -590,9 +592,9 @@ class HowToUseView(TemplateView):
590592

591593
def get_context_data(self, **kwargs):
592594
context = super().get_context_data(**kwargs)
593-
context[
594-
"all_councils"
595-
] = Council.objects.all() # for location search autocomplete
595+
context["all_councils"] = (
596+
Council.objects.all()
597+
) # for location search autocomplete
596598
context["page_title"] = "How to use the Scorecards"
597599
context["current_page"] = "how-to-page"
598600
return context

0 commit comments

Comments
 (0)