From 20372b5b0bc5544714d58bf6e4a59bf6fd2f962f Mon Sep 17 00:00:00 2001 From: Maximilian Hils Date: Wed, 13 Dec 2017 16:11:15 +0100 Subject: 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. --- mitmproxy/utils/typecheck.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mitmproxy/utils') 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 -- cgit v1.2.3