Skip to content

Commit

Permalink
feat: docstringを追加
Browse files Browse the repository at this point in the history
  • Loading branch information
yupix committed Mar 4, 2024
1 parent e495856 commit 2b032ac
Show file tree
Hide file tree
Showing 6 changed files with 332 additions and 0 deletions.
28 changes: 28 additions & 0 deletions mipac/models/ad.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,44 @@ def __init__(self, ad_data: IAd, *, client: ClientManager) -> None:

@property
def expires_at(self) -> datetime:
"""いつ広告が終了するか
Returns
-------
datetime
いつ広告が終了するか
"""
return str_to_datetime(self._raw_ad["expires_at"])

@property
def starts_at(self) -> datetime:
"""いつ広告が開始するか
Returns
-------
datetime
いつ広告が開始するか
"""
return str_to_datetime(self._raw_ad["starts_at"])

@property
def priority(self) -> Literal["high" "middle" "low"]:

Check warning on line 41 in mipac/models/ad.py

View workflow job for this annotation

GitHub Actions / Qodana Community for Python

Invalid type hints definitions and usages

'Literal' may be parameterized with literal ints, byte and unicode strings, bools, Enum values, None, other literal types, or type aliases to other literal types
"""広告の優先度
Returns
-------
Literal["high" "middle" "low"]
広告の優先度
"""
return self._raw_ad["priority"]

@property
def memo(self) -> str | None:
"""広告のメモ
Returns
-------
str | None
広告のメモ
"""
return self._raw_ad["memo"]
37 changes: 37 additions & 0 deletions mipac/models/announcement.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,37 @@ def __init__(self, announcement: IAnnouncement, *, client: ClientManager) -> Non

@property
def id(self) -> str:
"""アナウンスのID
Returns
-------
str
アナウンスのID
"""
return self.__announcement["id"]

@property
def created_at(self) -> datetime:
"""アナウンスが作成された日時
Returns
-------
datetime
アナウンスが作成された日時
"""
return str_to_datetime(self.__announcement["created_at"])

@property
def updated_at(self) -> datetime | None:
"""アナウンスが更新された日時
Noneの場合は、アナウンスが更新されていないことを示します。
Returns
-------
datetime | None
アナウンスが更新された日時
"""
return (
str_to_datetime(self.__announcement["updated_at"])
if self.__announcement["updated_at"]
Expand All @@ -39,10 +62,24 @@ def updated_at(self) -> datetime | None:

@property
def text(self) -> str:
"""アナウンスの内容
Returns
-------
str
アナウンスの内容
"""
return self.__announcement["text"]

@property
def title(self) -> str:
"""アナウンスのタイトル
Returns
-------
str
アナウンスのタイトル
"""
return self.__announcement["title"]

@property
Expand Down
35 changes: 35 additions & 0 deletions mipac/models/antenna.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,57 @@ def __init__(self, antenna: IAntenna, *, client: ClientManager) -> None:

@property
def id(self) -> str:
"""アンテナのID
Returns
-------
str
アンテナのID
"""
return self.__antenna["id"]

@property
def created_at(self) -> datetime:
"""アンテナの作成日時
Returns
-------
datetime
アンテナの作成日時
"""
return str_to_datetime(self.__antenna["created_at"])

@property
def name(self) -> str:
"""アンテナ名
Returns
-------
str
アンテナ名
"""
return self.__antenna["name"]

@property
def keywords(self) -> list[str]:
"""キーワード
Returns
-------
list[str]
キーワード
"""
return self.__antenna["keywords"]

@property
def exclude_keywords(self) -> list[str]:
"""除外キーワード
Returns
-------
list[str]
除外キーワード
"""
return self.__antenna["exclude_keywords"]

@property
Expand Down
Loading

0 comments on commit 2b032ac

Please sign in to comment.