Skip to content

Commit

Permalink
chore: Fix E501
Browse files Browse the repository at this point in the history
  • Loading branch information
jpmckinney committed Dec 10, 2023
1 parent c17539d commit 084cf03
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 7 deletions.
5 changes: 4 additions & 1 deletion postcodes/management/commands/loadpostcodeconcordance.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ def add_arguments(self, parser):
action='store',
dest='search-field',
default='external_id',
help="Set the SQL column to which the second column of the CSV corresponds. One of 'external_id' (default), 'name' or 'slug'.",
help=(
"Set the SQL column to which the second column of the CSV corresponds. "
"One of 'external_id' (default), 'name' or 'slug'."
),
)

@transaction.atomic
Expand Down
5 changes: 4 additions & 1 deletion postcodes/management/commands/loadpostcodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@


class Command(BaseCommand):
help = 'Imports a headerless CSV file with columns for code,latitude,longitude,locality,region. If no filename is given, reads from standard input.'
help = (
'Imports a headerless CSV file with columns for code,latitude,longitude,locality,region. '
'If no filename is given, reads from standard input.'
)

def add_arguments(self, parser):
parser.add_argument('filename', nargs='?')
Expand Down
9 changes: 7 additions & 2 deletions postcodes/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,10 @@ def get_boundaries(self, sets=None):
concordance_sets = set()

if concordances:
q = ((models.Q(set=concordance.split('/')[0]) & models.Q(slug=concordance.split('/')[1])) for concordance in concordances)
q = (
(models.Q(set=concordance.split('/')[0]) & models.Q(slug=concordance.split('/')[1]))
for concordance in concordances
)

boundaries = Boundary.objects.filter(reduce(lambda a, b: a | b, q))
boundaries = Boundary.prepare_queryset_for_get_dicts(boundaries)
Expand All @@ -125,7 +128,9 @@ def get_boundaries(self, sets=None):
boundaries = Boundary.prepare_queryset_for_get_dicts(boundaries)
boundaries = Boundary.get_dicts(boundaries)

r['boundaries_centroid'] = [boundary for boundary in boundaries if boundary['related']['boundary_set_url'] not in concordance_sets]
r['boundaries_centroid'] = [
boundary for boundary in boundaries if boundary['related']['boundary_set_url'] not in concordance_sets
]

return r

Expand Down
4 changes: 1 addition & 3 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,5 @@ install_requires =
profile = black

[flake8]
max-line-length = 119
exclude = postcodes/migrations
extend-ignore =
# E501 line too long (X > 79 characters)
E501

0 comments on commit 084cf03

Please sign in to comment.