Repository: libcloud Updated Branches: refs/heads/trunk d029c30fa -> c3198a093
Stop raising StopIteration in generators for Python 3.7 Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/c3198a09 Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/c3198a09 Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/c3198a09 Branch: refs/heads/trunk Commit: c3198a093ad62c463b2dadc44aa16e205b5a1545 Parents: d029c30 Author: Quentin Pradet <[email protected]> Authored: Wed Aug 29 22:03:55 2018 +0400 Committer: Quentin Pradet <[email protected]> Committed: Wed Aug 29 22:03:55 2018 +0400 ---------------------------------------------------------------------- libcloud/common/dimensiondata.py | 2 +- libcloud/storage/drivers/dummy.py | 2 -- libcloud/utils/files.py | 4 ++-- 3 files changed, 3 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/libcloud/blob/c3198a09/libcloud/common/dimensiondata.py ---------------------------------------------------------------------- diff --git a/libcloud/common/dimensiondata.py b/libcloud/common/dimensiondata.py index f76d52a..c4cd08a 100644 --- a/libcloud/common/dimensiondata.py +++ b/libcloud/common/dimensiondata.py @@ -526,7 +526,7 @@ class DimensionDataConnection(ConnectionUserAndKey): method).object yield resp if len(resp) <= 0: - raise StopIteration + return pcount = resp.get('pageCount') # pylint: disable=no-member psize = resp.get('pageSize') # pylint: disable=no-member http://git-wip-us.apache.org/repos/asf/libcloud/blob/c3198a09/libcloud/storage/drivers/dummy.py ---------------------------------------------------------------------- diff --git a/libcloud/storage/drivers/dummy.py b/libcloud/storage/drivers/dummy.py index eaec2d7..1200e51 100644 --- a/libcloud/storage/drivers/dummy.py +++ b/libcloud/storage/drivers/dummy.py @@ -44,8 +44,6 @@ class DummyFileObject(file): yield self._get_chunk(self._chunk_len) i += 1 - raise StopIteration - def _get_chunk(self, chunk_len): chunk = [str(x) for x in random.randint(97, 120)] return chunk http://git-wip-us.apache.org/repos/asf/libcloud/blob/c3198a09/libcloud/utils/files.py ---------------------------------------------------------------------- diff --git a/libcloud/utils/files.py b/libcloud/utils/files.py index ef03c85..95914cd 100644 --- a/libcloud/utils/files.py +++ b/libcloud/utils/files.py @@ -49,8 +49,8 @@ def read_in_chunks(iterator, chunk_size=None, fill_size=False, length (except for last chunk). :type fill_size: ``bool`` - :param yield_empty: If true and iterator returned no data, yield empty - bytes object before raising StopIteration. + :param yield_empty: If true and iterator returned no data, only yield empty + bytes object :type yield_empty: ``bool`` TODO: At some point in the future we could use byte arrays here if version
