Mercurial > code > home > repos > rdfdb
changeset 22:2748dac8195b
new Patch.simplify
Ignore-this: b90097ef6566dccc0040eefbf5c6cca0
author | drewp@bigasterisk.com |
---|---|
date | Wed, 17 Apr 2019 09:24:50 +0000 |
parents | ad6b5804deb1 |
children | 92dea84af97a |
files | rdfdb/patch.py |
diffstat | 1 files changed, 8 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- 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