diff options
Diffstat (limited to 'pathod/language')
-rw-r--r-- | pathod/language/base.py | 8 | ||||
-rw-r--r-- | pathod/language/message.py | 4 | ||||
-rw-r--r-- | pathod/language/websockets.py | 6 |
3 files changed, 9 insertions, 9 deletions
diff --git a/pathod/language/base.py b/pathod/language/base.py index 97871e7e..32cddca6 100644 --- a/pathod/language/base.py +++ b/pathod/language/base.py @@ -334,7 +334,7 @@ class OptionsOrValue(_Component): Can be any of a specified set of options, or a value specifier. """ preamble = "" - options = [] # type: typing.List[str] + options: typing.List[str] = [] def __init__(self, value): # If it's a string, we were passed one of the options, so we lower-case @@ -376,7 +376,7 @@ class OptionsOrValue(_Component): class Integer(_Component): - bounds = (None, None) # type: typing.Tuple[typing.Optional[int], typing.Optional[int]] + bounds: typing.Tuple[typing.Optional[int], typing.Optional[int]] = (None, None) preamble = "" def __init__(self, value): @@ -442,7 +442,7 @@ class FixedLengthValue(Value): A value component lead by an optional preamble. """ preamble = "" - length = None # type: typing.Optional[int] + length: typing.Optional[int] = None def __init__(self, value): Value.__init__(self, value) @@ -511,7 +511,7 @@ class IntField(_Component): """ An integer field, where values can optionally specified by name. """ - names = {} # type: typing.Dict[str, int] + names: typing.Dict[str, int] = {} max = 16 preamble = "" diff --git a/pathod/language/message.py b/pathod/language/message.py index 5dda654b..566bce60 100644 --- a/pathod/language/message.py +++ b/pathod/language/message.py @@ -11,7 +11,7 @@ LOG_TRUNCATE = 1024 class Message: __metaclass__ = abc.ABCMeta - logattrs = [] # type: typing.List[str] + logattrs: typing.List[str] = [] def __init__(self, tokens): track = set([]) @@ -106,7 +106,7 @@ class NestedMessage(base.Token): A nested message, as an escaped string with a preamble. """ preamble = "" - nest_type = None # type: typing.Optional[typing.Type[Message]] + nest_type: typing.Optional[typing.Type[Message]] = None def __init__(self, value): super().__init__() diff --git a/pathod/language/websockets.py b/pathod/language/websockets.py index cc00bcf1..34b4a307 100644 --- a/pathod/language/websockets.py +++ b/pathod/language/websockets.py @@ -16,14 +16,14 @@ class WF(base.CaselessLiteral): class OpCode(base.IntField): - names = { + names: typing.Dict[str, int] = { "continue": mitmproxy.net.websockets.OPCODE.CONTINUE, "text": mitmproxy.net.websockets.OPCODE.TEXT, "binary": mitmproxy.net.websockets.OPCODE.BINARY, "close": mitmproxy.net.websockets.OPCODE.CLOSE, "ping": mitmproxy.net.websockets.OPCODE.PING, "pong": mitmproxy.net.websockets.OPCODE.PONG, - } # type: typing.Dict[str, int] + } max = 15 preamble = "c" @@ -97,7 +97,7 @@ COMPONENTS = [ class WebsocketFrame(message.Message): - components = COMPONENTS # type: typing.List[typing.Type[base._Component]] + components: typing.List[typing.Type[base._Component]] = COMPONENTS logattrs = ["body"] # Used for nested frames unique_name = "body" |