diff options
author | Richard van der Hoff <richard@matrix.org> | 2020-01-14 11:58:02 +0000 |
---|---|---|
committer | Richard van der Hoff <richard@matrix.org> | 2020-01-16 22:25:32 +0000 |
commit | 14d8f342d5cae86d93d9ba2b411d486690ff54f5 (patch) | |
tree | 6d4caaa8fbba62339110e0f7ba2585bc8abca061 /synapse/util/__init__.py | |
parent | Add StateMap type alias (#6715) (diff) | |
download | synapse-14d8f342d5cae86d93d9ba2b411d486690ff54f5.tar.xz |
move batch_iter to a separate module
Diffstat (limited to 'synapse/util/__init__.py')
-rw-r--r-- | synapse/util/__init__.py | 17 |
1 files changed, 0 insertions, 17 deletions
diff --git a/synapse/util/__init__.py b/synapse/util/__init__.py index 7856353002..60f0de70f7 100644 --- a/synapse/util/__init__.py +++ b/synapse/util/__init__.py @@ -15,7 +15,6 @@ import logging import re -from itertools import islice import attr @@ -107,22 +106,6 @@ class Clock(object): raise -def batch_iter(iterable, size): - """batch an iterable up into tuples with a maximum size - - Args: - iterable (iterable): the iterable to slice - size (int): the maximum batch size - - Returns: - an iterator over the chunks - """ - # make sure we can deal with iterables like lists too - sourceiter = iter(iterable) - # call islice until it returns an empty tuple - return iter(lambda: tuple(islice(sourceiter, size)), ()) - - def log_failure(failure, msg, consumeErrors=True): """Creates a function suitable for passing to `Deferred.addErrback` that logs any failures that occur. |