changeset 130:d195a5f50137

rename isEmpty to match js
author drewp@bigasterisk.com
date Mon, 29 May 2023 16:14:17 -0700
parents 69ba5b86ce6c
children a47c8224e97f
files rdfdb/patch.py rdfdb/service.py rdfdb/syncedgraph/grapheditapi.py rdfdb/syncedgraph/grapheditapi_test.py rdfdb/syncedgraph/syncedgraph_base.py
diffstat 5 files changed, 5 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/rdfdb/patch.py	Sat May 27 19:06:48 2023 -0700
+++ b/rdfdb/patch.py	Mon May 29 16:14:17 2023 -0700
@@ -195,5 +195,5 @@
         assert isinstance(ctx, URIRef), ctx
         return ctx
 
-    def isNoop(self):
+    def isEmpty(self):
         return set(self.addQuads) == set(self.delQuads)
--- a/rdfdb/service.py	Sat May 27 19:06:48 2023 -0700
+++ b/rdfdb/service.py	Mon May 29 16:14:17 2023 -0700
@@ -71,7 +71,7 @@
 
         # this is very important- I caught clients piling up dozens of retries, causing
         # us to rewrite files then notice them, etc. Problem may not be fully solved.
-        if p.isNoop():
+        if p.isEmpty():
             return
 
         try:
--- a/rdfdb/syncedgraph/grapheditapi.py	Sat May 27 19:06:48 2023 -0700
+++ b/rdfdb/syncedgraph/grapheditapi.py	Mon May 29 16:14:17 2023 -0700
@@ -33,7 +33,7 @@
 
     def patchObject(self, context: URIRef, subject: Node, predicate: URIRef, newObject: Node):
         p = self.getObjectPatch(context, subject, predicate, newObject)
-        if not p.isNoop():
+        if not p.isEmpty():
             log.debug("patchObject %r" % p.jsonRepr)
         self.patch(p)  # type: ignore
 
--- a/rdfdb/syncedgraph/grapheditapi_test.py	Sat May 27 19:06:48 2023 -0700
+++ b/rdfdb/syncedgraph/grapheditapi_test.py	Mon May 29 16:14:17 2023 -0700
@@ -26,5 +26,5 @@
         obj.patchSubgraph(URIRef('g'), [stmt1])
         self.assertEqual(len(appliedPatches), 1)
         p = appliedPatches[0]
-        self.assertTrue(p.isNoop())
+        self.assertTrue(p.isEmpty())
         self.assertEqual(p.jsonRepr, '{"patch": {"adds": "", "deletes": ""}}')
--- a/rdfdb/syncedgraph/syncedgraph_base.py	Sat May 27 19:06:48 2023 -0700
+++ b/rdfdb/syncedgraph/syncedgraph_base.py	Mon May 29 16:14:17 2023 -0700
@@ -167,7 +167,7 @@
 
     async def _patchLocally(self, p: Patch) -> str:
         debugKey = '[id=%s]' % (id(p) % 1000)
-        if p.isNoop():
+        if p.isEmpty():
             log.info("skipping no-op patch")
             return debugKey