Skip to content
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

[BUG] SyntaxWarning due to invalid escape sequence #35

Open
brostad opened this issue Dec 27, 2023 · 0 comments · May be fixed by #37
Open

[BUG] SyntaxWarning due to invalid escape sequence #35

brostad opened this issue Dec 27, 2023 · 0 comments · May be fixed by #37
Assignees
Labels
bug Something isn't working

Comments

@brostad
Copy link

brostad commented Dec 27, 2023

Describe the bug
After upgrading to python 3.12 pylint started complaining about invalid escape sequence '\w' which I traced to pyaml_env and more precisely to line 58 in parse_config:

 type_tag_pattern = re.compile(f'({type_tag}\w+\s)')

To Reproduce Steps to reproduce the behavior:

  1. Create a test_read.py file with the following content:
"""Test for pyaml_env parse_config call"""
from pyaml_env import parse_config

def read_config():
    """Reads config from the app.yaml file"""
    return parse_config('app.yaml')
  1. Run pylint on this file
(.venv) bernt@work:~/python/projectx$ pylint test_read.py
  1. Results:
<unknown>:58: SyntaxWarning: invalid escape sequence '\w'

Expected behavior pylint shouldn't complain about a valid pattern.

The complaints can be removed by specifying a raw pattern to compile:

 type_tag_pattern = re.compile(fr'({type_tag}\w+\s)')

Additional context

  • Python version 3.12.0
  • OS Fedora 39
@brostad brostad added the bug Something isn't working label Dec 27, 2023
@lukeanderson93 lukeanderson93 linked a pull request Dec 10, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants