From eb5f37a7d19d74c88eed25d4b90f98bec1afa4be Mon Sep 17 00:00:00 2001 From: Maximilian Hils Date: Fri, 26 May 2017 16:14:20 +0200 Subject: fix mypy annotations --- examples/simple/io_write_dumpfile.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'examples/simple/io_write_dumpfile.py') 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])] -- cgit v1.2.3