-
-
Notifications
You must be signed in to change notification settings - Fork 942
Python 3.6 invalid escape sequence deprecation fixes #607
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
Codecov Report
@@ Coverage Diff @@
## master #607 +/- ##
=========================================
+ Coverage 94.48% 94.5% +0.02%
=========================================
Files 63 63
Lines 9961 9961
=========================================
+ Hits 9412 9414 +2
+ Misses 549 547 -2
Continue to review full report at Codecov.
|
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.
Instead of using
def f():
r""" \docstring """
could the slashes just be escaped properly?
def f():
""" \\docstring """
It just seems a lot more natural in a docstring context.
Done. |
@@ -391,7 +391,7 @@ def __init__(self, repo, name): | |||
|
|||
def __getattr__(self, attr): | |||
"""Allows to call this instance like | |||
remote.special( \*args, \*\*kwargs) to call git-remote special self.name""" | |||
remote.special( \\*args, \\*\\*kwargs) to call git-remote special self.name""" |
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.
Why not use a raw string here? (I am fairly new to Python, so this is a question seeking a real answer if there is an answer, not a passive aggressive question)
It seems like a raw string would lend itself well to docstrings, even in the case below, where (I believe) there are embedded unicode code points, since it may be easier to copy and paste.
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.
Typically you don't see docstrings being raw strings.
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.
Does it negatively effect their use as docstrings?
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 you might want to have the docstring be WYSIWYG, and the raw string appears to be meant for that, to me... But like I said, I am fairly new, so if I am missing something, I am happy to listen.
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 don't have any say in this repo so I don't mind either way. Just a preference and for homogeneity.
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.
BTW, FWIW and all that, I don't know why the asterisks in this particular docstring are backslash escaped in the first place.
@scop I am very sorry for the delay, and thanks a lot for making this PR! I had a look at the link you provided, but was unable to understand the relation to this PR. Could you briefly explain the problem it is solving? My intuition is that the docstrings look incorrect when rendered. |
The problem solved is a deprecation warning with Python 3.6 (run the code with -Wd to see them), and as noted in the link, sometime in the future code with such invalid escape sequences will stop working (compiling) completely. |
Great, thanks a lot! |
https://docs.python.org/3/whatsnew/3.6.html#deprecated-python-behavior