You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The test module test_traits.py has two issues with Python escaping:
test_traits.py, lines 60 and 61:
r'var(--my-color-\\1234)', # CSS variable escaped hex character
'var(--my-color-\.)', # CSS variable with escaped characters
Line 60 probably has the issue that \\ in a raw string results in two \ characters. I don't think this is what is intended here. The comment suggests the intention is to specify an escaped hex character, which would be:
r'var(--my-color-\x1234)', # CSS variable escaped hex character
Line 61 has the issue that \ in a non-raw string is interpreted as a Python escape, along with the following character .. This is obviously not a valid Python escape character, and Python issues a SyntaxWarning:
$ python
Python 3.12.7 (main, Oct 1 2024, 02:05:46) [Clang 15.0.0 (clang-1500.3.9.4)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> s = 'var(--my-color-\.)'
<stdin>:1: SyntaxWarning: invalid escape sequence '\.'
I don't think this is what is intended here, but I'm not sure what the solution would be. Maybe just specifying this as a raw string:
r'var(--my-color-\.)', # CSS variable with escaped characters
Reproduce
For reproducing the SyntaxWarning, see above.
I found this when checking for missing dependencies using the 'pip-missing-reqs' command from the 'pip-check-reqs' package:
Create and activate a fresh Python virtual environment
Description
The test module test_traits.py has two issues with Python escaping:
test_traits.py, lines 60 and 61:
Line 60 probably has the issue that
\\
in a raw string results in two\
characters. I don't think this is what is intended here. The comment suggests the intention is to specify an escaped hex character, which would be:Line 61 has the issue that
\
in a non-raw string is interpreted as a Python escape, along with the following character.
. This is obviously not a valid Python escape character, and Python issues a SyntaxWarning:I don't think this is what is intended here, but I'm not sure what the solution would be. Maybe just specifying this as a raw string:
Reproduce
For reproducing the SyntaxWarning, see above.
I found this when checking for missing dependencies using the 'pip-missing-reqs' command from the 'pip-check-reqs' package:
Expected behavior
No SyntaxWarning
Context
Troubleshoot Output
Command Line Output
Browser Output
If using JupyterLab
Installed Labextensions
The text was updated successfully, but these errors were encountered: