Skip to content

Commit c2106f7

Browse files
committed
fix circular import iter + bumping version
1 parent 9bbbb50 commit c2106f7

File tree

5 files changed

+19
-19
lines changed

5 files changed

+19
-19
lines changed

django_async_orm/iter.py

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import asyncio
2+
3+
4+
class AsyncIter:
5+
def __init__(self, iterable):
6+
self._iter = iter(iterable)
7+
8+
def __aiter__(self):
9+
return self
10+
11+
async def __anext__(self):
12+
try:
13+
element = next(self._iter)
14+
except StopIteration:
15+
raise StopAsyncIteration
16+
await asyncio.sleep(0)
17+
return element

django_async_orm/models.py

Whitespace-only changes.

django_async_orm/query.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# Create your models here.
66
from django.db.models import QuerySet
77

8-
from django_async_orm.utils import AsyncIter
8+
from django_async_orm.iter import AsyncIter
99

1010

1111
class QuerySetAsync(QuerySet):

django_async_orm/utils.py

-17
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,7 @@
1-
import asyncio
21

32
from django_async_orm.manager import AsyncManager
43

54

6-
class AsyncIter:
7-
def __init__(self, iterable):
8-
self._iter = iter(iterable)
9-
10-
def __aiter__(self):
11-
return self
12-
13-
async def __anext__(self):
14-
try:
15-
element = next(self._iter)
16-
except StopIteration:
17-
raise StopAsyncIteration
18-
await asyncio.sleep(0)
19-
return element
20-
21-
225
def async_user_manager_factory():
236
from django.contrib.auth.models import UserManager
247

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "django-async-orm"
3-
version = "0.1.3"
3+
version = "0.1.4"
44
description = "Bringing async capabilities to django ORM"
55
authors = ["SkanderBM <[email protected]>"]
66
license = "MIT"

0 commit comments

Comments
 (0)