diff options
author | Maximilian Hils <git@maximilianhils.com> | 2016-11-16 17:19:38 +0100 |
---|---|---|
committer | Maximilian Hils <git@maximilianhils.com> | 2016-11-16 17:19:38 +0100 |
commit | 2ee8bc2f1a368681c533b6c5b957446d2744a7d8 (patch) | |
tree | cb148cf519bd73f3bd24ef0b949aa53bc1df63ba | |
parent | de6bf175e212e4c386ebb45d5744dbf9210af690 (diff) | |
download | mitmproxy-2ee8bc2f1a368681c533b6c5b957446d2744a7d8.tar.gz mitmproxy-2ee8bc2f1a368681c533b6c5b957446d2744a7d8.tar.bz2 mitmproxy-2ee8bc2f1a368681c533b6c5b957446d2744a7d8.zip |
fix type checks
-rw-r--r-- | mitmproxy/utils/typecheck.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/mitmproxy/utils/typecheck.py b/mitmproxy/utils/typecheck.py index ce57cff1..c68357b7 100644 --- a/mitmproxy/utils/typecheck.py +++ b/mitmproxy/utils/typecheck.py @@ -10,7 +10,7 @@ def check_type(attr_name: str, value: typing.Any, typeinfo: type) -> None: - Union - Tuple - - TextIO + - IO """ # If we realize that we need to extend this list substantially, it may make sense # to use typeguard for this, but right now it's not worth the hassle for 16 lines of code. @@ -37,7 +37,7 @@ def check_type(attr_name: str, value: typing.Any, typeinfo: type) -> None: for i, (x, T) in enumerate(zip(value, typeinfo.__tuple_params__)): check_type("{}[{}]".format(attr_name, i), x, T) return - if typeinfo == typing.TextIO: + if issubclass(typeinfo, typing.IO): if hasattr(value, "read"): return |