Skip to content

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

Merged
merged 1 commit into from
Apr 9, 2017
Merged

Python 3.6 invalid escape sequence deprecation fixes #607

merged 1 commit into from
Apr 9, 2017

Conversation

scop
Copy link
Contributor

@scop scop commented Mar 9, 2017

@codecov-io
Copy link

codecov-io commented Mar 9, 2017

Codecov Report

Merging #607 into master will increase coverage by 0.02%.
The diff coverage is 75%.

@@            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
Impacted Files Coverage Δ
git/test/test_tree.py 100% <ø> (ø)
git/test/test_repo.py 97.47% <ø> (+0.33%)
git/test/test_submodule.py 99.22% <ø> (ø)
git/test/test_index.py 97.36% <ø> (ø)
git/test/lib/helper.py 91.86% <0%> (ø)
git/remote.py 92.97% <100%> (ø)
git/test/test_git.py 98.7% <100%> (ø)
git/config.py 92.76% <100%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8dffba5...5d429f7. Read the comment docs.

Copy link

@sethmlarson sethmlarson left a 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.

@scop
Copy link
Contributor Author

scop commented Mar 10, 2017

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"""
Copy link

@isaacsanders isaacsanders Mar 23, 2017

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.

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.

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?

Copy link

@isaacsanders isaacsanders Mar 23, 2017

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.

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.

Copy link
Contributor Author

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.

@Byron
Copy link
Member

Byron commented Apr 9, 2017

@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.

@scop
Copy link
Contributor Author

scop commented Apr 9, 2017

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.

@Byron Byron added this to the v2.1.4 - Bugfixes milestone Apr 9, 2017
@Byron Byron merged commit 32da7fe into gitpython-developers:master Apr 9, 2017
@Byron
Copy link
Member

Byron commented Apr 9, 2017

Great, thanks a lot!

@scop scop deleted the py36esc branch April 10, 2017 09:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

5 participants