Repository navigation
Fix a number of Deprecated/Invalid escape sequences - #7925
Conversation
| from __future__ import (absolute_import, division, print_function, | ||
| unicode_literals) | ||
|
|
||
|
|
There was a problem hiding this comment.
Sorry, autopep8 script doing more than asked.
| else: | ||
| pstoeps(tmpfile) | ||
|
|
||
|
|
| looked up from the registry key:: | ||
|
|
||
| \\HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\Fonts | ||
| \\HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders\\Fonts |
There was a problem hiding this comment.
The first one is supposed to be doubled, so it should be 4 when escaped, but maybe it'd be simpler to make it a raw string instead?
There was a problem hiding this comment.
Oh.. ok, I did not remembered \\ was a thing on windows.
| ('\rightbrace', '}'), | ||
| ('\leftbracket', '['), | ||
| ('\rightbracket', ']'), | ||
| for alias, target in [('\\leftparen', '('), |
There was a problem hiding this comment.
The last ones are raw strings; better to do that for consistency.
| styles. Used to update the documentation. | ||
| """ | ||
| names, attrss, clss = [], [], [] | ||
| ddnames, attrss, clss = [], [], [] |
There was a problem hiding this comment.
Hum.. vim, probably though I was typing in another window.
There was a problem hiding this comment.
though these 3 attributes are not use at all in the function...
| with warnings.catch_warnings(): | ||
| warnings.filterwarnings('ignore', | ||
| message='.*sharex\ argument\ to\ subplots', | ||
| message=r'.*sharex\ argument\ to\ subplots', |
There was a problem hiding this comment.
What is \ ? I don't think this escape even means anything in a regular expression.
| warnings.filterwarnings( | ||
| 'ignore', | ||
| ('findfont: Font family \[u?\'Foo\'\] not found. Falling back to .'), | ||
| r'findfont: Font family \[u?\'Foo\'\] not found. Falling back to .', |
There was a problem hiding this comment.
I think the internal quotes no longer need to be escaped here now.
There was a problem hiding this comment.
Use double quotes instead?
There was a problem hiding this comment.
Err, actually, I don't know what I was thinking here, but the internal quotes still need to be escaped unless using double quotes as @anntzer suggested.
There was a problem hiding this comment.
@Carreau As mentioned just above, can you switch to double quotes and remove the backslashes in the inner single quotes here?
|
|
||
| # Python 3.6 deprecate invalid character-pairs \A, \* ... in non raw-strings | ||
| # and other things. Let's not re-introduce them | ||
| warnings.filterwarnings('error', category=DeprecationWarning) |
There was a problem hiding this comment.
Though I prefer not to introduce any deprecations either, this seems a bit broad for this PR.
Current coverage is 62.18% (diff: 100%)@@ master #7925 diff @@
==========================================
Files 175 175
Lines 56125 56125
Methods 0 0
Messages 0 0
Branches 0 0
==========================================
Hits 34901 34901
Misses 21224 21224
Partials 0 0
|
|
|
||
| # The warnings need to be before any of matplotlib imports, but after | ||
| # setuptools (if present) which has syntax error with the warnings enabled. | ||
| # Filtering by module does not work as this will be raise by Python itself. |
c24f837 to
ff6afaf
Compare
|
Rebased to remove conflicts. |
|
Rebased again and use backtick |
| 'default', | ||
| '.*inspect.getargspec\(\) is deprecated.*', | ||
| category=DeprecationWarning) | ||
|
|
There was a problem hiding this comment.
This only gets executed when running tests.py, and I think most tests have been migrated to pytest now. Is there a way to make pytest execute these filterwarnings calls?
There was a problem hiding this comment.
Yes. It's supposed to get folded into Pytest itself at some point.
|
|
||
| / - diagonal hatching | ||
| \ - back diagonal | ||
| \\ - back diagonal |
There was a problem hiding this comment.
This one worries me as it is something I would expect to be read either on the web or in the terminal. Probably better to make this a r''' string?
There was a problem hiding this comment.
and I may be wrong here, escaping always ties me in knots....
There was a problem hiding this comment.
Done. I can't rebuild matplotlib today apparently, so can't test the html versions.
There was a problem hiding this comment.
Actually I managed to build the docs, and the \ in Accept below needed to be escaped more.
That should be fixed.
And turn python 3.6 DeprecationWarnings into error during tests. Python 3.6 deprecate invalid escape sequences, as they are (most of the time) mistakes from the author. This introduce extra `\` when necessary, or make strings `raw`. See matplotlib#7924
| for each member. | ||
| ACCEPTS: [ '/' | '\\\\' | '|' | '-' | '+' | 'x' | 'o' | 'O' | '.' | '*' ] | ||
| ACCEPTS: [ '/' | '\\' | '|' | '-' | '+' | 'x' | 'o' | 'O' | '.' | '*' ] |
There was a problem hiding this comment.
It appears that this line is under 79 characters and this file now passes PEP8, so it needs to be removed from lib/matplotlib/tests/test_coding_standards.py because the build is failing.
There was a problem hiding this comment.
Also, since you're going to have to push an update, I cancelled the OSX build which has been waiting for a while because we've got a long backlog.
| warnings.filterwarnings( | ||
| 'ignore', | ||
| ('findfont: Font family \[u?\'Foo\'\] not found. Falling back to .'), | ||
| r'findfont: Font family \[u?\'Foo\'\] not found. Falling back to .', |
There was a problem hiding this comment.
@Carreau As mentioned just above, can you switch to double quotes and remove the backslashes in the inner single quotes here?
|
Thanks @Carreau |
|
Thanks !
…On Wed, Feb 1, 2017 at 4:31 PM, Nelle Varoquaux ***@***.***> wrote:
Merged #7925 <#7925>.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#7925 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAUez9dEJtH0NYiDiahyH0-bRrjJIZd8ks5rYSP1gaJpZM4Lqj9->
.
|
And turn python 3.6 DeprecationWarnings into error during tests.
Python 3.6 deprecate invalid escape sequences, as they are (most of the
time) mistakes from the author. This introduce extra
\when necessary,or make strings
raw.See #7924