diff --git a/.isort.cfg b/.isort.cfg index 4d4a6a509..fd9c67a97 100644 --- a/.isort.cfg +++ b/.isort.cfg @@ -3,5 +3,5 @@ skip=.tox atomic=true multi_line_output=5 known_standard_library=types -known_third_party=pytest,django +known_third_party=pytest,_pytest,django known_first_party=rest_framework diff --git a/requirements/requirements-codestyle.txt b/requirements/requirements-codestyle.txt index a64cfa29f..1a51179f8 100644 --- a/requirements/requirements-codestyle.txt +++ b/requirements/requirements-codestyle.txt @@ -1,7 +1,7 @@ # PEP8 code linting, which we run on all commits. -flake8==3.4.1 +flake8==3.5.0 flake8-tidy-imports==1.1.0 -pep8==1.7.0 +pycodestyle==2.3.1 # Sort and lint imports -isort==4.2.5 +isort==4.2.15 diff --git a/requirements/requirements-optionals.txt b/requirements/requirements-optionals.txt index 67525bebc..f27178a3f 100644 --- a/requirements/requirements-optionals.txt +++ b/requirements/requirements-optionals.txt @@ -2,6 +2,6 @@ pytz==2017.2 markdown==2.6.4 django-guardian==1.4.9 -django-filter==1.0.4 +django-filter==1.1.0 coreapi==2.3.1 coreschema==0.0.4 diff --git a/requirements/requirements-testing.txt b/requirements/requirements-testing.txt index 515cff78d..72ce56d26 100644 --- a/requirements/requirements-testing.txt +++ b/requirements/requirements-testing.txt @@ -1,4 +1,4 @@ # PyTest for running the tests. -pytest==3.2.2 +pytest==3.2.5 pytest-django==3.1.2 pytest-cov==2.5.1 diff --git a/rest_framework/schemas/inspectors.py b/rest_framework/schemas/inspectors.py index 80dc49268..47f5b9e13 100644 --- a/rest_framework/schemas/inspectors.py +++ b/rest_framework/schemas/inspectors.py @@ -260,7 +260,7 @@ class AutoSchema(ViewInspector): # Attempt to infer a field description if possible. try: model_field = model._meta.get_field(variable) - except: + except Exception: model_field = None if model_field is not None and model_field.verbose_name: diff --git a/rest_framework/templatetags/rest_framework.py b/rest_framework/templatetags/rest_framework.py index bc38c0a34..a331339a6 100644 --- a/rest_framework/templatetags/rest_framework.py +++ b/rest_framework/templatetags/rest_framework.py @@ -10,6 +10,7 @@ from django.utils import six from django.utils.encoding import force_text, iri_to_uri from django.utils.html import escape, format_html, smart_urlquote from django.utils.safestring import SafeData, mark_safe + from rest_framework.compat import apply_markdown, pygments_highlight from rest_framework.renderers import HTMLFormRenderer from rest_framework.utils.urls import replace_query_param diff --git a/rest_framework/utils/encoders.py b/rest_framework/utils/encoders.py index 7518d4ffd..148a2c9c0 100644 --- a/rest_framework/utils/encoders.py +++ b/rest_framework/utils/encoders.py @@ -61,7 +61,7 @@ class JSONEncoder(json.JSONEncoder): elif hasattr(obj, '__getitem__'): try: return dict(obj) - except: + except Exception: pass elif hasattr(obj, '__iter__'): return tuple(item for item in obj) diff --git a/rest_framework/validators.py b/rest_framework/validators.py index 7f7740711..2ea3e5ac1 100644 --- a/rest_framework/validators.py +++ b/rest_framework/validators.py @@ -19,7 +19,6 @@ from rest_framework.utils.representation import smart_repr # Robust filter and exist implementations. Ensures that queryset.exists() for # an invalid value returns `False`, rather than raising an error. # Refs https://github.com/encode/django-rest-framework/issues/3381 - def qs_exists(queryset): try: return queryset.exists() diff --git a/tests/importable/test_installed.py b/tests/importable/test_installed.py index fff51fd8f..072d3b2e4 100644 --- a/tests/importable/test_installed.py +++ b/tests/importable/test_installed.py @@ -1,4 +1,5 @@ from django.conf import settings + from tests import importable diff --git a/tests/test_description.py b/tests/test_description.py index b3e8b0f8b..6ccbec882 100644 --- a/tests/test_description.py +++ b/tests/test_description.py @@ -33,9 +33,9 @@ indented }] ```""" + # If markdown is installed we also test it's working # (and that our wrapped forces '=' to h2 and '-' to h3) - MARKED_DOWN_HILITE = """
[{
"alpha"