replace except: pass with suppress() context manager

This commit is contained in:
Laura Klünder 2017-05-31 02:38:59 +02:00
parent 23694b207b
commit 341c2f98e5
5 changed files with 12 additions and 22 deletions

View file

@ -1,3 +1,5 @@
from contextlib import suppress
from django.conf import settings
from django.conf.urls import include, url
from django.contrib import admin
@ -15,8 +17,6 @@ urlpatterns = [
]
if settings.DEBUG:
try:
with suppress(ImportError):
import debug_toolbar
urlpatterns.insert(0, url(r'^__debug__/', include(debug_toolbar.urls)))
except ImportError:
pass