diff options
author | Maximilian Hils <git@maximilianhils.com> | 2017-12-13 16:11:15 +0100 |
---|---|---|
committer | Maximilian Hils <git@maximilianhils.com> | 2017-12-14 14:15:36 +0100 |
commit | 20372b5b0bc5544714d58bf6e4a59bf6fd2f962f (patch) | |
tree | ac3b550fb68512c50a32bb7d9dd18c45bf65aed3 /mitmproxy/utils | |
parent | 62561ed428caca2fffaa96c8d0765a6a7bba4d00 (diff) | |
download | mitmproxy-20372b5b0bc5544714d58bf6e4a59bf6fd2f962f.tar.gz mitmproxy-20372b5b0bc5544714d58bf6e4a59bf6fd2f962f.tar.bz2 mitmproxy-20372b5b0bc5544714d58bf6e4a59bf6fd2f962f.zip |
introduce @command.argument
This makes it possible to specify more specific type annotations at runtime,
so that both mypy and our command system are happy. The .argument(name, type=)
syntax is similar to click's, so it should be fairly extensible if we need it.
Diffstat (limited to 'mitmproxy/utils')
-rw-r--r-- | mitmproxy/utils/typecheck.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/mitmproxy/utils/typecheck.py b/mitmproxy/utils/typecheck.py index c5e289a4..87a0e804 100644 --- a/mitmproxy/utils/typecheck.py +++ b/mitmproxy/utils/typecheck.py @@ -31,7 +31,7 @@ def check_command_type(value: typing.Any, typeinfo: typing.Any) -> bool: return False elif value is None and typeinfo is None: return True - elif (not isinstance(typeinfo, type)) or (not isinstance(value, typeinfo)): + elif not isinstance(value, typeinfo): return False return True |