# HG changeset patch # User drewp@bigasterisk.com # Date 1555493090 0 # Node ID 2748dac8195b2f485fc675a17b31542c5dbeee68 # Parent ad6b5804deb11f01bb2b7fc771286513ae9ab715 new Patch.simplify Ignore-this: b90097ef6566dccc0040eefbf5c6cca0 diff -r ad6b5804deb1 -r 2748dac8195b rdfdb/patch.py --- a/rdfdb/patch.py Wed Apr 17 09:23:34 2019 +0000 +++ b/rdfdb/patch.py Wed Apr 17 09:24:50 2019 +0000 @@ -128,6 +128,14 @@ d.update(extraAttrs) return json.dumps(d) + def simplify(self): + adds = set(self.addQuads) + dels = set(self.delQuads) + both = adds.intersection(dels) + if not both: + return self + return Patch(addQuads=adds - both, delQuads=dels - both) + def concat(self, more): """ new Patch with the result of applying this patch and the