sibblegp / b2blaze

b2blaze
MIT License
607 stars 32 forks source link

Try/except at import instead of for each function use #12

Closed g-mc closed 6 years ago

g-mc commented 6 years ago

If you were using Python 3, every time you call either of these functions you would be raising an exception by always first looking in the wrong place. This PR modifies the code to do a single check at import time only.

This try/except could also be removed by using six.moves but I wasn't clear on why six was only in requirements.txt but not in setup.py?

from six.moves.urllib.parse import quote, unquote_plus
sibblegp commented 6 years ago

Good idea! Thanks!

sibblegp commented 6 years ago

I'm not as familiar with six. If you want to add it in the right places, I'd be grateful.

g-mc commented 6 years ago

@sibblegp ,

I'd have to take another look at the code but, if I remember correctly, that was one of the only occurrences where it seemed like six could be used. If it was already a project dependency then it is a valid option but if it was only to be used in this one spot, I'm not sure adding it as a dependency is necessary.

I just wasn't sure why it was included in requirements.txt but the dependencies from there didn't seem to be required by setup.py? Are those requirements.txt dependencies only for circleci?

sibblegp commented 6 years ago

I agree this is one of the only applicable spots for six. Unless we find other necessary points, maybe we should just leave it as it is.