diff options
author | Philipp Hagemeister <phihag@phihag.de> | 2014-01-22 21:43:33 +0100 |
---|---|---|
committer | Philipp Hagemeister <phihag@phihag.de> | 2014-01-22 21:43:33 +0100 |
commit | dd26ced164f834a337956ab57a014a8afd8b9131 (patch) | |
tree | 1af300a7f4a8bada591d8b9667d6d785d9f1e1c0 | |
parent | bd2d82a5d3f119644d125e0b0a71dca738733fb4 (diff) |
Add __len__ to PagedLists
-rw-r--r-- | youtube_dl/utils.py | 4 |
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): |