diff options
author | Maximilian Hils <git@maximilianhils.com> | 2017-05-27 01:55:43 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-05-27 01:55:43 +0200 |
commit | e7f7a608c6dda7cc22d2eda1129da99fd2830767 (patch) | |
tree | 4c6879f8dc964010750617c47eb7ee927c891b6b /examples/simple/io_write_dumpfile.py | |
parent | ef1c36194e0cb3ac82304eb95fb323d71ec5ebab (diff) | |
parent | e7990e0983344179e49a46f160e1482a0a0f6aa7 (diff) | |
download | mitmproxy-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.py | 10 |
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])] |