pallets-eco / blinker

A fast Python in-process signal/event dispatching system.

Home Page:https://blinker.readthedocs.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

DeprecationWarning: invalid escape sequence \*

decaz opened this issue · comments

When running pytest on test suite of my work project I have the following warnings at the end of test run:

.venv/lib/python3.8/site-packages/blinker/base.py:93: 11 warnings
  /usr/lib/publishing/.venv/lib/python3.8/site-packages/blinker/base.py:93: DeprecationWarning: invalid escape sequence \*
    """Connect *receiver* to signal events sent by *sender*.

.venv/lib/python3.8/site-packages/blinker/base.py:161: 11 warnings
  /usr/lib/publishing/.venv/lib/python3.8/site-packages/blinker/base.py:161: DeprecationWarning: invalid escape sequence \*
    """Connect the decorated function as a receiver for *sender*.

.venv/lib/python3.8/site-packages/blinker/base.py:242: 11 warnings
  /usr/lib/publishing/.venv/lib/python3.8/site-packages/blinker/base.py:242: DeprecationWarning: invalid escape sequence \*
    """Emit this signal on behalf of *sender*, passing on \*\*kwargs.

I guess those docstrings should be r"""...""" strings to avoid such warnings. Or \* sequences should be simply replaced by *.

Deps:

  • CPython 3.8.6
  • pytest 6.1.0
  • blinker 1.4

Same thing with pytest, here, with a Flask extension:

usr/lib/python3/dist-packages/blinker/base.py:93
  /usr/lib/python3/dist-packages/blinker/base.py:93: DeprecationWarning: invalid escape sequence \*
    """Connect *receiver* to signal events sent by *sender*.

/usr/lib/python3/dist-packages/blinker/base.py:161
  /usr/lib/python3/dist-packages/blinker/base.py:161: DeprecationWarning: invalid escape sequence \*
    """Connect the decorated function as a receiver for *sender*.

/usr/lib/python3/dist-packages/blinker/base.py:242
  /usr/lib/python3/dist-packages/blinker/base.py:242: DeprecationWarning: invalid escape sequence \*
    """Emit this signal on behalf of *sender*, passing on \*\*kwargs.

-- Docs: https://docs.pytest.org/en/stable/warnings.html

I tried uninstalling blinker with pip, but:

As root or user:

$> pip3 uninstall blinker
Not uninstalling blinker at /usr/lib/python3/dist-packages, outside environment /usr
Can't uninstall 'blinker'. No files were found to uninstall

After that error, I just took it out hard:

As root:

$> cd /usr/lib/python3/dist-packages
$> mv blinker* /tmp

Now the package is gone, and its warnings went with it.

For anyone else looking to eliminate the warnings from pytest, this change hasn't hit a release yet, but you can pip3 install git+https://github.com/jek/blinker/ instead.