IRCServer.Server.get_user should be 'typing.Optional[IRCUser.User]', not just

'IRCUser.user'
This commit is contained in:
jesopo 2018-11-21 20:18:12 +00:00
parent 5001e47af9
commit 3061c65024

View file

@ -182,7 +182,8 @@ class Server(IRCObject.Object):
def has_user(self, nickname: str) -> bool:
return utils.irc.lower(self.case_mapping, nickname) in self.users
def get_user(self, nickname: str, create: bool=True) -> IRCUser.User:
def get_user(self, nickname: str, create: bool=True
) -> typing.Optional[IRCUser.User]:
if not self.has_user(nickname) and create:
user_id = self.get_user_id(nickname)
new_user = IRCUser.User(nickname, user_id, self, self.bot)