diff options
Diffstat (limited to 'mitmproxy/filt.py')
-rw-r--r-- | mitmproxy/filt.py | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/mitmproxy/filt.py b/mitmproxy/filt.py index aa62b717..5e0e13cc 100644 --- a/mitmproxy/filt.py +++ b/mitmproxy/filt.py @@ -31,19 +31,19 @@ ~c CODE Response code. rex Equivalent to ~u rex """ -from __future__ import absolute_import +from __future__ import absolute_import, print_function import re import sys import pyparsing as pp -class _Token: - +class _Token(object): def dump(self, indent=0, fp=sys.stdout): - print >> fp, "\t" * indent, self.__class__.__name__, - if hasattr(self, "expr"): - print >> fp, "(%s)" % self.expr, - print >> fp + print("{spacing}{name}{expr}".format( + spacing="\t" * indent, + name=self.__class__.__name__, + expr=getattr(self, "expr", "") + ), file=fp) class _Action(_Token): @@ -283,7 +283,7 @@ class FAnd(_Token): self.lst = lst def dump(self, indent=0, fp=sys.stdout): - print >> fp, "\t" * indent, self.__class__.__name__ + super(FAnd, self).dump(indent, fp) for i in self.lst: i.dump(indent + 1, fp) @@ -297,7 +297,7 @@ class FOr(_Token): self.lst = lst def dump(self, indent=0, fp=sys.stdout): - print >> fp, "\t" * indent, self.__class__.__name__ + super(FOr, self).dump(indent, fp) for i in self.lst: i.dump(indent + 1, fp) @@ -311,7 +311,7 @@ class FNot(_Token): self.itm = itm[0] def dump(self, indent=0, fp=sys.stdout): - print >> fp, "\t" * indent, self.__class__.__name__ + super(FNot, self).dump(indent, fp) self.itm.dump(indent + 1, fp) def __call__(self, f): |