diff options
author | Thomas Kriechbaumer <thomas@kriechbaumer.name> | 2015-05-27 11:18:54 +0200 |
---|---|---|
committer | Thomas Kriechbaumer <thomas@kriechbaumer.name> | 2015-05-27 11:19:11 +0200 |
commit | e3d390e036430b9d7cc4b93679229fe118eb583a (patch) | |
tree | 1f10a2a59c8abef4bd24c8189d14602264b20fad /netlib/odict.py | |
parent | f7b75ba8c21c66e38da81adf3b2c573b7dae87f3 (diff) | |
download | mitmproxy-e3d390e036430b9d7cc4b93679229fe118eb583a.tar.gz mitmproxy-e3d390e036430b9d7cc4b93679229fe118eb583a.tar.bz2 mitmproxy-e3d390e036430b9d7cc4b93679229fe118eb583a.zip |
cleanup code with autopep8
run the following command:
$ autopep8 -i -r -a -a .
Diffstat (limited to 'netlib/odict.py')
-rw-r--r-- | netlib/odict.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/netlib/odict.py b/netlib/odict.py index dd738c55..f52acd50 100644 --- a/netlib/odict.py +++ b/netlib/odict.py @@ -1,5 +1,6 @@ from __future__ import (absolute_import, print_function, division) -import re, copy +import re +import copy def safe_subn(pattern, repl, target, *args, **kwargs): @@ -12,10 +13,12 @@ def safe_subn(pattern, repl, target, *args, **kwargs): class ODict(object): + """ A dictionary-like object for managing ordered (key, value) data. Think about it as a convenient interface to a list of (key, value) tuples. """ + def __init__(self, lst=None): self.lst = lst or [] @@ -157,7 +160,7 @@ class ODict(object): "key: value" """ for k, v in self.lst: - s = "%s: %s"%(k, v) + s = "%s: %s" % (k, v) if re.search(expr, s): return True return False @@ -192,11 +195,12 @@ class ODict(object): return klass([list(i) for i in state]) - class ODictCaseless(ODict): + """ A variant of ODict with "caseless" keys. This version _preserves_ key case, but does not consider case when setting or getting items. """ + def _kconv(self, s): return s.lower() |