Skip to content

Suppress SyntaxWarning from invalid escape sequence #9322

@JoakimJoensuu

Description

@JoakimJoensuu

Bug description

"""Module docstring"""

from fastcore import script

print(script)

Configuration

No response

Command used

python3.12 -m venv .venv --clear
.venv/bin/python -m pip install pylint fastcore
.venv/bin/pylint file.py

Pylint output

<unknown>:32: SyntaxWarning: invalid escape sequence '\.'
<unknown>:33: SyntaxWarning: invalid escape sequence '\ '

--------------------------------------------------------------------
Your code has been rated at 10.00/10 (previous run: 10.00/10, +0.00)

Expected behavior

No following warnings:

<unknown>:32: SyntaxWarning: invalid escape sequence '\.'
<unknown>:33: SyntaxWarning: invalid escape sequence '\ '

If using Python 3.11, those errors are not raised.

If this is expected behavior, output needs some explanation.

Pylint version

pylint 3.0.3
astroid 3.0.2
Python 3.12.0 (main, Oct 21 2023, 17:44:38) [GCC 9.4.0]

OS / Environment

Ubuntu 20.04.6 LTS

Additional dependencies

astroid==3.0.2
dill==0.3.7
fastcore==1.5.29
isort==5.13.2
mccabe==0.7.0
packaging==23.2
platformdirs==4.1.0
pylint==3.0.3
tomlkit==0.12.3

Extra info

Warning seems to be raised because of these two lines: https://github.com/fastai/fastcore/blob/c9b4c088d3706569c076e7c197c724730be190ab/fastcore/script.py#L32-L33

But it's imported module, so pylint shouldn't raise this warning, right?

Metadata

Metadata

Assignees

No one assigned

    Labels

    AstroidRelated to astroidGood first issueFriendly and approachable by new contributorsMinor 💅Polishing pylint is always niceNeeds PRThis issue is accepted, sufficiently specified and now needs an implementationNeeds astroid updateNeeds an astroid update (probably a release too) before being mergablepython 3.12

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions