-
Notifications
You must be signed in to change notification settings - Fork 102
Fixing pep8 issues #65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Regarding #43 - Added PULL_REQUEST_TEMPLATE
Add docker files and update README
I'm not sure what I did that caused some of the older commits to show up here since they were already in master. Any idea? |
Did you try to squash your commits ? |
Simplify github PR template
python_http_client/client.py
Outdated
).encode('utf-8') | ||
params = (kwargs['query_params'] | ||
if 'query_params' in kwargs | ||
else None) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, is there any reason not to just use a regular if/else
here?
if 'query_params' in kwargs:
params = kwargs['query_params']
else:
params = None
Or maybe just an if
?
params = None
if 'query_params' in kwargs:
params = kwargs['query_params']
python_http_client/client.py
Outdated
url = self._build_versioned_url(url) if self._version else self.host + url | ||
url = (self._build_versioned_url(url) | ||
if self._version | ||
else self.host + url) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems like the reason someone would use ternary over a regular if/else
is that it can fit on one line. In this case, the line exceeds the PEP8 recommendation and now it is back to being multi-line... shouldn't this go back to being a regular if/else
?
if self._version:
url = self._build_versioned_url(url)
else:
url = self.host + url
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You make an excellent point. This is why friends don't let friends edit ternary operators in the middle of the night... Will fix. Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
haha no problem!
register.py
Outdated
|
||
output = pypandoc.convert('README.md', 'rst') | ||
f = open('README.txt','w+') | ||
f = open('README.txt', 'w+') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this use a with
statement (also for consistency since with
is also used 12 lines below)?
with open('README.txt', 'w+') as f:
f.write(output)
register.py
Outdated
replacement = '|SendGrid Logo|\n\n.. |SendGrid Logo| image:: https://uiux.s3.amazonaws.com/2016-logos/email-logo%402x.png\n :target: https://www.sendgrid.com' | ||
final_text = readme_rst.replace(replace,replacement) | ||
replace = ('[SendGrid Logo]\n' | ||
'(https://uiux.s3.amazonaws.com/2016-logos/email-logo%402x.png)') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't this what multi-line strings are for?
replace = """\
[SendGrid Logo]
(https://uiux.s3.amazonaws.com/2016-logos/email-logo%402x.png)"""
setup.py
Outdated
@@ -6,12 +6,14 @@ | |||
if os.path.exists('README.txt'): | |||
long_description = open('README.txt').read() | |||
|
|||
|
|||
def getRequires(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PEP8 == snake_case
function names
def get_requires():
register.py
Outdated
replacement = ('|SendGrid Logo|\n\n' | ||
'.. |SendGrid Logo| image:: ' | ||
'https://uiux.s3.amazonaws.com/2016-logos/email-logo%402x.png\n' | ||
' :target: https://www.sendgrid.com') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Too bad a multi-line string couldn't be used quite as well here since the url makes that one line 87 chars long (but no newline characters or extra brackets):
replacement = """\
|SendGrid Logo|
.. |SendGrid Logo| image:: https://uiux.s3.amazonaws.com/2016-logos/email-logo%402x.png
:target: https://www.sendgrid.com"""
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I put a backslash in the multi-line comment to shorten the line. Maybe not the cleanest thing in the world, but I think it works better than the first attempt. Thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah of course! Nice one.
Client can be pickled and unpickled
We can’t merge your PR without the CLA being signed. [ ] Sign the CLA before November 3rd Then we will comment with a link to get your shirt! |
@mbernier @thinkingserious CLA should be good now. Apparently I had one commit that snuck in with my work email, so I needed to fix that. The conflict is probably something that you should resolve right before you merge (just taking out the unused imports in test_unit.py). I think the underlying file is too much of a moving target to keep pulling in and fixing before a merge. |
Awesome, thanks @jlindenger! If you have not already, you can redeem your swag here. Thanks! |
Codecov Report
@@ Coverage Diff @@
## master #65 +/- ##
==========================================
- Coverage 92.22% 92.17% -0.06%
==========================================
Files 6 6
Lines 296 294 -2
==========================================
- Hits 273 271 -2
Misses 23 23
Continue to review full report at Codecov.
|
Hello @jlindenger, |
Fixes #64
Description of the change: I knocked out some quick fixes for your PEP8 issues. There's actually a few more in there than the ones you linked from CodeClimate as well because I just ran flake8 locally using your tox.ini file.
Reason for the change: Conforming to standards for #64