Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

if switched on yield size as first value in query or lazy

  • Loading branch information...
commit 4a4e2578eab46011a09f0a56683da55691ae616f 1 parent e456786
@jensens jensens authored
Showing with 14 additions and 10 deletions.
  1. +14 −10 src/souper/soup.py
View
24 src/souper/soup.py
@@ -90,19 +90,23 @@ def add(self, record):
return record.intid
def query(self, queryobject, sort_index=None, limit=None, sort_type=None,
- reverse=False, names=None):
- result = self.catalog.query(queryobject, sort_index=sort_index,
- limit=limit, sort_type=sort_type,
- reverse=reverse, names=names)
- for iid in result[1]:
+ reverse=False, names=None, with_size=False):
+ size, iids = self.catalog.query(queryobject, sort_index=sort_index,
+ limit=limit, sort_type=sort_type,
+ reverse=reverse, names=names)
+ if with_size:
+ yield size
+ for iid in iids:
yield self.data[iid]
def lazy(self, queryobject, sort_index=None, limit=None, sort_type=None,
- reverse=False, names=None):
- result = self.catalog.query(queryobject, sort_index=sort_index,
- limit=limit, sort_type=sort_type,
- reverse=reverse, names=names)
- for iid in result[1]:
+ reverse=False, names=None, with_size=False):
+ size, iids = self.catalog.query(queryobject, sort_index=sort_index,
+ limit=limit, sort_type=sort_type,
+ reverse=reverse, names=names)
+ if with_size:
+ yield size
+ for iid in iids:
yield LazyRecord(iid, self)
def clear(self):
Please sign in to comment.
Something went wrong with that request. Please try again.