aboutsummaryrefslogtreecommitdiffstats
path: root/json_diff.py
diff options
context:
space:
mode:
authorMatěj Cepl <mcepl@redhat.com>2011-11-16 13:06:16 +0100
committerMatěj Cepl <mcepl@redhat.com>2011-11-16 13:11:10 +0100
commit26b4428c04453478ae7428b6232ae857f02af21e (patch)
treefa8d13b01212a440015a5bd5d69312d49dc97c10 /json_diff.py
parent00212166f380611d9472f2280ff3566863c9c5b4 (diff)
downloadjson_diff-26b4428c04453478ae7428b6232ae857f02af21e.tar.gz
Back to green bar. Just tiny change before doing serious work.
Diffstat (limited to 'json_diff.py')
-rwxr-xr-xjson_diff.py11
1 files changed, 4 insertions, 7 deletions
diff --git a/json_diff.py b/json_diff.py
index 0362f61..db123a9 100755
--- a/json_diff.py
+++ b/json_diff.py
@@ -25,21 +25,19 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
from __future__ import division, absolute_import, print_function
import json
import logging
-import odict
-
from optparse import OptionParser
__author__ = "Matěj Cepl"
__version__ = "0.1.0"
-logging.basicConfig(format='%(levelname)s:%(funcName)s:%(message)s', level=logging.INFO)
+logging.basicConfig(format='%(levelname)s:%(funcName)s:%(message)s', level=logging.DEBUG)
STYLE_MAP = {
u"_append": "append_class",
u"_remove": "remove_class",
u"_update": "update_class"
}
-
+INTERNAL_KEYS = set(STYLE_MAP.keys())
LEVEL_INDENT = "&nbsp;"
@@ -99,7 +97,6 @@ class HTMLFormatter(object):
# doesn't have level and neither concept of it, much
def _format_dict(self, diff_dict, typch="unknown_change", level=0):
- internal_keys = set(STYLE_MAP.keys())
level_str = ("<td>" + LEVEL_INDENT + "</td>") * level
out_str = ""
logging.debug("out_str = %s", out_str)
@@ -109,14 +106,14 @@ class HTMLFormatter(object):
logging.debug("level = %s", unicode(level))
logging.debug("diff_dict.keys() = %s", unicode(diff_dict.keys()))
- for typechange in set(diff_dict.keys()) & internal_keys:
+ for typechange in set(diff_dict.keys()) & INTERNAL_KEYS:
logging.debug("---- internal typechange in diff_dict.keys() = %s", typechange)
logging.debug("---- diff_dict[typechange] = %s", unicode(diff_dict[typechange]))
logging.debug("---- self._is_leafnode(diff_dict[typechange]) = %s",
self._is_leafnode(diff_dict[typechange]))
out_str += self._format_dict(diff_dict[typechange], typechange, level)
- for variable in set(diff_dict.keys()) - internal_keys:
+ for variable in set(diff_dict.keys()) - INTERNAL_KEYS:
logging.debug("**** external variable in diff_dict.keys() = %s", variable)
logging.debug("**** diff_dict[variable] = %s", unicode(diff_dict[variable]))
logging.debug("**** self._is_scalar(diff_dict[variable]) = %s",