aboutsummaryrefslogtreecommitdiffstats
path: root/pathod/language/base.py
diff options
context:
space:
mode:
authorharsh vijay <iharsh234@gmail.com>2017-05-02 05:19:25 +0530
committerGitHub <noreply@github.com>2017-05-02 05:19:25 +0530
commite24b4cc1b64455b8b9b5d1265103054bb8b3a8af (patch)
treee7e9474787505ffbaa348fbd0235529adb74f0e7 /pathod/language/base.py
parent53ad658e9f59743b72cb234f9b160aa6dc3d1f72 (diff)
downloadmitmproxy-e24b4cc1b64455b8b9b5d1265103054bb8b3a8af.tar.gz
mitmproxy-e24b4cc1b64455b8b9b5d1265103054bb8b3a8af.tar.bz2
mitmproxy-e24b4cc1b64455b8b9b5d1265103054bb8b3a8af.zip
Extend Mypy checking to pathod
* mypy checking pathod * initial commit , fixed errors * tox: mypy checking to pathod * Fixed mypy test failed * issue was with args in custom_contentview.py * tox: mypy checking to #2221 * follow-import=skip since we cant provide args to custom_contentview.py during mypy testing * Lint , Typo Fixed * code style: module import
Diffstat (limited to 'pathod/language/base.py')
-rw-r--r--pathod/language/base.py15
1 files changed, 7 insertions, 8 deletions
diff --git a/pathod/language/base.py b/pathod/language/base.py
index 3a810ef0..c8892748 100644
--- a/pathod/language/base.py
+++ b/pathod/language/base.py
@@ -3,10 +3,9 @@ import os
import abc
import functools
import pyparsing as pp
-
from mitmproxy.utils import strutils
from mitmproxy.utils import human
-
+import typing # noqa
from . import generators, exceptions
@@ -84,7 +83,7 @@ class Token:
return None
@property
- def unique_name(self):
+ def unique_name(self) -> typing.Optional[str]:
"""
Controls uniqueness constraints for tokens. No two tokens with the
same name will be allowed. If no uniquness should be applied, this
@@ -334,7 +333,7 @@ class OptionsOrValue(_Component):
Can be any of a specified set of options, or a value specifier.
"""
preamble = ""
- options = []
+ options = [] # type: 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 +375,7 @@ class OptionsOrValue(_Component):
class Integer(_Component):
- bounds = (None, None)
+ bounds = (None, None) # type: typing.Tuple[typing.Union[int, None], typing.Union[int , None]]
preamble = ""
def __init__(self, value):
@@ -442,7 +441,7 @@ class FixedLengthValue(Value):
A value component lead by an optional preamble.
"""
preamble = ""
- length = None
+ length = None # type: typing.Optional[int]
def __init__(self, value):
Value.__init__(self, value)
@@ -511,7 +510,7 @@ class IntField(_Component):
"""
An integer field, where values can optionally specified by name.
"""
- names = {}
+ names = {} # type: typing.Dict[str, int]
max = 16
preamble = ""
@@ -546,7 +545,7 @@ class NestedMessage(Token):
A nested message, as an escaped string with a preamble.
"""
preamble = ""
- nest_type = None
+ nest_type = None # type: ignore
def __init__(self, value):
Token.__init__(self)