# Path: desertbot/message.py
# class IRCMessage(object):
#     def __init__(self, msgType: str, user: IRCUser, channel: Optional[IRCChannel], message: str, bot: 'DesertBot',
#                  metadata: Dict=None, tags: Dict=None):
#         if metadata is None:
#             metadata = {}
#         self.metadata = metadata
#         if tags is None:
#             tags = {}
#         self.tags = tags
# 
#         if isinstance(message, bytes):
#             unicodeMessage = message.decode('utf-8', 'ignore')
#         else:  # Already utf-8?
#             unicodeMessage = message
#         self.type = msgType
#         self.messageList = unicodeMessage.strip().split(' ')
#         self.messageString = unicodeMessage
#         self.user = user
# 
#         self.channel = None
#         if channel is None:
#             self.replyTo = self.user.nick
#             self.targetType = TargetTypes.USER
#         else:
#             self.channel = channel
#             # I would like to set this to the channel object but I would probably break functionality if I did :I
#             self.replyTo = channel.name
#             self.targetType = TargetTypes.CHANNEL
# 
#         self.command = ''
#         self.parameters = ''
#         self.parameterList = []
# 
#         if len(self.messageList) == 1 and self.messageList[0] == bot.commandChar:
#             self.command = ''
#         elif self.messageList[0].startswith(bot.commandChar) and self.messageList[0][:3].count(bot.commandChar) == 1:
#             self.command = self.messageList[0][len(bot.commandChar):]
#             if self.command == '':
#                 self.command = self.messageList[1]
#                 self.parameters = u' '.join(self.messageList[2:])
#             else:
#                 self.parameters = u' '.join(self.messageList[1:])
#         elif re.match('{}[:,]?'.format(re.escape(bot.nick)), self.messageList[0], re.IGNORECASE):
#             if len(self.messageList) > 1:
#                 self.command = self.messageList[1]
#                 self.parameters = u' '.join(self.messageList[2:])
#         self.command = self.command.lower()
#         if self.parameters.strip():
#             self.parameterList = self.parameters.split(' ')
# 
#             self.parameterList = [param for param in self.parameterList if param != '']
# 
#             if len(self.parameterList) == 1 and not self.parameterList[0]:
#                 self.parameterList = []
# 
# Path: desertbot/modules/commandinterface.py
# class BotCommand(BotModule):
#     def __init__(self):
#         BotModule.__init__(self)
#         self.triggerHelp = {}
# 
#     def triggers(self):
#         return []
# 
#     def actions(self) -> List[Tuple[str, int, Callable]]:
#         return super(BotCommand, self).actions() + [('botmessage', 1, self.handleCommand)]
# 
#     def onLoad(self) -> None:
#         pass
# 
#     def displayHelp(self, query: List[str]) -> str:
#         lowQuery = query[0].lower()
#         if lowQuery in self.triggers() or lowQuery == self.__class__.__name__.lower():
#             return self.help(query)
# 
#     def help(self, query: Union[List[str], None]) -> str:
#         if query is not None and query[0].lower() in self.triggerHelp:
#             return self.triggerHelp[query[0].lower()]
#         return super(BotCommand, self).help(query)
# 
#     def checkPermissions(self, message: IRCMessage) -> bool:
#         for owner in self.bot.config.getWithDefault('owners', []):
#             if self._checkUserPermission(message, owner):
#                 return True
#         for admin in self.bot.config.getWithDefault('admins', []):
#             if self._checkUserPermission(message, admin):
#                 return True
#         return False
# 
#     def _checkUserPermission(self, message, hostmask):
#         if hostmask.startswith('R:'):
#             accountName = hostmask[2:]
#             if 'account' in message.tags:
#                 return message.tags['account'] == accountName
#             else:
#                 return message.user.account == accountName
#         if fnmatch(message.user.fullUserPrefix(), hostmask):
#             return True
#         return False
# 
#     def handleCommand(self, message: IRCMessage) -> Optional[IRCResponse]:
#         if not self.shouldExecute(message):
#             return
# 
#         try:
#             return self.execute(message)
#         except Exception as e:
#             self.logger.exception("Python execution error while running command {!r}"
#                                   .format(message.command))
#             errorText = ("Python execution error while running command {!r}: {}: {}"
#                          .format(message.command, type(e).__name__, str(e)))
#             self.bot.output.cmdPRIVMSG(message.replyTo, errorText)
# 
#             self.bot.reraiseIfDebug(e)
# 
#     def shouldExecute(self, message: IRCMessage) -> bool:
#         if message.command.lower() not in [t.lower() for t in self.triggers()]:
#             return False
# 
#         return True
# 
#     def execute(self, message: IRCMessage) -> Union[IRCResponse, List[IRCResponse]]:
#         return IRCResponse('<command not yet implemented>', message.replyTo)
# 
# Path: desertbot/response.py
# class IRCResponse(object):
#     type = ResponseType.Say
#     response = ''
#     target = ''
# 
#     def __init__(self, response: Union[str, bytes], target: Union[str, bytes],
#                  messageType: ResponseType = ResponseType.Say, metadata: Dict = None):
#         if metadata is None:
#             metadata = {}
#         self.type = messageType
#         try:
#             self.response = str(response, 'utf-8')
#         except TypeError:  # Already utf-8?
#             self.response = response
#         try:
#             self.target = str(target, 'utf-8')
#         except TypeError:  # Already utf-8?
#             self.target = target
# 
#         # remove CTCP chars and other stuff that breaks messages
#         if not self.type == ResponseType.Raw:
#             self.response = self.response.replace('\x01', '').replace('\r', '').replace('\n', ' ')
# 
#         self.Metadata = metadata


