From e7990e0983344179e49a46f160e1482a0a0f6aa7 Mon Sep 17 00:00:00 2001 From: Maximilian Hils Date: Fri, 26 May 2017 16:22:13 +0200 Subject: fix recursive import --- pathod/language/base.py | 41 ----------------------------------------- 1 file changed, 41 deletions(-) (limited to 'pathod/language/base.py') 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))) -- cgit v1.2.3