Describe the bug
Syntax warnings with Python 3.12.
To Reproduce
In a checkout:
python3.12 -m venv .venv
. .venv/bin/activate
python -m pip install -r requirements.txt
python -B -c 'import onepassword'
Output:
/Users/kam/src/1password-client/onepassword/utils.py:9: SyntaxWarning: invalid escape sequence '\@'
master_password_regex = 'Enter the password for [a-zA-Z0-9._%+-]+\@[a-zA-Z0-9-]+\.[a-zA-z]{2,4} at ' \
/Users/kam/src/1password-client/onepassword/utils.py:10: SyntaxWarning: invalid escape sequence '\.'
'[a-zA-Z0-9-.]+\.1password+\.[a-zA-z]{2,4}'
/Users/kam/src/1password-client/onepassword/utils.py:70: SyntaxWarning: invalid escape sequence '\('
index = p.expect([pexpect.EOF, "\(401\) Unauthorized"])
Note that -B is required to not write bytecode, because once the code is parsed, the warnings don't come again.
Also, Ruff is useful for checking for this and other code gotchas.
❯ ruff check --select W605 --target-version py312
onepassword/utils.py:9:66: W605 [*] Invalid escape sequence: `\@`
onepassword/utils.py:9:81: W605 [*] Invalid escape sequence: `\.`
onepassword/utils.py:10:40: W605 [*] Invalid escape sequence: `\.`
onepassword/utils.py:10:52: W605 [*] Invalid escape sequence: `\.`
onepassword/utils.py:70:45: W605 [*] Invalid escape sequence: `\(`
onepassword/utils.py:70:50: W605 [*] Invalid escape sequence: `\)`
Found 6 errors.
[*] 6 fixable with the `--fix` option.
Expected behavior
No output.
Screenshots
If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
Additional context
See also:
Describe the bug
Syntax warnings with Python 3.12.
To Reproduce
In a checkout:
Output:
Note that
-Bis required to not write bytecode, because once the code is parsed, the warnings don't come again.Also, Ruff is useful for checking for this and other code gotchas.
Expected behavior
No output.
Screenshots
If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
Additional context
See also: