Skip to content

Commit d03a1d6

Browse files
committed
chg: PEP-8 !cosmetic
1 parent 944706c commit d03a1d6

File tree

1 file changed

+25
-32
lines changed

1 file changed

+25
-32
lines changed

haystack/management/commands/update_index.py

Lines changed: 25 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -120,38 +120,29 @@ class Command(LabelCommand):
120120
help = "Freshens the index for the given app(s)."
121121
base_options = (
122122
make_option('-a', '--age', action='store', dest='age',
123-
default=DEFAULT_AGE, type='int',
124-
help='Number of hours back to consider objects new.'
125-
),
126-
make_option('-s', '--start', action='store', dest='start_date',
127-
default=None, type='string',
128-
help='The start date for indexing within. Can be any dateutil-parsable string, recommended to be YYYY-MM-DDTHH:MM:SS.'
129-
),
130-
make_option('-e', '--end', action='store', dest='end_date',
131-
default=None, type='string',
132-
help='The end date for indexing within. Can be any dateutil-parsable string, recommended to be YYYY-MM-DDTHH:MM:SS.'
133-
),
134-
make_option('-b', '--batch-size', action='store', dest='batchsize',
135-
default=None, type='int',
136-
help='Number of items to index at once.'
137-
),
138-
make_option('-r', '--remove', action='store_true', dest='remove',
139-
default=False, help='Remove objects from the index that are no longer present in the database.'
140-
),
123+
default=DEFAULT_AGE, type='int',
124+
help='Number of hours back to consider objects new.'),
125+
make_option('-s', '--start', action='store', dest='start_date', default=None, type='string',
126+
help='The start date for indexing within. Can be any dateutil-parsable string,'
127+
' recommended to be YYYY-MM-DDTHH:MM:SS.'),
128+
make_option('-e', '--end', action='store', dest='end_date', default=None, type='string',
129+
help='The end date for indexing within. Can be any dateutil-parsable string,'
130+
' recommended to be YYYY-MM-DDTHH:MM:SS.'),
131+
make_option('-b', '--batch-size', action='store', dest='batchsize', default=None, type='int',
132+
help='Number of items to index at once.'),
133+
make_option('-r', '--remove', action='store_true', dest='remove', default=False,
134+
help='Remove objects from the index that are no longer present in the database.'),
141135
make_option("-u", "--using", action="append", dest="using",
142-
default=[],
143-
help='Update only the named backend (can be used multiple times). '
144-
'By default all backends will be updated.'
145-
),
146-
make_option('-k', '--workers', action='store', dest='workers',
147-
default=0, type='int',
148-
help='Allows for the use multiple workers to parallelize indexing.'
149-
),
150-
make_option('--nocommit', action='store_false', dest='commit',
151-
default=True, help='Will pass commit=False to the backend.'
152-
),
136+
default=[],
137+
help='Update only the named backend (can be used multiple times). '
138+
'By default all backends will be updated.'),
139+
make_option('-k', '--workers', action='store', dest='workers', default=0, type='int',
140+
help='Allows for the use multiple workers to parallelize indexing.'),
141+
make_option('--nocommit', action='store_false', dest='commit', default=True,
142+
help='Will pass commit=False to the backend.'),
153143
make_option('-t', '--max-retries', action='store', dest='max_retries',
154-
default=DEFAULT_MAX_RETRIES, type='int',
144+
type='int',
145+
default=DEFAULT_MAX_RETRIES,
155146
help='Maximum number of attempts to write to the backend when an error occurs.'),
156147
)
157148
option_list = LabelCommand.option_list + base_options
@@ -248,7 +239,8 @@ def update_backend(self, label, using):
248239
end = min(start + batch_size, total)
249240

250241
if self.workers == 0:
251-
do_update(backend, index, qs, start, end, total, verbosity=self.verbosity, commit=self.commit, max_retries=self.max_retries)
242+
do_update(backend, index, qs, start, end, total, verbosity=self.verbosity,
243+
commit=self.commit, max_retries=self.max_retries)
252244
else:
253245
ghetto_queue.append((model, start, end, total, using, self.start_date, self.end_date,
254246
self.verbosity, self.commit, self.max_retries))
@@ -301,7 +293,8 @@ def update_backend(self, label, using):
301293
print(" removing %d stale records." % len(stale_records))
302294

303295
for rec_id in stale_records:
304-
# Since the PK was not in the database list, we'll delete the record from the search index:
296+
# Since the PK was not in the database list, we'll delete the record from the search
297+
# index:
305298
if self.verbosity >= 2:
306299
print(" removing %s." % rec_id)
307300

0 commit comments

Comments
 (0)