Skip to content

Commit

Permalink
fix: lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
abhinand-c committed Dec 9, 2023
1 parent 23557c6 commit ebfb634
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions graphene_mongo/fields_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
find_skip_and_limit,
get_query_fields,
sync_to_async,
has_page_info
has_page_info,
)

PYMONGO_VERSION = tuple(pymongo.version_tuple[:2])
Expand Down Expand Up @@ -130,8 +130,15 @@ async def default_resolver(self, _root, info, required_fields=None, resolved=Non
)
items = await sync_to_async(_base_query.limit)(limit)
has_next_page = (
await sync_to_async(len)(await sync_to_async(_base_query.skip(limit).only("id").limit)(1)) != 0
) if requires_page_info else False
(
await sync_to_async(len)(
await sync_to_async(_base_query.skip(limit).only("id").limit)(1)
)
!= 0
)
if requires_page_info
else False
)
elif skip:
items = await sync_to_async(items.skip)(skip)
else:
Expand All @@ -142,7 +149,9 @@ async def default_resolver(self, _root, info, required_fields=None, resolved=Non
else:
_base_query = items
items = items[skip : skip + limit]
has_next_page = (skip + limit) < len(_base_query) if requires_page_info else False
has_next_page = (
(skip + limit) < len(_base_query) if requires_page_info else False
)
elif skip:
items = items[skip:]
iterables = await sync_to_async(list)(items)
Expand Down

0 comments on commit ebfb634

Please sign in to comment.