From d8621553b17c32a036eac3294a0e290adc633cc7 Mon Sep 17 00:00:00 2001 From: Maximilian Hils Date: Wed, 28 Jun 2017 17:26:45 +0200 Subject: [PATCH] suppress typing complaints in tests --- mitmproxy/proxy/protocol2/events.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/mitmproxy/proxy/protocol2/events.py b/mitmproxy/proxy/protocol2/events.py index daa5ad795..b36868146 100644 --- a/mitmproxy/proxy/protocol2/events.py +++ b/mitmproxy/proxy/protocol2/events.py @@ -58,10 +58,10 @@ class CommandReply(Event): Emitted when a command has been finished, e.g. when the master has replied or when we have established a server connection. """ - command: commands.Command + command: typing.Union[commands.Command, int] reply: typing.Any - def __init__(self, command: commands.Command, reply: typing.Any): + def __init__(self, command: typing.Union[commands.Command, int], reply: typing.Any): self.command = command self.reply = reply @@ -72,16 +72,20 @@ class CommandReply(Event): class OpenConnectionReply(CommandReply): - command: commands.OpenConnection + command: typing.Union[commands.OpenConnection, int] reply: str - def __init__(self, command: commands.OpenConnection, err: typing.Optional[str]): + def __init__( + self, + command: typing.Union[commands.OpenConnection, int], + err: typing.Optional[str] + ): super().__init__(command, err) class HookReply(CommandReply): - command: commands.Hook + command: typing.Union[commands.Hook, int] reply: typing.Any - def __init__(self, command: commands.Hook, reply: typing.Any): + def __init__(self, command: typing.Union[commands.Hook, int], reply: typing.Any): super().__init__(command, reply)