Skip to content

Commit 85c69ce

Browse files
Resolve linting messages in readthedocs.search.*
1 parent 94ff257 commit 85c69ce

File tree

4 files changed

+21
-10
lines changed

4 files changed

+21
-10
lines changed

readthedocs/search/indexes.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -169,13 +169,13 @@ def get_mapping(self):
169169
"""
170170
Returns the mapping for this _index and _type.
171171
"""
172-
raise NotImplemented
172+
raise NotImplementedError()
173173

174-
def extract_document(self, pk, obj):
174+
def extract_document(self, data):
175175
"""
176176
Extracts the Elasticsearch document for this object instance.
177177
"""
178-
raise NotImplemented
178+
raise NotImplementedError()
179179

180180
def update_aliases(self, new_index, delete=True):
181181
"""
@@ -295,7 +295,8 @@ def get_mapping(self):
295295
def extract_document(self, data):
296296
doc = {}
297297

298-
attrs = ('id', 'project', 'title', 'headers', 'version', 'path', 'content', 'taxonomy', 'commit')
298+
attrs = ('id', 'project', 'title', 'headers', 'version', 'path',
299+
'content', 'taxonomy', 'commit')
299300
for attr in attrs:
300301
doc[attr] = data.get(attr, '')
301302

readthedocs/search/parse_json.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ def process_all_json_files(version, build_dir=True):
1818
if build_dir:
1919
full_path = version.project.full_json_path(version.slug)
2020
else:
21-
full_path = version.project.get_production_media_path(type='json', version_slug=version.slug, include_file=False)
21+
full_path = version.project.get_production_media_path(
22+
type='json', version_slug=version.slug, include_file=False)
2223
html_files = []
2324
for root, dirs, files in os.walk(full_path):
2425
for filename in fnmatch.filter(files, '*.fjson'):
@@ -110,6 +111,7 @@ def process_file(filename):
110111
return {'headers': headers, 'content': body_content, 'path': path,
111112
'title': title, 'sections': sections}
112113

114+
113115
def recurse_while_none(element):
114116
if element.text is None:
115117
return recurse_while_none(element.getchildren()[0])

readthedocs/search/utils.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ def process_mkdocs_json(version, build_dir=True):
1616
if build_dir:
1717
full_path = version.project.full_json_path(version.slug)
1818
else:
19-
full_path = version.project.get_production_media_path(type='json', version_slug=version.slug, include_file=False)
19+
full_path = version.project.get_production_media_path(
20+
type='json', version_slug=version.slug, include_file=False)
2021

2122
html_files = []
2223
for root, dirs, files in os.walk(full_path):
@@ -32,9 +33,13 @@ def process_mkdocs_json(version, build_dir=True):
3233
title = sections[0]['title']
3334
except IndexError:
3435
title = relative_path
35-
page_list.append(
36-
{'content': html, 'path': relative_path, 'title': title, 'headers': headers, 'sections': sections}
37-
)
36+
page_list.append({
37+
'content': html,
38+
'path': relative_path,
39+
'title': title,
40+
'headers': headers,
41+
'sections': sections,
42+
})
3843
return page_list
3944

4045

readthedocs/search/views.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
log = logging.getLogger(__name__)
3131
LOG_TEMPLATE = u"(Elastic Search) [{user}:{type}] [{project}:{version}:{language}] {msg}"
3232

33+
3334
def elastic_search(request):
3435
"""
3536
Use elastic search for global search
@@ -50,7 +51,9 @@ def elastic_search(request):
5051
if type == 'project':
5152
results = search_lib.search_project(request, query, language=language)
5253
elif type == 'file':
53-
results = search_lib.search_file(request, query, project=project, version=version, taxonomy=taxonomy)
54+
results = search_lib.search_file(request, query, project=project,
55+
version=version,
56+
taxonomy=taxonomy)
5457

5558
if results:
5659
# pre and post 1.0 compat

0 commit comments

Comments
 (0)