mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-25 09:37:37 +00:00
cleanup mypy usage
This commit is contained in:
parent
d17b9d6230
commit
ac22aee2f5
@ -1,20 +0,0 @@
|
||||
ignore-paths:
|
||||
- docs
|
||||
- examples
|
||||
- mitmproxy/contrib
|
||||
- web
|
||||
max-line-length: 140
|
||||
pylint:
|
||||
options:
|
||||
dummy-variables-rgx: _$|.+_$|dummy_.+
|
||||
disable:
|
||||
- missing-docstring
|
||||
- protected-access
|
||||
- too-few-public-methods
|
||||
- too-many-arguments
|
||||
- too-many-instance-attributes
|
||||
- too-many-locals
|
||||
- too-many-public-methods
|
||||
- too-many-return-statements
|
||||
- too-many-statements
|
||||
- unpacking-non-sequence
|
@ -24,4 +24,4 @@ def request(flow: http.HTTPFlow) -> None:
|
||||
return
|
||||
address = proxy_address(flow)
|
||||
if flow.live:
|
||||
flow.live.change_upstream_proxy_server(address)
|
||||
flow.live.change_upstream_proxy_server(address) # type: ignore
|
||||
|
@ -31,6 +31,7 @@ def request(flow: http.HTTPFlow) -> None:
|
||||
|
||||
|
||||
def response(flow: http.HTTPFlow) -> None:
|
||||
assert flow.response
|
||||
flow.response.headers.pop('Strict-Transport-Security', None)
|
||||
flow.response.headers.pop('Public-Key-Pins', None)
|
||||
|
||||
|
@ -395,8 +395,10 @@ def get_XSS_data(body: Union[str, bytes], request_URL: str, injection_point: str
|
||||
|
||||
# response is mitmproxy's entry point
|
||||
def response(flow: http.HTTPFlow) -> None:
|
||||
assert flow.response
|
||||
cookies_dict = get_cookies(flow)
|
||||
resp = flow.response.get_text(strict=False)
|
||||
assert resp
|
||||
# Example: http://xss.guru/unclaimedScriptTag.html
|
||||
find_unclaimed_URLs(resp, flow.request.url)
|
||||
results = test_end_of_URL_injection(resp, flow.request.url, cookies_dict)
|
||||
|
@ -190,7 +190,9 @@ class BuildEnviron:
|
||||
"""
|
||||
with open(pathlib.Path(self.root_dir) / "mitmproxy" / "version.py") as f:
|
||||
contents = f.read()
|
||||
version = re.search(r'^VERSION = "(.+?)"', contents, re.M).group(1)
|
||||
match = re.search(r'^VERSION = "(.+?)"', contents, re.M)
|
||||
assert match
|
||||
version = match.group(1)
|
||||
|
||||
if self.is_prod_release:
|
||||
# For production releases, we require strict version equality
|
||||
|
@ -19,12 +19,18 @@ exclude_lines =
|
||||
pragma: no cover
|
||||
raise NotImplementedError()
|
||||
|
||||
[mypy]
|
||||
ignore_missing_imports = True
|
||||
|
||||
[mypy-mitmproxy.contrib.*]
|
||||
ignore_errors = True
|
||||
|
||||
[mypy-tornado.*]
|
||||
ignore_errors = True
|
||||
|
||||
[mypy-test.*]
|
||||
ignore_errors = True
|
||||
|
||||
[tool:full_coverage]
|
||||
exclude =
|
||||
mitmproxy/proxy/protocol/base.py
|
||||
|
4
setup.py
4
setup.py
@ -13,7 +13,9 @@ with open(os.path.join(here, 'README.rst'), encoding='utf-8') as f:
|
||||
long_description = f.read()
|
||||
|
||||
with open(os.path.join(here, "mitmproxy", "version.py")) as f:
|
||||
VERSION = re.search(r'VERSION = "(.+?)"', f.read()).group(1)
|
||||
match = re.search(r'VERSION = "(.+?)"', f.read())
|
||||
assert match
|
||||
VERSION = match.group(1)
|
||||
|
||||
setup(
|
||||
name="mitmproxy",
|
||||
|
3
tox.ini
3
tox.ini
@ -31,8 +31,7 @@ commands =
|
||||
flake8 --jobs 8 mitmproxy pathod examples test release
|
||||
python ./test/filename_matching.py
|
||||
rstcheck README.rst
|
||||
mypy --ignore-missing-imports ./mitmproxy ./pathod
|
||||
mypy --ignore-missing-imports --follow-imports=skip ./examples/simple/ ./examples/pathod/ ./examples/complex/
|
||||
mypy .
|
||||
|
||||
[testenv:individual_coverage]
|
||||
deps =
|
||||
|
Loading…
Reference in New Issue
Block a user