Skip to content

Commit 2bf1ca4

Browse files
committed
chore: Fix typo/formatting
1 parent 394970a commit 2bf1ca4

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

src/models.py

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,28 +12,31 @@ class AlgoliaIndexError(Exception):
1212
class AlgoliaIndex(object):
1313
'''An index in the Algolia backend.'''
1414

15-
# Use to specify a custom field that will be used for the objectID.
15+
# Used to specify a custom field that will be used for the objectID.
1616
# This field should be unique.
1717
custom_objectID = None
1818

19-
# Use to specify the fields that should be included in the index.
19+
# Used to specify the fields that should be included in the index.
2020
fields = ()
2121

22-
# Use to specify the geo-fields that should be used for location search.
22+
# Used to specify the geo-fields that should be used for location search.
2323
# The attribute should be a callable that returns a tuple.
2424
geo_field = None
2525

26-
# Use to specify the field that should be used for filtering by tag.
26+
# Used to specify the field that should be used for filtering by tag.
2727
tags = None
2828

29-
# Use to specify the index to target on Algolia.
29+
# Used to specify the index to target on Algolia.
3030
index_name = None
3131

32-
# Use to specify the settings of the index.
32+
# Used to specify the settings of the index.
3333
settings = {}
3434

35-
# Use to specify a callable that say if the instance should be indexed.
36-
# The attribute should be a callable that returns a boolean.
35+
# Used to specify if the instance should be indexed.
36+
# The attribute should be either:
37+
# - a callable that returns a boolean.
38+
# - a BooleanField
39+
# - a boolean property or attribute
3740
should_index = None
3841

3942
# Instance of the index from algoliasearch client
@@ -52,7 +55,7 @@ def __init__(self, model, client):
5255

5356
# Avoid error when there is only one field to index
5457
if isinstance(self.fields, str):
55-
self.fields = (self.fields, )
58+
self.fields = (self.fields,)
5659

5760
# Check fields
5861
for field in self.fields:
@@ -63,7 +66,7 @@ def __init__(self, model, client):
6366
# Check custom_objectID
6467
if self.custom_objectID:
6568
if not (hasattr(model, self.custom_objectID) or
66-
(self.custom_objectID in all_fields)):
69+
(self.custom_objectID in all_fields)):
6770
raise AlgoliaIndexError('{} is not an attribute of {}.'.format(
6871
self.custom_objectID, model))
6972

0 commit comments

Comments
 (0)