Mercurial > code > home > repos > homeauto
diff service/reasoning/graphop.py @ 756:f3f667769aef
python 3! and some types and cleanups
Ignore-this: 3453a547ee745fa83668f36956c835cd
author | drewp@bigasterisk.com |
---|---|
date | Fri, 14 Feb 2020 00:07:23 -0800 |
parents | 0f2ac014d9ea |
children |
line wrap: on
line diff
--- a/service/reasoning/graphop.py Thu Feb 13 23:00:06 2020 -0800 +++ b/service/reasoning/graphop.py Fri Feb 14 00:07:23 2020 -0800 @@ -1,8 +1,10 @@ import logging from rdflib import URIRef, ConjunctiveGraph +from typing import List log = logging.getLogger() -def graphWithoutMetadata(g, ignorePredicates=[]): + +def graphWithoutMetadata(g: ConjunctiveGraph, ignorePredicates=[]): """ graph filter that removes any statements whose subjects are contexts in the graph and also any statements with the given @@ -17,7 +19,9 @@ out.addN([stmt]) return out -def graphEqual(a, b, ignorePredicates=[]): + +def graphEqual(a: ConjunctiveGraph, b: ConjunctiveGraph, + ignorePredicates: List[URIRef]=[]): """ compare graphs, omitting any metadata statements about contexts (especially modification times) and also any statements using the @@ -27,7 +31,7 @@ stmtsB = set(graphWithoutMetadata(b, ignorePredicates)) if stmtsA == stmtsB: return True - + if log.getEffectiveLevel() <= logging.INFO: lost = stmtsA - stmtsB if lost: