Apply pyupgrade and refurb suggestions#352
Apply pyupgrade and refurb suggestions#352DimitriPapadopoulos wants to merge 2 commits intopython-versioneer:masterpython-versioneer/python-versioneer:masterfrom DimitriPapadopoulos:pyupgradeDimitriPapadopoulos/python-versioneer:pyupgradeCopy head branch name to clipboard
Conversation
| @@ -1,4 +1,3 @@ | ||
|
|
There was a problem hiding this comment.
This whitespace is significant.
There was a problem hiding this comment.
That's what I suspected, but it's not clear why. Is additional code added in front of it?
There was a problem hiding this comment.
Yes, these files are compiled into the single-file versioneer.py file.
There was a problem hiding this comment.
The alternative would be to add the extra line when compiling the versioneer.py file in setup.py. But then, why change something that works?
There was a problem hiding this comment.
Fixed, but I still need to look into the files under test.
ac8e499 to
3ba033b
Compare
effigies
left a comment
There was a problem hiding this comment.
All seems fine. Some small suggestions, but I'm okay to merge as-is.
| f.write(SHORT_VERSION_PY.format(contents)) | ||
|
|
||
| print("set %s to '%s'" % (filename, versions["version"])) | ||
| print("set {} to '{}'".format(filename, versions["version"])) |
There was a problem hiding this comment.
Might as well use an f-string if we're here.
| print("set {} to '{}'".format(filename, versions["version"])) | |
| print(f"set {filename} to {versions['version']:r}") |
There was a problem hiding this comment.
But then we're modifying functionality, by changing '%s' to {...} instead of '{...}', aren't we?
There was a problem hiding this comment.
Also, I suspect you meant !r instead of :r. It will call repr(), but then how is that helpful?
>>> i = 2
>>>
>>> f"We print 'i' as '{i}'"
"We print 'i' as '2'"
>>>
>>> f"We print 'i' as {i!r}"
"We print 'i' as 2"
>>> We might use triple quotes instead:
f"""set {filename} to '{versions["version"]}'"""But then it gets unreadable.
|
I still need to fix these I believe this See for example what the Linux kernel coding style has to say about it:
|
Use f-strings wherever possible.
* [FURB109]: Replace `in [x, y, z]` with `in (x, y, z)`
a07d0fd to
f3846e0
Compare
No description provided.