diff service/mqtt_to_rdf/stmt_chunk.py @ 1653:e7d594c065d4

minor refactoring
author drewp@bigasterisk.com
date Sun, 19 Sep 2021 13:20:39 -0700
parents dddfa09ea0b9
children d47832373b34
line wrap: on
line diff
--- a/service/mqtt_to_rdf/stmt_chunk.py	Sun Sep 19 13:19:20 2021 -0700
+++ b/service/mqtt_to_rdf/stmt_chunk.py	Sun Sep 19 13:20:39 2021 -0700
@@ -27,8 +27,8 @@
     """
     # all immutable
     primary: Triple
-    subjList: Optional[List[Node]]
-    objList: Optional[List[Node]]
+    subjList: Optional[List[Node]] = None
+    objList: Optional[List[Node]] = None
 
     def __post_init__(self):
         self.predicate = self.primary[1]
@@ -80,15 +80,15 @@
         return bool(list(functionsFor(cast(URIRef, self.predicate))))
 
     def isStatic(self) -> bool:
-        return (stmtIsStatic(self.primary) and all(termIsStatic(s) for s in (self.subjList or [])) and
-                all(termIsStatic(s) for s in (self.objList or [])))
+        return (_stmtIsStatic(self.primary) and all(_termIsStatic(s) for s in (self.subjList or [])) and
+                all(_termIsStatic(s) for s in (self.objList or [])))
 
 
-def stmtIsStatic(stmt: Triple) -> bool:
-    return all(termIsStatic(t) for t in stmt)
+def _stmtIsStatic(stmt: Triple) -> bool:
+    return all(_termIsStatic(t) for t in stmt)
 
 
-def termIsStatic(term: Node) -> bool:
+def _termIsStatic(term: Node) -> bool:
     return isinstance(term, (URIRef, Literal))