diff options
author | Maximilian Hils <git@maximilianhils.com> | 2016-03-20 19:56:22 +0100 |
---|---|---|
committer | Maximilian Hils <git@maximilianhils.com> | 2016-03-20 19:56:22 +0100 |
commit | 6f902ffbb3067350da3da01d923e4351d63f604a (patch) | |
tree | fbcb2c6e4db5f487448df80267a7bff3bb5c55f4 /mitmproxy/filt.py | |
parent | 88d365cfe671bc5c8d96e78334337aa84cc815da (diff) | |
download | mitmproxy-6f902ffbb3067350da3da01d923e4351d63f604a.tar.gz mitmproxy-6f902ffbb3067350da3da01d923e4351d63f604a.tar.bz2 mitmproxy-6f902ffbb3067350da3da01d923e4351d63f604a.zip |
py3++: iteritems
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): |