mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-21 22:58:24 +00:00
don't use #noqa for imports
This commit is contained in:
parent
f0da667516
commit
beb49ab121
@ -5,7 +5,6 @@ import textwrap
|
||||
from pathlib import Path
|
||||
from typing import List, Type
|
||||
|
||||
import mitmproxy.addons.next_layer # noqa
|
||||
from mitmproxy import hooks, log, addonmanager
|
||||
from mitmproxy.proxy import server_hooks, layer
|
||||
from mitmproxy.proxy.layers import http, modes, tcp, tls, websocket
|
||||
|
@ -10,7 +10,7 @@ to multiple files in parallel.
|
||||
import random
|
||||
import sys
|
||||
from mitmproxy import io, http
|
||||
import typing # noqa
|
||||
import typing
|
||||
|
||||
|
||||
class Writer:
|
||||
|
@ -13,7 +13,7 @@ import json
|
||||
import base64
|
||||
import zlib
|
||||
import os
|
||||
import typing # noqa
|
||||
import typing
|
||||
|
||||
from datetime import datetime
|
||||
from datetime import timezone
|
||||
|
@ -4,7 +4,7 @@ https://moxie.org/software/sslstrip/
|
||||
"""
|
||||
import re
|
||||
import urllib.parse
|
||||
import typing # noqa
|
||||
import typing
|
||||
|
||||
from mitmproxy import http
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
import collections
|
||||
import typing # noqa
|
||||
import typing
|
||||
|
||||
import blinker
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
import collections
|
||||
from http import cookiejar
|
||||
from typing import List, Tuple, Dict, Optional # noqa
|
||||
from typing import List, Tuple, Dict, Optional
|
||||
|
||||
from mitmproxy import http, flowfilter, ctx, exceptions
|
||||
from mitmproxy.net.http import cookies
|
||||
|
@ -1,5 +1,3 @@
|
||||
from typing import List # noqa
|
||||
|
||||
from mitmproxy.utils import strutils
|
||||
from . import base
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
import asyncio
|
||||
import time
|
||||
import typing # noqa
|
||||
import typing
|
||||
import uuid
|
||||
|
||||
from mitmproxy import connection
|
||||
|
@ -6,7 +6,7 @@ v3.0.0dev) and versioning. Every change or migration gets a new flow file
|
||||
version number, this prevents issues with developer builds and snapshots.
|
||||
"""
|
||||
import uuid
|
||||
from typing import Any, Dict, Mapping, Union # noqa
|
||||
from typing import Any, Dict, Mapping, Union
|
||||
|
||||
from mitmproxy import version
|
||||
from mitmproxy.utils import strutils
|
||||
|
@ -4,15 +4,14 @@ Utility functions for decoding response bodies.
|
||||
|
||||
import codecs
|
||||
import collections
|
||||
from io import BytesIO
|
||||
|
||||
import gzip
|
||||
import zlib
|
||||
from io import BytesIO
|
||||
from typing import Union, overload
|
||||
|
||||
import brotli
|
||||
import zstandard as zstd
|
||||
|
||||
from typing import Union, Optional, AnyStr, overload # noqa
|
||||
|
||||
# We have a shared single-element cache for encoding and decoding.
|
||||
# This is quite useful in practice, e.g.
|
||||
# flow.request.content = flow.request.content.replace(b"foo", b"bar")
|
||||
@ -39,7 +38,7 @@ def decode(encoded: bytes, encoding: str, errors: str = 'strict') -> Union[str,
|
||||
|
||||
|
||||
def decode(
|
||||
encoded: Union[None, str, bytes], encoding: str, errors: str = 'strict'
|
||||
encoded: Union[None, str, bytes], encoding: str, errors: str = 'strict'
|
||||
) -> Union[None, str, bytes]:
|
||||
"""
|
||||
Decode the given input object
|
||||
@ -56,10 +55,10 @@ def decode(
|
||||
|
||||
global _cache
|
||||
cached = (
|
||||
isinstance(encoded, bytes) and
|
||||
_cache.encoded == encoded and
|
||||
_cache.encoding == encoding and
|
||||
_cache.errors == errors
|
||||
isinstance(encoded, bytes) and
|
||||
_cache.encoded == encoded and
|
||||
_cache.encoding == encoding and
|
||||
_cache.errors == errors
|
||||
)
|
||||
if cached:
|
||||
return _cache.decoded
|
||||
@ -113,10 +112,10 @@ def encode(decoded: Union[None, str, bytes], encoding, errors='strict') -> Union
|
||||
|
||||
global _cache
|
||||
cached = (
|
||||
isinstance(decoded, bytes) and
|
||||
_cache.decoded == decoded and
|
||||
_cache.encoding == encoding and
|
||||
_cache.errors == errors
|
||||
isinstance(decoded, bytes) and
|
||||
_cache.decoded == decoded and
|
||||
_cache.encoding == encoding and
|
||||
_cache.errors == errors
|
||||
)
|
||||
if cached:
|
||||
return _cache.encoded
|
||||
|
@ -2,7 +2,7 @@ import urwid
|
||||
|
||||
from mitmproxy.tools.console import common
|
||||
from mitmproxy.tools.console import layoutwidget
|
||||
import mitmproxy.tools.console.master # noqa
|
||||
import mitmproxy.tools.console.master
|
||||
|
||||
|
||||
class FlowItem(urwid.WidgetWrap):
|
||||
|
@ -1,11 +1,11 @@
|
||||
import math
|
||||
import sys
|
||||
from functools import lru_cache
|
||||
from typing import Optional, Union # noqa
|
||||
|
||||
import urwid
|
||||
|
||||
import mitmproxy.flow
|
||||
import mitmproxy.tools.console.master # noqa
|
||||
import urwid
|
||||
import mitmproxy.tools.console.master
|
||||
from mitmproxy import contentviews
|
||||
from mitmproxy import ctx
|
||||
from mitmproxy import http
|
||||
|
@ -1,2 +1,21 @@
|
||||
from .editors import * # noqa
|
||||
from . import base # noqa
|
||||
from . import base
|
||||
from .editors import CookieAttributeEditor, CookieEditor, DataViewer, OptionsEditor, PathEditor, QueryEditor, \
|
||||
RequestHeaderEditor, \
|
||||
RequestMultipartEditor, \
|
||||
RequestUrlEncodedEditor, \
|
||||
ResponseHeaderEditor, SetCookieEditor
|
||||
|
||||
__all__ = [
|
||||
"base",
|
||||
"QueryEditor",
|
||||
"RequestHeaderEditor",
|
||||
"ResponseHeaderEditor",
|
||||
"RequestMultipartEditor",
|
||||
"RequestUrlEncodedEditor",
|
||||
"PathEditor",
|
||||
"CookieEditor",
|
||||
"CookieAttributeEditor",
|
||||
"SetCookieEditor",
|
||||
"OptionsEditor",
|
||||
"DataViewer",
|
||||
]
|
||||
|
@ -8,7 +8,7 @@ from mitmproxy.utils import strutils
|
||||
from mitmproxy import exceptions
|
||||
from mitmproxy.tools.console import signals
|
||||
from mitmproxy.tools.console import layoutwidget
|
||||
import mitmproxy.tools.console.master # noqa
|
||||
import mitmproxy.tools.console.master
|
||||
|
||||
|
||||
def read_file(filename: str, escaped: bool) -> typing.AnyStr:
|
||||
|
@ -1,4 +1,4 @@
|
||||
import typing # noqa
|
||||
import typing
|
||||
# Low-color themes should ONLY use the standard foreground and background
|
||||
# colours listed here:
|
||||
#
|
||||
|
@ -3,7 +3,7 @@ from typing import Optional
|
||||
|
||||
import urwid
|
||||
|
||||
import mitmproxy.tools.console.master # noqa
|
||||
import mitmproxy.tools.console.master
|
||||
from mitmproxy.tools.console import commandexecutor
|
||||
from mitmproxy.tools.console import common
|
||||
from mitmproxy.tools.console import signals
|
||||
|
Loading…
Reference in New Issue
Block a user