Skip to content

Commit

Permalink
Cleanup duplicated functions in rye-devtools (#933)
Browse files Browse the repository at this point in the history
* Cleanup rye-devtools

* Remove unused imports
  • Loading branch information
j178 authored Mar 29, 2024
1 parent c2f5a65 commit 740a944
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 17 deletions.
17 changes: 1 addition & 16 deletions rye-devtools/src/rye_devtools/find_downloads.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

import abc
import asyncio
import itertools
import os
import re
import sys
Expand All @@ -18,21 +17,7 @@
import httpx
from httpx import HTTPStatusError

from .common import PlatformTriple, Version, fetch


def log(*args, **kwargs):
print(*args, file=sys.stderr, **kwargs)


def batched(iterable, n):
"Batch data into tuples of length n. The last batch may be shorter."
# batched('ABCDEFG', 3) --> ABC DEF G
if n < 1:
raise ValueError("n must be at least one")
it = iter(iterable)
while batch := tuple(itertools.islice(it, n)):
yield batch
from .common import PlatformTriple, Version, batched, fetch, log


class PythonImplementation(StrEnum):
Expand Down
3 changes: 2 additions & 1 deletion rye-devtools/tests/test_basic.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import pytest
from rye_devtools.find_downloads import CPythonFinder, PlatformTriple, batched
from rye_devtools.common import batched
from rye_devtools.find_downloads import CPythonFinder, PlatformTriple


def test_batched():
Expand Down

0 comments on commit 740a944

Please sign in to comment.