WebHelpers2
WebHelpers2 copied to clipboard
py.test reports deprecations
New py.test reports the following deprecations:
webhelpers2/html/tags.py:656: DeprecationWarning: invalid escape sequence *
webhelpers2/html/tags.py:679: DeprecationWarning: invalid escape sequence *
webhelpers2/html/tags.py:990: DeprecationWarning: invalid escape sequence \w
webhelpers2/html/tags.py:442: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working is_seq = isinstance(values, collections.Sequence)
I think it is easy to fix.
Thank you for maintaining this useful package.
Confirmed errors on Python 3.7. The line numbers are slightly different in the latest dev commit ed4a43, and there's another error in tools.py. Here's my py.test output:
webhelpers2/html/builder.py:234
/home/sluggo/exp/webhelpers/WebHelpers2/webhelpers2/html/builder.py:234: DeprecationWarning: invalid escape sequence \_
"""
webhelpers2/html/tags.py:656
/home/sluggo/exp/webhelpers/WebHelpers2/webhelpers2/html/tags.py:656: DeprecationWarning: invalid escape sequence \*
"""
webhelpers2/html/tags.py:679
/home/sluggo/exp/webhelpers/WebHelpers2/webhelpers2/html/tags.py:679: DeprecationWarning: invalid escape sequence \*
"""
webhelpers2/html/tags.py:990
/home/sluggo/exp/webhelpers/WebHelpers2/webhelpers2/html/tags.py:990: DeprecationWarning: invalid escape sequence \w
"""
webhelpers2/html/tools.py:247
/home/sluggo/exp/webhelpers/WebHelpers2/webhelpers2/html/tools.py:247: DeprecationWarning: invalid escape sequence \w
word_re = re.compile('\w')
webhelpers2/tests/test_modeltags.py::TestModelTagsHelperWithObject::test_select
/home/sluggo/exp/webhelpers/WebHelpers2/webhelpers2/html/tags.py:442: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working
is_seq = isinstance(values, collections.Sequence)
The "abc" issue is straightforward; change the import as above.
The escape errors are due to a change in Python 3.6: "Unrecognized escape sequences produce a DeprecationWarning." (https://docs.python.org/3/reference/lexical_analysis.html#literals) In some future version of Python they will be a SyntaxError." Most of the escapes are in docstrings read by Sphinx; the backslashes are simply to escape ReStructured Text markup characters or a comment about a regex. Change the markup to ReST literals (*
), which is semantically appropriate and gets rid of the troublesome backslashes.
The tools.py issue is an actual regex; convert it to a raw string. Most if not all other regexes in WebHelpers2 are already raw strings. Check all regexes and convert any that aren't raw strings to raw strings if feasible.