aboutsummaryrefslogtreecommitdiffstats
path: root/examples/simple/io_write_dumpfile.py
diff options
context:
space:
mode:
authorMaximilian Hils <git@maximilianhils.com>2017-05-27 01:55:43 +0200
committerGitHub <noreply@github.com>2017-05-27 01:55:43 +0200
commite7f7a608c6dda7cc22d2eda1129da99fd2830767 (patch)
tree4c6879f8dc964010750617c47eb7ee927c891b6b /examples/simple/io_write_dumpfile.py
parentef1c36194e0cb3ac82304eb95fb323d71ec5ebab (diff)
parente7990e0983344179e49a46f160e1482a0a0f6aa7 (diff)
downloadmitmproxy-e7f7a608c6dda7cc22d2eda1129da99fd2830767.tar.gz
mitmproxy-e7f7a608c6dda7cc22d2eda1129da99fd2830767.tar.bz2
mitmproxy-e7f7a608c6dda7cc22d2eda1129da99fd2830767.zip
Merge pull request #2358 from mhils/make-mypy-great-again
Fix mypy annotations, update mypy
Diffstat (limited to 'examples/simple/io_write_dumpfile.py')
-rw-r--r--examples/simple/io_write_dumpfile.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/examples/simple/io_write_dumpfile.py b/examples/simple/io_write_dumpfile.py
index cf7c4f52..be6e4121 100644
--- a/examples/simple/io_write_dumpfile.py
+++ b/examples/simple/io_write_dumpfile.py
@@ -13,15 +13,15 @@ import typing # noqa
class Writer:
def __init__(self, path: str) -> None:
- if path == "-":
- f = sys.stdout # type: typing.IO[typing.Any]
- else:
- f = open(path, "wb")
- self.w = io.FlowWriter(f)
+ self.f = open(path, "wb") # type: typing.IO[bytes]
+ self.w = io.FlowWriter(self.f)
def response(self, flow: http.HTTPFlow) -> None:
if random.choice([True, False]):
self.w.add(flow)
+ def done(self):
+ self.f.close()
+
addons = [Writer(sys.argv[1])]