diff options
author | Maximilian Hils <git@maximilianhils.com> | 2017-05-26 16:22:13 +0200 |
---|---|---|
committer | Maximilian Hils <git@maximilianhils.com> | 2017-05-26 21:00:35 +0200 |
commit | e7990e0983344179e49a46f160e1482a0a0f6aa7 (patch) | |
tree | 026a0c37bd772924b4176b92c06089f3b095cdbb /pathod/language/base.py | |
parent | eb5f37a7d19d74c88eed25d4b90f98bec1afa4be (diff) | |
download | mitmproxy-e7990e0983344179e49a46f160e1482a0a0f6aa7.tar.gz mitmproxy-e7990e0983344179e49a46f160e1482a0a0f6aa7.tar.bz2 mitmproxy-e7990e0983344179e49a46f160e1482a0a0f6aa7.zip |
fix recursive import
Diffstat (limited to 'pathod/language/base.py')
-rw-r--r-- | pathod/language/base.py | 41 |
1 files changed, 0 insertions, 41 deletions
diff --git a/pathod/language/base.py b/pathod/language/base.py index 3b33c5ed..97871e7e 100644 --- a/pathod/language/base.py +++ b/pathod/language/base.py @@ -8,7 +8,6 @@ from mitmproxy.utils import human import typing # noqa from . import generators from . import exceptions -from . import message # noqa class Settings: @@ -539,43 +538,3 @@ class IntField(_Component): def spec(self): return "%s%s" % (self.preamble, self.origvalue) - - -class NestedMessage(Token): - - """ - A nested message, as an escaped string with a preamble. - """ - preamble = "" - nest_type = None # type: typing.Optional[typing.Type[message.Message]] - - def __init__(self, value): - Token.__init__(self) - self.value = value - try: - self.parsed = self.nest_type( - self.nest_type.expr().parseString( - value.val.decode(), - parseAll=True - ) - ) - except pp.ParseException as v: - raise exceptions.ParseException(v.msg, v.line, v.col) - - @classmethod - def expr(cls): - e = pp.Literal(cls.preamble).suppress() - e = e + TokValueLiteral.expr() - return e.setParseAction(lambda x: cls(*x)) - - def values(self, settings): - return [ - self.value.get_generator(settings), - ] - - def spec(self): - return "%s%s" % (self.preamble, self.value.spec()) - - def freeze(self, settings): - f = self.parsed.freeze(settings).spec() - return self.__class__(TokValueLiteral(strutils.bytes_to_escaped_str(f.encode(), escape_single_quotes=True))) |