add type hinting

This commit is contained in:
Abigail Gold 2019-10-15 12:13:49 -04:00
parent 46e389a5dc
commit 018421ae38
No known key found for this signature in database
GPG Key ID: 80A676456AB6B045

View File

@ -16,7 +16,7 @@ from util import cty_json
class LookupCog(commands.Cog): class LookupCog(commands.Cog):
def __init__(self, bot): def __init__(self, bot: commmands.Bot):
self.bot = bot self.bot = bot
self.gs = bot.get_cog("GlobalSettings") self.gs = bot.get_cog("GlobalSettings")
self.CTY = None self.CTY = None
@ -24,12 +24,12 @@ class LookupCog(commands.Cog):
self.up_cty_first_run = True self.up_cty_first_run = True
@commands.command(name="qrz") @commands.command(name="qrz")
async def _qrz_lookup(self, ctx, call: str): async def _qrz_lookup(self, ctx: commands.Context, call: str):
'''Links to info about a callsign from QRZ.''' '''Links to info about a callsign from QRZ.'''
await ctx.send(f'http://qrz.com/db/{call}') await ctx.send(f'http://qrz.com/db/{call}')
@commands.command(name="sat") @commands.command(name="sat")
async def _sat_lookup(self, ctx, sat: str, grid1: str, grid2: str = None): async def _sat_lookup(self, ctx: commands.Context, sat: str, grid1: str, grid2: str = None):
'''Links to info about satellite passes on satmatch.com. '''Links to info about satellite passes on satmatch.com.
Usage: `?sat sat_name grid1 grid2`''' Usage: `?sat sat_name grid1 grid2`'''
now = datetime.utcnow().strftime('%Y-%m-%d%%20%H:%M') now = datetime.utcnow().strftime('%Y-%m-%d%%20%H:%M')
@ -45,7 +45,7 @@ class LookupCog(commands.Cog):
) )
@commands.command(name="dxcc", aliases=['dx']) @commands.command(name="dxcc", aliases=['dx'])
async def _dxcc_lookup(self, ctx, q: str): async def _dxcc_lookup(self, ctx: commands.Context, q: str):
'''Gets info about a prefix.''' '''Gets info about a prefix.'''
with ctx.typing(): with ctx.typing():
noMatch = True noMatch = True
@ -102,7 +102,7 @@ class LookupCog(commands.Cog):
self.up_cty_first_run = False self.up_cty_first_run = False
def setup(bot): def setup(bot: commands.Bot):
lookupcog = LookupCog(bot) lookupcog = LookupCog(bot)
bot.add_cog(lookupcog) bot.add_cog(lookupcog)
lookupcog._update_cty.start() lookupcog._update_cty.start()