Skip to content

Commit

Permalink
chore: docstringをformat
Browse files Browse the repository at this point in the history
  • Loading branch information
yupix committed Feb 24, 2024
1 parent f0ce0b0 commit ff6836b
Show file tree
Hide file tree
Showing 25 changed files with 62 additions and 128 deletions.
1 change: 0 additions & 1 deletion mipac/actions/admins/accounts.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ async def create(self, username: str, password: str): # TODO: 多分UserDetaile
password : str
パスワード
"""

data = {"username": username, "password": password}
res = await self._session.request(
Route("POST", "/api/admin/accounts/create"),
Expand Down
4 changes: 0 additions & 4 deletions mipac/actions/admins/drive.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ async def clean_remote_files(self) -> bool:
bool
Whether the remote files were cleaned
"""

res: bool = await self.__session.request(
Route("POST", "/api/admin/drive/clean-remote-files"), auth=True
)
Expand All @@ -42,7 +41,6 @@ async def cleanup(self) -> bool:
bool
Whether the drive was cleaned up
"""

res: bool = await self.__session.request(
Route("POST", "/api/admin/drive/cleanup"), auth=True
)
Expand Down Expand Up @@ -84,7 +82,6 @@ async def get_files(
list[File]
A list of files
"""

data = {
"limit": limit,
"sinceId": since_id,
Expand Down Expand Up @@ -116,7 +113,6 @@ async def show_file(self, file_id: str, url: str | None = None):
dict[str, Any]
The file
"""

data = {
"fileId": file_id,
"url": url,
Expand Down
1 change: 0 additions & 1 deletion mipac/actions/admins/emoji.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,6 @@ async def remove(self, emoji_id: str | None = None) -> bool:
NotExistRequiredData
Idが不足している
"""

emoji_id = emoji_id or self.__emoji_id

if emoji_id is None:
Expand Down
1 change: 0 additions & 1 deletion mipac/actions/admins/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,6 @@ async def suspend(self, *, user_id: str | None = None) -> bool:
bool
成功ならTrue
"""

user_id = user_id or self.__user_id

return await super().suspend(user_id=user_id)
Expand Down
3 changes: 0 additions & 3 deletions mipac/actions/antenna.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ async def delete(self, *, antenna_id: str) -> bool:
bool
success or failure
"""

body = {"antennaId": antenna_id}
res: bool = await self._session.request(
Route("POST", "/api/antennas/delete"), auth=True, json=body
Expand Down Expand Up @@ -322,7 +321,6 @@ async def update(
Antenna
The created antenna.
"""

antenna_id = antenna_id or self.__antenna_id

return await super().update(
Expand Down Expand Up @@ -390,7 +388,6 @@ async def create(
Antenna
The created antenna.
"""

if users is None:
users = [""]
if exclude_keywords is None:
Expand Down
4 changes: 0 additions & 4 deletions mipac/actions/channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -725,7 +725,6 @@ async def featured(self) -> list[Channel]:
list[Channel]
取得したチャンネルのリスト
"""

raw_channels: list[IChannel] = await self._session.request(
Route("POST", "/api/channels/featured"), auth=True, lower=True
)
Expand Down Expand Up @@ -754,7 +753,6 @@ async def get_all_followed(
AsyncGenerator[Channel, None]
取得したフォロー中のチャンネル
"""

body = {"sinceId": since_id, "untilId": until_id, "limit": limit}

pagination = Pagination[IChannel](
Expand Down Expand Up @@ -816,7 +814,6 @@ async def get_all_owned(
AsyncGenerator[Channel, None]
取得した自分が所有しているチャンネル
"""

body = {"sinceId": since_id, "untilId": until_id, "limit": limit}

pagination = Pagination[IChannel](
Expand Down Expand Up @@ -894,7 +891,6 @@ async def search(
list[Channel]
見つかったチャンネルのリスト
"""

data = {
"query": query,
"type": type,
Expand Down
4 changes: 2 additions & 2 deletions mipac/actions/clip.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ async def get_all_notes(
clip_id: str,
) -> AsyncGenerator[Note, None]:
"""Get notes from a clip
Parameters
----------
clip_id : str | None, optional, by default None
Expand Down Expand Up @@ -158,7 +159,6 @@ async def update(
bool
True if the clip was updated, False otherwise
"""

body = {"clipId": clip_id, "name": name, "isPublic": is_public, "description": description}
result: IClip = await self._session.request(
Route("POST", "/api/clips/update"), json=body, auth=True
Expand Down Expand Up @@ -196,6 +196,7 @@ async def get_all_notes(
clip_id: str | None = None,
) -> AsyncGenerator[Note, None]:
"""Get notes from a clip
Parameters
----------
clip_id : str | None, optional, by default None
Expand All @@ -214,7 +215,6 @@ async def get_all_notes(
AsyncGenerator[Note, None]
The notes
"""

clip_id = clip_id or self._clip_id

async for note in super().get_all_notes(
Expand Down
2 changes: 0 additions & 2 deletions mipac/actions/drive/drive.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ async def get_status(self) -> DriveStatus:
DriveStatus
The status of the drive
"""

res: IDriveStatus = await self.__session.request(Route("POST", "/api/drive"), auth=True)
return DriveStatus(raw_drive_status=res, client=self.__client)

Expand Down Expand Up @@ -57,7 +56,6 @@ async def stream(
list[File]
A list of files
"""

params = {
"limit": limit,
"sinceId": since_id,
Expand Down
9 changes: 0 additions & 9 deletions mipac/actions/drive/files.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,6 @@ async def get_attached_notes(
list[Note]
The attached notes of the file
"""

file_id = file_id or self.__file_ids

return await super().get_attached_notes(
Expand Down Expand Up @@ -231,7 +230,6 @@ async def delete(self, *, file_id: str | None = None) -> bool:
bool
削除に成功したかどうか
"""

file_id = file_id or self.__file_ids

return await super().delete(file_id=file_id)
Expand Down Expand Up @@ -316,7 +314,6 @@ async def get_files(
list[File]
The files of the drive
"""

data = {
"limit": limit,
"sinceId": since_id,
Expand Down Expand Up @@ -372,7 +369,6 @@ async def check_existence(self, md5: str) -> bool:
bool
存在するかしないか
"""

data = {"md5": md5}

res: bool = await self._session.request(
Expand Down Expand Up @@ -414,7 +410,6 @@ async def create(
File
アップロードしたファイル
"""

if isinstance(file, io.IOBase):
if (file.seekable() and file.readable()) is False: # 書き込み/読み込みができるか確認
raise ValueError(f"File buffer {file!r} must be seekable and readable")
Expand Down Expand Up @@ -455,7 +450,6 @@ async def find_by_hash(self, md5: str) -> list[File]:
list[File]
見つかったファイル
"""

data = {"md5": md5}

raw_files: list[IFile] = await self._session.request(
Expand All @@ -480,7 +474,6 @@ async def find(self, name: str, folder_id: str | None = None) -> list[File]:
list[File]
The found files
"""

data = {"name": name, "folderId": folder_id}

res: list[IFile] = await self._session.request(
Expand All @@ -505,7 +498,6 @@ async def show(self, file_id: str, url: str | None = None) -> File:
File
取得したファイル
"""

data = {"fileId": file_id, "url": url}

res: IFile = await self._session.request(
Expand Down Expand Up @@ -546,7 +538,6 @@ async def upload_from_url(
bool
アップロードのリクエストに成功したかどうか
"""

data = {
"url": url,
"folderId": folder_id,
Expand Down
1 change: 0 additions & 1 deletion mipac/actions/drive/folders.py
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,6 @@ async def find(self, name: str, parent_id: str | None = None) -> list[Folder]:
list[Folder]
The found folders
"""

data = {"name": name, "parentId": parent_id}
raw_folders: list[IFolder] = await self._session.request(
Route("POST", "/api/drive/folders/find"),
Expand Down
4 changes: 0 additions & 4 deletions mipac/actions/follow.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@ async def get_all(self) -> list[FollowRequest]:
list[FollowRequest]
List of follow requests
"""

res: list[IFollowRequest] = await self._session.request(
Route("POST", "/api/following/requests/list"),
auth=True,
Expand All @@ -154,7 +153,6 @@ async def accept(self, user_id: str | None = None) -> bool:
bool
Whether the request was accepted
"""

user_id = user_id or self.__user_id

data = {"userId": user_id}
Expand All @@ -180,7 +178,6 @@ async def reject(self, user_id: str | None = None) -> bool:
bool
Whether the request was rejected
"""

user_id = user_id or self.__user_id

data = {"userId": user_id}
Expand All @@ -206,7 +203,6 @@ async def cancel(self, user_id: str | None = None) -> PartialUser:
PartialUser
The user that you canceled to follow
"""

user_id = user_id or self.__user_id

data = {"userId": user_id}
Expand Down
5 changes: 0 additions & 5 deletions mipac/actions/invite.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ async def delete(self, *, invite_id: str) -> bool:
bool
Whether the invite code was deleted.
"""

res: bool = await self._session.request(
Route("POST", "/api/invite/delete"), json={"inviteId": invite_id}, auth=True
)
Expand All @@ -57,7 +56,6 @@ async def delete(self, *, invite_id: str | None = None) -> bool:
bool
Whether the invite code was deleted.
"""

invite_id = invite_id or self._invite_id

return await super().delete(invite_id=invite_id)
Expand Down Expand Up @@ -103,7 +101,6 @@ async def get_list(
list[PartialInviteCode]
The list of invite codes.
"""

data = {"limit": limit, "sinceId": since_id, "untilId": until_id}

raw_codes: list[IInviteCode] = await self._session.request(
Expand All @@ -130,7 +127,6 @@ async def get_all_list(
list[PartialInviteCode]
The list of invite codes.
"""

data = {"limit": 100, "sinceId": since_id, "untilId": until_id}

pagination = Pagination[IInviteCode](
Expand All @@ -151,7 +147,6 @@ async def get_limit(self) -> InviteLimit:
int
The number of invite codes you can create.
"""

raw_invite_limit: IInviteLimit = await self._session.request(
Route("POST", "/api/invite/limit"), auth=True
)
Expand Down
17 changes: 7 additions & 10 deletions mipac/actions/note.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ async def get_replies(
Endpoint: `/api/notes/replies`
Parameters
---------
----------
since_id : str | None, default=None
since id
until_id : str | None, default=None
Expand Down Expand Up @@ -377,7 +377,7 @@ async def get_all_replies(
Endpoint: `/api/notes/replies`
Parameters
---------
----------
since_id : str | None, default=None
since id
until_id : str | None, default=None
Expand Down Expand Up @@ -536,7 +536,6 @@ async def renote(
The ID list of files to be attached
poll : MiPoll | None, default=None
"""

body = create_note_body(
text=text,
visibility=visibility,
Expand Down Expand Up @@ -830,7 +829,6 @@ async def get_clips(self, *, note_id: str | None = None) -> list[Clip]:
list[Clip]
Clips of the note
"""

note_id = note_id or self._note_id

return await super().get_clips(note_id=note_id)
Expand Down Expand Up @@ -970,7 +968,7 @@ async def get_replies(
Endpoint: `/api/notes/replies`
Parameters
---------
----------
since_id : str | None, default=None
since id
until_id : str | None, default=None
Expand Down Expand Up @@ -1004,7 +1002,7 @@ async def get_all_replies(
Endpoint: `/api/notes/replies`
Parameters
---------
----------
since_id : str | None, default=None
since id
until_id : str | None, default=None
Expand Down Expand Up @@ -1082,7 +1080,6 @@ async def add_clips(self, clip_id: str, *, note_id: str | None = None) -> bool:
bool
success or not
"""

note_id = note_id or self._note_id

return await super().add_clips(clip_id=clip_id, note_id=note_id)
Expand All @@ -1103,7 +1100,6 @@ async def create_renote(self, *, note_id: str | None = None) -> Note:
Note
Renoted note
"""

note_id = note_id or self._note_id

return await super().create_renote(note_id=note_id)
Expand Down Expand Up @@ -1254,7 +1250,6 @@ async def create_quote(
note_id: str | None, default=None
Note IDs to target for renote and citations
"""

note_id = note_id or self._note_id

return await super().create_quote(
Expand Down Expand Up @@ -1969,7 +1964,9 @@ async def get_time_line(
Returns
-------
list[Note]
Notes
Notes
-----
"""
data = {
"limit": limit,
Expand Down
Loading

0 comments on commit ff6836b

Please sign in to comment.