Skip to content

Commit cc606f0

Browse files
author
Steve Lamb
committed
Misc cleanup
Fix lint Pass kwargs straight through to fn that uses them
1 parent a91df60 commit cc606f0

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

djqscsv/_csql.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,14 @@
66
This module may later be officially supported.
77
"""
88

9+
910
def _transform(dataset, arg):
1011
if isinstance(arg, str):
1112
return (dataset[0].index(arg), arg)
1213
elif isinstance(arg, tuple):
1314
return (dataset[0].index(arg[0]), arg[1])
1415

16+
1517
def SELECT(dataset, *args):
1618
# turn the args into indices based on the first row
1719
index_headers = [_transform(dataset, arg) for arg in args]
@@ -25,10 +27,12 @@ def SELECT(dataset, *args):
2527
for datarow in dataset[1:]]
2628
return results
2729

30+
2831
def EXCLUDE(dataset, *args):
2932
antiargs = [value for index, value in enumerate(dataset[0])
30-
if not index in args and not value in args]
33+
if index not in args and value not in args]
3134
return SELECT(dataset, *antiargs)
3235

36+
3337
def AS(field, display_name):
3438
return (field, display_name)

djqscsv/djqscsv.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from django.conf import settings
1010
if not settings.configured:
1111
# required to import ValuesQuerySet
12-
settings.configure() # pragma: no cover
12+
settings.configure() # pragma: no cover
1313

1414
from django.db.models.query import ValuesQuerySet
1515

@@ -23,8 +23,7 @@ class CSVException(Exception):
2323

2424

2525
def render_to_csv_response(queryset, filename=None, append_datestamp=False,
26-
field_header_map=None, use_verbose_names=True,
27-
field_order=None):
26+
**kwargs):
2827
"""
2928
provides the boilerplate for making a CSV http response.
3029
takes a filename or generates one from the queryset's model.
@@ -41,7 +40,7 @@ def render_to_csv_response(queryset, filename=None, append_datestamp=False,
4140
response['Content-Disposition'] = 'attachment; filename=%s;' % filename
4241
response['Cache-Control'] = 'no-cache'
4342

44-
write_csv(queryset, response, field_header_map, use_verbose_names, field_order)
43+
write_csv(queryset, response, **kwargs)
4544

4645
return response
4746

@@ -83,7 +82,6 @@ def write_csv(queryset, file_obj, field_header_map=None,
8382
[field for field in field_names
8483
if field not in field_order])
8584

86-
8785
writer = csv.DictWriter(file_obj, field_names)
8886

8987
# verbose_name defaults to the raw field name, so in either case

0 commit comments

Comments
 (0)