示例#1
0
    def _diff(self):
        def fmt_dict(k, v):
            if isinstance(v, dict):
                return k, Hashabledict(v)
            if isinstance(v, list):
                return k, ",".join(map(str, v))
            return k, v

        current = Hashabledict({fmt_dict(k, v) for k, v in self.serialize().items()})
        init = Hashabledict(
            {fmt_dict(k, v) for k, v in self.serialize(init=True).items()}
        )
        return set([i[0] for i in set(current.items()) ^ set(init.items())])
示例#2
0
 def fmt_dict(k, v):
     if isinstance(v, dict):
         return k, Hashabledict(v)
     if isinstance(v, list):
         return k, ",".join(map(str, v))
     return k, v