@@ -164,7 +164,7 @@ def __getitem__(self, key):
164164 if not isinstance (key , Node ):
165165 key = Variable (key )
166166
167- if not type (key ) in (BNode , Variable ):
167+ if not isinstance (key , (BNode , Variable ) ):
168168 return key
169169
170170 if key not in self ._d :
@@ -177,22 +177,20 @@ def project(self, vars):
177177
178178 def merge (self , other ):
179179 res = FrozenBindings (self .ctx , itertools .chain (self .items (), other .items ()))
180-
181180 return res
182181
183- def _now (self ):
182+ @property
183+ def now (self ):
184184 return self .ctx .now
185185
186- def _bnodes (self ):
186+ @property
187+ def bnodes (self ):
187188 return self .ctx .bnodes
188189
189- def _prologue (self ):
190+ @property
191+ def prologue (self ):
190192 return self .ctx .prologue
191193
192- prologue = property (_prologue )
193- bnodes = property (_bnodes )
194- now = property (_now )
195-
196194 def forget (self , before , _except = None ):
197195 """
198196 return a frozen dict only of bindings made in self
@@ -222,8 +220,7 @@ def remember(self, these):
222220 return FrozenBindings (self .ctx , (x for x in self .items () if x [0 ] in these ))
223221
224222
225- class QueryContext (object ):
226-
223+ class QueryContext :
227224 """
228225 Query context - passed along when evaluating the query
229226 """
@@ -260,7 +257,9 @@ def clone(self, bindings=None):
260257 r .bnodes = self .bnodes
261258 return r
262259
263- def _get_dataset (self ):
260+ @property
261+ def dataset (self ):
262+ """"current dataset"""
264263 if self ._dataset is None :
265264 raise Exception (
266265 "You performed a query operation requiring "
@@ -269,8 +268,6 @@ def _get_dataset(self):
269268 )
270269 return self ._dataset
271270
272- dataset = property (_get_dataset , doc = "current dataset" )
273-
274271 def load (self , source , default = False , ** kwargs ):
275272 def _load (graph , source ):
276273 try :
@@ -306,7 +303,7 @@ def _load(graph, source):
306303
307304 def __getitem__ (self , key ):
308305 # in SPARQL BNodes are just labels
309- if not type (key ) in (BNode , Variable ):
306+ if not isinstance (key , (BNode , Variable ) ):
310307 return key
311308 try :
312309 return self .bindings [key ]
@@ -348,11 +345,6 @@ def push(self):
348345 def clean (self ):
349346 return self .clone ([])
350347
351- # def pop(self):
352- # self.bindings = self.bindings.outer
353- # if self.bindings is None:
354- # raise Exception("We've bottomed out of the bindings stack!")
355-
356348 def thaw (self , frozenbindings ):
357349 """
358350 Create a new read/write query context from the given solution
@@ -362,8 +354,7 @@ def thaw(self, frozenbindings):
362354 return c
363355
364356
365- class Prologue (object ):
366-
357+ class Prologue :
367358 """
368359 A class for holding prefixing bindings and base URI information
369360 """
@@ -402,7 +393,7 @@ def absolutize(self, iri):
402393 return iri
403394
404395
405- class Query ( object ) :
396+ class Query :
406397 """
407398 A parsed and translated query
408399 """
0 commit comments