Skip to content
This repository was archived by the owner on Mar 14, 2021. It is now read-only.

Conversation

supposedly
Copy link

@supposedly supposedly commented Mar 23, 2018

With @ShawSumma

Pipfile Outdated
aiohttp = "*"
aiodns = "*"
bs4 = "*"
html2text = "*"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You have edited the Pipfile directly, and in a way that will break discord.py. Please revert your Pipfile and read over the doc/ folder again.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't believe we'd had this change to the Pipfile PR'd yet, because I don't remember deleting the aiohttp/websockets lines. But also -- doesn't discord.py itself pin these two deps in its own requirements.txt?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does pin aiohttp and websockets, but Pipenv doesn't pick up on it correctly if they aren't specified directly in the pipfile. You also can't just use the latest version of aiohttp, it's not compatible.

I make a PR this morning, maybe check that out.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gotcha, & just saw that! I'll fix all this as soon as I get home.

self.secs_query = API + 'parse&prop=sections&page={}'
self.img_query = API + 'query&titles={}&prop=pageimages&pithumbsize=300'

async def get_snek(self, name: str = None) -> Dict[str, Any]:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you remove the type hinting?

Copy link
Author

@supposedly supposedly Mar 23, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry. My partner was for a short while only able to use python 3.5 (and typing was added in 3.6) so I started removing hints preemptively for compatibility -- didn't take care to put them all back once he was able to get on 3.6, though.

@command()
async def get(self, ctx: Context, name: str = None):
@commands.command()
async def get(self, ctx, name: str.title = None):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You removed the type hinting for ctx. This will break things. Also, you can't type hint str.title.

Copy link
Author

@supposedly supposedly Mar 23, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

huh, what would the Context typehint do and/or break? (are you folks running a type checker?)

The str.title typehint is a converter -- see Rapptz/discord.py#1064 (bad pr on my part but it's there) and the documentation on converters. Converting to str is in fact redundant as far as ext.commands is concerned.

[BUT: I've also just realized I don't even want to convert with str.title(), because Wikipedia articles are titled in This case. Oops]

Copy link
Contributor

@gdude2002 gdude2002 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually not too bad overall.

@@ -1,300 +0,0 @@
{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file does need to be in the repo.

import re
from typing import Any, Dict

from discord.ext.commands import AutoShardedBot, Context, command
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not keep it like this? Seems cleaner than what you did below

from discord.ext import commands
from discord.ext.commands import Context

from .. import hardcoded
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do not use relative imports please.

'&prop=pageimages|categories'
'&pithumbsize=300'
f"&cllimit=max&clcategories={'|'.join(hardcoded.categories)}"
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe unindent this paren one level?

name = await self.get_rand_snek()

async with self.session.get(self.base_query.format(name)) as pg_resp, \
self.session.get(self.info_query.format(name)) as if_resp: # noqa
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What error are you squelching here? Indentation?

@supposedly supposedly force-pushed the master branch 5 times, most recently from 5a015eb to 22d874c Compare March 26, 2018 00:00
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants