diff --git a/.isort.cfg b/.isort.cfg index 4d4a6a509d..fd9c67a97c 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 a64cfa29f7..1a51179f8d 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 67525bebc7..f27178a3ff 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 515cff78dc..72ce56d26a 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 80dc492684..47f5b9e13e 100644 --- a/rest_framework/schemas/inspectors.py +++ b/rest_framework/schemas/inspectors.py @@ -260,7 +260,7 @@ def get_path_fields(self, path, method): # 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 bc38c0a343..a331339a6a 100644 --- a/rest_framework/templatetags/rest_framework.py +++ b/rest_framework/templatetags/rest_framework.py @@ -10,6 +10,7 @@ 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 7518d4ffd3..148a2c9c0d 100644 --- a/rest_framework/utils/encoders.py +++ b/rest_framework/utils/encoders.py @@ -61,7 +61,7 @@ def default(self, obj): 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 7f77407116..2ea3e5ac15 100644 --- a/rest_framework/validators.py +++ b/rest_framework/validators.py @@ -19,7 +19,6 @@ # 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 fff51fd8f9..072d3b2e43 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 b3e8b0f8bd..6ccbec882f 100644 --- a/tests/test_description.py +++ b/tests/test_description.py @@ -33,9 +33,9 @@ }] ```""" + # If markdown is installed we also test it's working # (and that our wrapped forces '=' to h2 and '-' to h3) - MARKED_DOWN_HILITE = """
[{
"alpha"