diff options
Diffstat (limited to 'mitmproxy/contentviews.py')
-rw-r--r-- | mitmproxy/contentviews.py | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/mitmproxy/contentviews.py b/mitmproxy/contentviews.py index 83e6a7ad..ed6acfc1 100644 --- a/mitmproxy/contentviews.py +++ b/mitmproxy/contentviews.py @@ -14,16 +14,18 @@ requests, the query parameters are passed as the ``query`` keyword argument. """ from __future__ import absolute_import, print_function, division -import cssutils import datetime -import html2text -import jsbeautifier import json import logging -import lxml.etree -import lxml.html import subprocess import traceback +from typing import Mapping, Union, Generator, Tuple + +import cssutils +import html2text +import jsbeautifier +import lxml.etree +import lxml.html from PIL import ExifTags from PIL import Image from mitmproxy import exceptions @@ -33,7 +35,6 @@ from netlib import multidict from netlib import strutils from netlib.http import url from six import BytesIO -from typing import Mapping # noqa try: import pyamf @@ -48,8 +49,7 @@ VIEW_CUTOFF = 512 KEY_MAX = 30 -def pretty_json(s): - # type: (bytes) -> bytes +def pretty_json(s: bytes) -> bytes: try: p = json.loads(s.decode('utf-8')) except ValueError: @@ -63,8 +63,9 @@ def pretty_json(s): return pretty -def format_dict(d): - # type: (Mapping[Union[str,bytes], Union[str,bytes]]) -> Generator[Tuple[Union[str,bytes], Union[str,bytes]]] +def format_dict( + d: Mapping[Union[str, bytes], Union[str, bytes]] +) -> Generator[Tuple[Union[str, bytes], Union[str, bytes]], None, None]: """ Helper function that transforms the given dictionary into a list of ("key", key ) @@ -97,7 +98,7 @@ class View(object): def __call__( self, - data, # type: bytes + data: bytes, **metadata ): """ |