Skip to content

Commit 7be1b80

Browse files
authored
Merge pull request readthedocs#3551 from rtfd/humitos/lint/fix
Fix Travis lint issue
2 parents 0fb3574 + 590bc41 commit 7be1b80

File tree

15 files changed

+34
-38
lines changed

15 files changed

+34
-38
lines changed

prospector.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ pylint:
2525
max-line-length: 100
2626
disable:
2727
- logging-format-interpolation
28+
- inconsistent-return-statements
2829

2930
mccabe:
3031
run: false

readthedocs/api/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ def is_authenticated(self, request, **kwargs):
162162

163163

164164
class EnhancedModelResource(ModelResource):
165-
def obj_get_list(self, request=None, *_, **kwargs): # pylint: disable=arguments-differ
165+
def obj_get_list(self, request=None, *_, **kwargs): # noqa
166166
"""
167167
A ORM-specific implementation of ``obj_get_list``.
168168

readthedocs/builds/forms.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class Meta(object):
2020
'largest',
2121
)
2222

23-
def __init__(self, instance=None, *args, **kwargs):
23+
def __init__(self, instance=None, *args, **kwargs): # noqa
2424
super(AliasForm, self).__init__(instance=instance, *args, **kwargs)
2525
if instance:
2626
self.fields['project'].queryset = (Project.objects

readthedocs/core/management/commands/clean_builds.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def handle(self, *args, **options):
4444
version = Version.objects.get(id=build['version'])
4545
latest_build = version.builds.latest('date')
4646
if latest_build.date > max_date:
47-
log.warn('{0} is newer than {1}'.format(
47+
log.warning('{0} is newer than {1}'.format(
4848
latest_build, max_date))
4949
path = version.get_build_path()
5050
if path is not None:

readthedocs/core/views/serve.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,7 @@ def map_subproject_slug(view_func):
5757
.. warning:: Does not take into account any kind of privacy settings.
5858
"""
5959
@wraps(view_func)
60-
def inner_view(
61-
request, subproject=None, subproject_slug=None, *args, **kwargs):
60+
def inner_view(request, subproject=None, subproject_slug=None, *args, **kwargs): # noqa
6261
if subproject is None and subproject_slug:
6362
try:
6463
subproject = Project.objects.get(slug=subproject_slug)
@@ -86,7 +85,7 @@ def map_project_slug(view_func):
8685
.. warning:: Does not take into account any kind of privacy settings.
8786
"""
8887
@wraps(view_func)
89-
def inner_view(request, project=None, project_slug=None, *args, **kwargs):
88+
def inner_view(request, project=None, project_slug=None, *args, **kwargs): # noqa
9089
if project is None:
9190
if not project_slug:
9291
project_slug = request.slug

readthedocs/doc_builder/environments.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -382,10 +382,10 @@ def run_command_class(self, cls, cmd, **kwargs):
382382
msg += u':\n{out}'.format(out=build_cmd.output)
383383

384384
if warn_only:
385-
log.warn(LOG_TEMPLATE
386-
.format(project=self.project.slug,
387-
version=self.version.slug,
388-
msg=msg))
385+
log.warning(LOG_TEMPLATE
386+
.format(project=self.project.slug,
387+
version=self.version.slug,
388+
msg=msg))
389389
else:
390390
raise BuildEnvironmentWarning(msg)
391391
return build_cmd
@@ -561,12 +561,12 @@ def __enter__(self):
561561
self.build['state'] = BUILD_STATE_FINISHED
562562
raise exc
563563
else:
564-
log.warn(LOG_TEMPLATE
565-
.format(
566-
project=self.project.slug,
567-
version=self.version.slug,
568-
msg=("Removing stale container {0}"
569-
.format(self.container_id))))
564+
log.warning(LOG_TEMPLATE
565+
.format(
566+
project=self.project.slug,
567+
version=self.version.slug,
568+
msg=("Removing stale container {0}"
569+
.format(self.container_id))))
570570
client = self.get_client()
571571
client.remove_container(self.container_id)
572572
except (DockerAPIError, ConnectionError):

readthedocs/doc_builder/python_environments.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import logging
99
import os
1010
import shutil
11+
import six
1112
from builtins import object, open
1213

1314
from django.conf import settings
@@ -163,7 +164,7 @@ def save_environment_json(self):
163164
with open(self.environment_json_path(), 'w') as fpath:
164165
# Compatibility for Py2 and Py3. ``io.TextIOWrapper`` expects
165166
# unicode but ``json.dumps`` returns str in Py2.
166-
fpath.write(unicode(json.dumps(data)))
167+
fpath.write(six.text_type(json.dumps(data)))
167168

168169

169170
class Virtualenv(PythonEnvironment):

readthedocs/notifications/storages.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def _get(self, *args, **kwargs):
4848
safe_messages.append(message)
4949
return safe_messages, all_ret
5050

51-
def add(self, level, message, extra_tags='', *args, **kwargs):
51+
def add(self, level, message, extra_tags='', *args, **kwargs): # noqa
5252
user = kwargs.get('user') or self.request.user
5353
if not user.is_anonymous():
5454
persist_messages = (PersistentMessage.objects

readthedocs/oauth/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ def get_serialized(self, key=None, default=None):
162162
@property
163163
def clone_fuzzy_url(self):
164164
"""Try to match against several permutations of project URL."""
165-
return
165+
pass
166166

167167
def matches(self, user):
168168
"""Projects that exist with repository URL already."""

readthedocs/projects/models.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -786,7 +786,6 @@ def add_subproject(self, child, alias=None):
786786

787787
def remove_subproject(self, child):
788788
ProjectRelationship.objects.filter(parent=self, child=child).delete()
789-
return
790789

791790
def moderation_queue(self):
792791
# non-optimal SQL warning.

readthedocs/rtd_tests/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,4 +170,4 @@ def assertWizardFailure(self, response, field, match=None): # noqa
170170
self.assertIn(field, response.context_data['wizard']['form'].errors)
171171
if match is not None:
172172
error = response.context_data['wizard']['form'].errors[field]
173-
self.assertRegexpMatches(six.text_type(error), match)
173+
self.assertRegexpMatches(six.text_type(error), match) # noqa

readthedocs/search/utils.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -185,13 +185,13 @@ def parse_sphinx_sections(content):
185185
h1_title = h1_section.text().replace(u'¶', '').strip()
186186
h1_id = div.attr('id')
187187
h1_content = ""
188-
next_p = next(body('h1'))
188+
next_p = next(body('h1')) # pylint: disable=stop-iteration-return
189189
while next_p:
190190
if next_p[0].tag == 'div' and 'class' in next_p[0].attrib:
191191
if 'section' in next_p[0].attrib['class']:
192192
break
193193
h1_content += "\n%s\n" % next_p.html()
194-
next_p = next(next_p)
194+
next_p = next(next_p) # pylint: disable=stop-iteration-return
195195
if h1_content:
196196
yield {
197197
'id': h1_id,
@@ -228,14 +228,14 @@ def parse_mkdocs_sections(content):
228228
h1_id = h1.attr('id')
229229
h1_title = h1.text().strip()
230230
h1_content = ""
231-
next_p = next(body('h1'))
231+
next_p = next(body('h1')) # pylint: disable=stop-iteration-return
232232
while next_p:
233233
if next_p[0].tag == 'h2':
234234
break
235235
h1_html = next_p.html()
236236
if h1_html:
237237
h1_content += "\n%s\n" % h1_html
238-
next_p = next(next_p)
238+
next_p = next(next_p) # pylint: disable=stop-iteration-return
239239
if h1_content:
240240
yield {
241241
'id': h1_id,
@@ -250,14 +250,14 @@ def parse_mkdocs_sections(content):
250250
h2_title = h2.text().strip()
251251
section_id = h2.attr('id')
252252
h2_content = ""
253-
next_p = next(body('h2'))
253+
next_p = next(body('h2')) # pylint: disable=stop-iteration-return
254254
while next_p:
255255
if next_p[0].tag == 'h2':
256256
break
257257
h2_html = next_p.html()
258258
if h2_html:
259259
h2_content += "\n%s\n" % h2_html
260-
next_p = next(next_p)
260+
next_p = next(next_p) # pylint: disable=stop-iteration-return
261261
if h2_content:
262262
yield {
263263
'id': section_id,

readthedocs/vcs_support/utils.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,11 @@ def __enter__(self):
8888
self.name)
8989
os.remove(self.fpath)
9090
else:
91-
raise LockTimeout("Lock (%s): Lock still active", self.name)
91+
raise LockTimeout(
92+
"Lock ({}): Lock still active".format(self.name))
9293
elif path_exists:
93-
raise LockTimeout("Lock (%s): Lock still active", self.name)
94+
raise LockTimeout(
95+
"Lock ({}): Lock still active".format(self.name))
9496
open(self.fpath, 'w').close()
9597
return self
9698

requirements/lint.txt

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,7 @@
11
-r pip.txt
22
maxcdn
33
astroid
4-
5-
# pylint 1.8.0 is having problems:
6-
# File "/home/humitos/.pyenv/versions/2.7.14/envs/pylint/lib/python2.7/site-packages/pylint_django/plugin.py", line 22, in register
7-
# start = name_checker.config.const_rgx.pattern[:-2]
8-
# AttributeError: 'NoneType' object has no attribute 'pattern
9-
pylint==1.7.5
10-
4+
pylint
115
prospector
126
pylint-django
137
pyflakes

requirements/testing.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
-r pip.txt
22

3-
pytest<4,>=3.3.0
3+
pytest<4,>=3.3.2
44
pytest-django==3.1.2
5-
pytest-xdist==1.20.1
5+
pytest-xdist==1.22.0
66
apipkg==1.4
77
execnet==1.5.0
88
Mercurial==4.4.2

0 commit comments

Comments
 (0)