Skip to content

Commit

Permalink
💡 Add: _get_index docstring
Browse files Browse the repository at this point in the history
  • Loading branch information
TakumiTsuruta committed Jul 7, 2022
1 parent a8dd095 commit 06c0b2e
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions cogs/trigger.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,15 @@ async def on_message(self, message):
await message.channel.send(embed=embed)

def _get_index(self, target: List[str], value: str) -> Optional[int]:
"""value が target の何番目かを取得する関数です。value が存在しない場合は None を返します。
Args:
target (List[str]): index を調べたい対象のリスト
value (str): index を取得する対象文字列
Returns:
Optional[int]: 存在すれば index(int) を返し、存在しなければ None を返します。
"""
try:
index = target.index(value)
return index
Expand Down

0 comments on commit 06c0b2e

Please sign in to comment.