From a4d8d1f85557ced37ab41038e9fbd25d6332eebf Mon Sep 17 00:00:00 2001 From: jesopo Date: Wed, 31 Oct 2018 15:12:46 +0000 Subject: Fix some non-explicit None returns, add type hints to important variables --- src/utils/__init__.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/utils/__init__.py') diff --git a/src/utils/__init__.py b/src/utils/__init__.py index f60c199e..d29197df 100644 --- a/src/utils/__init__.py +++ b/src/utils/__init__.py @@ -52,6 +52,7 @@ def from_pretty_time(pretty_time: str) -> typing.Optional[int]: seconds += number if seconds > 0: return seconds + return None UNIT_MINIMUM = 6 UNIT_SECOND = 5 @@ -117,10 +118,12 @@ def bool_or_none(s: str) -> typing.Optional[bool]: return True elif s in IS_FALSE: return False + return None def int_or_none(s: str) -> typing.Optional[int]: stripped_s = s.lstrip("0") if stripped_s.isdigit(): return int(stripped_s) + return None def prevent_highlight(nickname: str) -> str: return nickname[0]+"\u200c"+nickname[1:] -- cgit v1.3.1-10-gc9f91