Skip to content

Commit

Permalink
chore: format
Browse files Browse the repository at this point in the history
  • Loading branch information
yupix committed Jun 16, 2023
1 parent f202891 commit c731975
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 13 deletions.
12 changes: 7 additions & 5 deletions mipac/actions/drive.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ async def get_folders(
since_id: str | None = None,
until_id: str | None = None,
folder_id: str | None = None,
get_all: bool=False
get_all: bool = False,
) -> AsyncGenerator[Folder, None]:
"""
フォルダーの一覧を取得します
Expand Down Expand Up @@ -368,12 +368,14 @@ async def get_folders(
'untilId': until_id,
'folderId': folder_id,
}

pagination = Pagination[FolderPayload](self._session, Route('POST', '/api/drive/folders'), json=body)


pagination = Pagination[FolderPayload](
self._session, Route('POST', '/api/drive/folders'), json=body
)

while True:
res_folders = await pagination.next()
for res_folder in res_folders:
yield Folder(res_folder,client=self._client)
yield Folder(res_folder, client=self._client)
if get_all is False or pagination.is_final:
break
20 changes: 13 additions & 7 deletions mipac/actions/federation.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,27 +151,33 @@ async def update_remote_user(self, user_id: str) -> bool:
)

async def get_users(
self, host: str, since_id: str | None = None, until_id: str | None = None, limit: int = 10, get_all: bool = False
self,
host: str,
since_id: str | None = None,
until_id: str | None = None,
limit: int = 10,
get_all: bool = False,
) -> AsyncGenerator[UserDetailed, None]:
if limit > 100:
raise ParameterError('limitは100以下である必要があります')

if get_all:
limit = 100

body = {'host': host, 'sinceId': since_id, 'untilId': until_id, 'limit': limit}

pagination = Pagination[IUserDetailed](self.__session, Route('POST', '/api/federation/users'), json=body)

pagination = Pagination[IUserDetailed](
self.__session, Route('POST', '/api/federation/users'), json=body
)

while True:
res_users: list[IUserDetailed] = await pagination.next()
for user in res_users:
yield UserDetailed(user, client=self.__client)

if get_all is False or pagination.is_final:
break


async def get_stats(self, limit: int = 10) -> IFederationInstanceStat:
if limit > 100:
raise ParameterError('limitは100以下である必要があります')
Expand Down
1 change: 0 additions & 1 deletion mipac/actions/mute.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,3 @@ async def gets(

if get_all is False or pagination.is_final:
break

0 comments on commit c731975

Please sign in to comment.