import time
    import re2
    import re as re2
from typing import List, Union, Dict
from desertbot.message import IRCMessage
from desertbot.modules.commandinterface import BotCommand
from desertbot.response import IRCResponse


try:
except ImportError:


class BaseWeatherCommand(BotCommand):
    def __init__(self, name, subCommands):

# Path: desertbot/message.py
# class IRCMessage(object):
#     def __init__(self, msgType: str, user: IRCUser, channel: Optional[IRCChannel], message: str, bot: 'DesertBot',
#                  metadata: Dict=None, tags: Dict=None):
#         if metadata is None:
#             metadata = {}
#         self.metadata = metadata
#         if tags is None:
#             tags = {}
#         self.tags = tags
# 
#         if isinstance(message, bytes):
#             unicodeMessage = message.decode('utf-8', 'ignore')
#         else:  # Already utf-8?
#             unicodeMessage = message
#         self.type = msgType
#         self.messageList = unicodeMessage.strip().split(' ')
#         self.messageString = unicodeMessage
#         self.user = user
# 
#         self.channel = None
#         if channel is None:
#             self.replyTo = self.user.nick
#             self.targetType = TargetTypes.USER
#         else:
#             self.channel = channel
#             # I would like to set this to the channel object but I would probably break functionality if I did :I
#             self.replyTo = channel.name
#             self.targetType = TargetTypes.CHANNEL
# 
#         self.command = ''
#         self.parameters = ''
#         self.parameterList = []
# 
#         if len(self.messageList) == 1 and self.messageList[0] == bot.commandChar:
#             self.command = ''
#         elif self.messageList[0].startswith(bot.commandChar) and self.messageList[0][:3].count(bot.commandChar) == 1:
#             self.command = self.messageList[0][len(bot.commandChar):]
#             if self.command == '':
#                 self.command = self.messageList[1]
#                 self.parameters = u' '.join(self.messageList[2:])
#             else:
#                 self.parameters = u' '.join(self.messageList[1:])
#         elif re.match('{}[:,]?'.format(re.escape(bot.nick)), self.messageList[0], re.IGNORECASE):
#             if len(self.messageList) > 1:
#                 self.command = self.messageList[1]
#                 self.parameters = u' '.join(self.messageList[2:])
#         self.command = self.command.lower()
#         if self.parameters.strip():
#             self.parameterList = self.parameters.split(' ')
# 
#             self.parameterList = [param for param in self.parameterList if param != '']
# 
#             if len(self.parameterList) == 1 and not self.parameterList[0]:
#                 self.parameterList = []
# 
# Path: desertbot/modules/commandinterface.py
# class BotCommand(BotModule):
#     def __init__(self):
#         BotModule.__init__(self)
#         self.triggerHelp = {}
# 
#     def triggers(self):
#         return []
# 
#     def actions(self) -> List[Tuple[str, int, Callable]]:
#         return super(BotCommand, self).actions() + [('botmessage', 1, self.handleCommand)]
# 
#     def onLoad(self) -> None:
#         pass
# 
#     def displayHelp(self, query: List[str]) -> str:
#         lowQuery = query[0].lower()
#         if lowQuery in self.triggers() or lowQuery == self.__class__.__name__.lower():
#             return self.help(query)
# 
#     def help(self, query: Union[List[str], None]) -> str:
#         if query is not None and query[0].lower() in self.triggerHelp:
#             return self.triggerHelp[query[0].lower()]
#         return super(BotCommand, self).help(query)
# 
#     def checkPermissions(self, message: IRCMessage) -> bool:
#         for owner in self.bot.config.getWithDefault('owners', []):
#             if self._checkUserPermission(message, owner):
#                 return True
#         for admin in self.bot.config.getWithDefault('admins', []):
#             if self._checkUserPermission(message, admin):
#                 return True
#         return False
# 
#     def _checkUserPermission(self, message, hostmask):
#         if hostmask.startswith('R:'):
#             accountName = hostmask[2:]
#             if 'account' in message.tags:
#                 return message.tags['account'] == accountName
#             else:
#                 return message.user.account == accountName
#         if fnmatch(message.user.fullUserPrefix(), hostmask):
#             return True
#         return False
# 
#     def handleCommand(self, message: IRCMessage) -> Optional[IRCResponse]:
#         if not self.shouldExecute(message):
#             return
# 
#         try:
#             return self.execute(message)
#         except Exception as e:
#             self.logger.exception("Python execution error while running command {!r}"
#                                   .format(message.command))
#             errorText = ("Python execution error while running command {!r}: {}: {}"
#                          .format(message.command, type(e).__name__, str(e)))
#             self.bot.output.cmdPRIVMSG(message.replyTo, errorText)
# 
#             self.bot.reraiseIfDebug(e)
# 
#     def shouldExecute(self, message: IRCMessage) -> bool:
#         if message.command.lower() not in [t.lower() for t in self.triggers()]:
#             return False
# 
#         return True
# 
#     def execute(self, message: IRCMessage) -> Union[IRCResponse, List[IRCResponse]]:
#         return IRCResponse('<command not yet implemented>', message.replyTo)
# 
# Path: desertbot/response.py
# class IRCResponse(object):
#     type = ResponseType.Say
#     response = ''
#     target = ''
# 
#     def __init__(self, response: Union[str, bytes], target: Union[str, bytes],
#                  messageType: ResponseType = ResponseType.Say, metadata: Dict = None):
#         if metadata is None:
#             metadata = {}
#         self.type = messageType
#         try:
#             self.response = str(response, 'utf-8')
#         except TypeError:  # Already utf-8?
#             self.response = response
#         try:
#             self.target = str(target, 'utf-8')
#         except TypeError:  # Already utf-8?
#             self.target = target
# 
#         # remove CTCP chars and other stuff that breaks messages
#         if not self.type == ResponseType.Raw:
#             self.response = self.response.replace('\x01', '').replace('\r', '').replace('\n', ' ')
# 
#         self.Metadata = metadata


# Path: desertbot/modules/commands/weather/BaseWeatherCommand.py
import time
    import re2
    import re as re2
from typing import List, Union, Dict
from desertbot.message import IRCMessage
from desertbot.modules.commandinterface import BotCommand
from desertbot.response import IRCResponse



try:
except ImportError:


class BaseWeatherCommand(BotCommand):
    def __init__(self, name, subCommands):

        BotCommand.__init__(self)