diff options
author | Maximilian Hils <git@maximilianhils.com> | 2017-05-26 16:14:20 +0200 |
---|---|---|
committer | Maximilian Hils <git@maximilianhils.com> | 2017-05-26 16:14:20 +0200 |
commit | eb5f37a7d19d74c88eed25d4b90f98bec1afa4be (patch) | |
tree | 9262e2549b8a3bd4cb2872041c8cc651d31c4d23 /pathod/language/websockets.py | |
parent | 9f58b190320515835af5e7ba75bd3b1fdd9445e0 (diff) | |
download | mitmproxy-eb5f37a7d19d74c88eed25d4b90f98bec1afa4be.tar.gz mitmproxy-eb5f37a7d19d74c88eed25d4b90f98bec1afa4be.tar.bz2 mitmproxy-eb5f37a7d19d74c88eed25d4b90f98bec1afa4be.zip |
fix mypy annotations
Diffstat (limited to 'pathod/language/websockets.py')
-rw-r--r-- | pathod/language/websockets.py | 24 |
1 files changed, 8 insertions, 16 deletions
diff --git a/pathod/language/websockets.py b/pathod/language/websockets.py index b4faf59b..68167964 100644 --- a/pathod/language/websockets.py +++ b/pathod/language/websockets.py @@ -1,10 +1,12 @@ import random import string +import typing # noqa + +import pyparsing as pp + import mitmproxy.net.websockets from mitmproxy.utils import strutils -import pyparsing as pp from . import base, generators, actions, message -import typing # noqa NESTED_LEADER = b"pathod!" @@ -74,7 +76,7 @@ class Times(base.Integer): preamble = "x" -COMPONENTS = ( +COMPONENTS = [ OpCode, Length, # Bit flags @@ -89,14 +91,13 @@ COMPONENTS = ( KeyNone, Key, Times, - Body, RawBody, -) +] class WebsocketFrame(message.Message): - components = COMPONENTS + components = COMPONENTS # type: typing.List[typing.Type[base._Component]] logattrs = ["body"] # Used for nested frames unique_name = "body" @@ -240,14 +241,5 @@ class NestedFrame(base.NestedMessage): nest_type = WebsocketFrame -COMP = typing.Tuple[ - typing.Type[OpCode], typing.Type[Length], typing.Type[Fin], typing.Type[RSV1], typing.Type[RSV2], typing.Type[RSV3], typing.Type[Mask], - typing.Type[actions.PauseAt], typing.Type[actions.DisconnectAt], typing.Type[actions.InjectAt], typing.Type[KeyNone], typing.Type[Key], - typing.Type[Times], typing.Type[Body], typing.Type[RawBody] -] - - class WebsocketClientFrame(WebsocketFrame): - components = typing.cast(COMP, COMPONENTS + ( - NestedFrame, - )) + components = COMPONENTS + [NestedFrame] |