aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Hagemeister <phihag@phihag.de>2014-01-22 21:43:33 +0100
committerPhilipp Hagemeister <phihag@phihag.de>2014-01-22 21:43:33 +0100
commitdd26ced164f834a337956ab57a014a8afd8b9131 (patch)
tree1af300a7f4a8bada591d8b9667d6d785d9f1e1c0
parentbd2d82a5d3f119644d125e0b0a71dca738733fb4 (diff)
Add __len__ to PagedLists
-rw-r--r--youtube_dl/utils.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/youtube_dl/utils.py b/youtube_dl/utils.py
index ed5ee222f..8fa4cb67f 100644
--- a/youtube_dl/utils.py
+++ b/youtube_dl/utils.py
@@ -1172,6 +1172,10 @@ class PagedList(object):
self._pagefunc = pagefunc
self._pagesize = pagesize
+ def __len__(self):
+ # This is only useful for tests
+ return len(self.getslice())
+
def getslice(self, start=0, end=None):
res = []
for pagenum in itertools.count(start // self._pagesize):