Re-order imports etc.
This commit is contained in:
parent
21e6ecb47d
commit
821413349e
|
@ -30,8 +30,10 @@ from PIL import ExifTags
|
|||
from PIL import Image
|
||||
from six import BytesIO
|
||||
|
||||
from mitmproxy import exceptions
|
||||
import cssutils
|
||||
import jsbeautifier
|
||||
|
||||
from mitmproxy import exceptions
|
||||
from mitmproxy.contrib.wbxml import ASCommandResponse
|
||||
from netlib import http
|
||||
from netlib import multidict
|
||||
|
@ -44,17 +46,6 @@ try:
|
|||
except ImportError: # pragma no cover
|
||||
pyamf = None
|
||||
|
||||
try:
|
||||
import cssutils
|
||||
except ImportError: # pragma no cover
|
||||
cssutils = None
|
||||
else:
|
||||
cssutils.log.setLevel(logging.CRITICAL)
|
||||
|
||||
cssutils.ser.prefs.keepComments = True
|
||||
cssutils.ser.prefs.omitLastSemicolon = False
|
||||
cssutils.ser.prefs.indentClosingBrace = False
|
||||
cssutils.ser.prefs.validOnly = False
|
||||
|
||||
# Default view cutoff *in lines*
|
||||
VIEW_CUTOFF = 512
|
||||
|
@ -410,11 +401,14 @@ class ViewCSS(View):
|
|||
]
|
||||
|
||||
def __call__(self, data, **metadata):
|
||||
if cssutils:
|
||||
sheet = cssutils.parseString(data)
|
||||
beautified = sheet.cssText
|
||||
else:
|
||||
beautified = data
|
||||
cssutils.log.setLevel(logging.CRITICAL)
|
||||
cssutils.ser.prefs.keepComments = True
|
||||
cssutils.ser.prefs.omitLastSemicolon = False
|
||||
cssutils.ser.prefs.indentClosingBrace = False
|
||||
cssutils.ser.prefs.validOnly = False
|
||||
|
||||
sheet = cssutils.parseString(data)
|
||||
beautified = sheet.cssText
|
||||
|
||||
return "CSS", format_text(beautified)
|
||||
|
||||
|
|
Loading…
Reference in New Issue