netaddr / netaddr

A network address manipulation library for Python

Home Page:https://netaddr.readthedocs.io/en/latest/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

invalid escape sequence in ip\nmap.py

HansAarneLiblik opened this issue · comments

After upgrading to v0.10.0 our pytest (with coverage) fails

  File "/app/.venv/lib/python3.11/site-packages/netaddr/__init__.py", line 31, in <module>
    from netaddr.ip.nmap import valid_nmap_range, iter_nmap_range
  File "/app/.venv/lib/python3.11/site-packages/netaddr/ip/nmap.py", line 105
    """
    ^^^
SyntaxError: invalid escape sequence '\*'

It seems like :param \*nmap_target_spec: is not a valid docstring

valid_nmap_range has proper docstring

image

iter_nmap_range does not have a proper docstring (as you can't escape the asterisk with backslash)

image

I think you need to use :param nmap_target_spec: instead of :param \*nmap_target_spec:

Thank you, fixed in #331 and released in 0.10.1 just now.

While that may fix the syntax warning, the IDE docstring would still be incorrect. IMO you need to drop the asterisk all together

Thanks for the note, it looks all right to me.