Skip to content

Commit

Permalink
fix circular import iter + bumping version
Browse files Browse the repository at this point in the history
  • Loading branch information
rednaks committed May 24, 2021
1 parent 9bbbb50 commit c2106f7
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 19 deletions.
17 changes: 17 additions & 0 deletions django_async_orm/iter.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import asyncio


class AsyncIter:
def __init__(self, iterable):
self._iter = iter(iterable)

def __aiter__(self):
return self

async def __anext__(self):
try:
element = next(self._iter)
except StopIteration:
raise StopAsyncIteration
await asyncio.sleep(0)
return element
Empty file removed django_async_orm/models.py
Empty file.
2 changes: 1 addition & 1 deletion django_async_orm/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# Create your models here.
from django.db.models import QuerySet

from django_async_orm.utils import AsyncIter
from django_async_orm.iter import AsyncIter


class QuerySetAsync(QuerySet):
Expand Down
17 changes: 0 additions & 17 deletions django_async_orm/utils.py
Original file line number Diff line number Diff line change
@@ -1,24 +1,7 @@
import asyncio

from django_async_orm.manager import AsyncManager


class AsyncIter:
def __init__(self, iterable):
self._iter = iter(iterable)

def __aiter__(self):
return self

async def __anext__(self):
try:
element = next(self._iter)
except StopIteration:
raise StopAsyncIteration
await asyncio.sleep(0)
return element


def async_user_manager_factory():
from django.contrib.auth.models import UserManager

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "django-async-orm"
version = "0.1.3"
version = "0.1.4"
description = "Bringing async capabilities to django ORM"
authors = ["SkanderBM <skander.bmahmoud@gmail.com>"]
license = "MIT"
Expand Down

0 comments on commit c2106f7

Please sign in to comment.