Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

utils: Remove unused split_by function.

Anders Kaseorgf3e5ed57ae11
diff --git a/zerver/lib/utils.py b/zerver/lib/utils.py
index dd20ae1472c..f1f0f5cfbb8 100644
--- a/zerver/lib/utils.py
+++ b/zerver/lib/utils.py
@@ -1,7 +1,6 @@
import hashlib
import re
import secrets
-from itertools import zip_longest
from typing import Any, Callable, List, Optional, TypeVar
from django.conf import settings
@@ -108,12 +107,3 @@ def process_list_in_batches(
break
process_batch(items)
offset += chunk_size
-
-
-def split_by(array: List[Any], group_size: int, filler: Any) -> List[List[Any]]:
- """
- Group elements into list of size `group_size` and fill empty cells with
- `filler`. Recipe from https://docs.python.org/3/library/itertools.html
- """
- args = [iter(array)] * group_size
- return list(map(list, zip_longest(*args, fillvalue=filler)))
diff --git a/zerver/tests/test_docs.py b/zerver/tests/test_docs.py
index c728eed2233..280383d3cb5 100644
--- a/zerver/tests/test_docs.py
+++ b/zerver/tests/test_docs.py
@@ -15,7 +15,6 @@ from zerver.context_processors import get_apps_page_url
from zerver.lib.integrations import INTEGRATIONS
from zerver.lib.test_classes import ZulipTestCase
from zerver.lib.test_helpers import HostRequestMock
-from zerver.lib.utils import split_by
from zerver.models import Realm, get_realm
from zerver.views.documentation import add_api_uri_context
@@ -374,12 +373,6 @@ class AboutPageTest(ZulipTestCase):
self.assertEqual(result.status_code, 301)
self.assertEqual(result["Location"], "https://zulip.com/team/")
- def test_split_by(self) -> None:
- """Utility function primarily used in authors page"""
- flat_list = [1, 2, 3, 4, 5, 6, 7, 8, 9]
- expected_result = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
- self.assertEqual(split_by(flat_list, 3, None), expected_result)
-
class SmtpConfigErrorTest(ZulipTestCase):
def test_smtp_error(self) -> None: