PagerDuty / pdpyras

Low-level PagerDuty REST/Events API client for Python
MIT License
129 stars 29 forks source link

escaped ** in comments? #125

Closed kazamatzuri closed 7 months ago

kazamatzuri commented 7 months ago

When pdpyras is being imported as part of a unittest via importlib._bootstrap, we're getting an error:


/pyenv/versions/3.10.8/lib/python3.10/site-packages/_pytest/assertion/rewrite.py:177: in exec_module
--
  | source_stat, co = _rewrite_test(fn, self.config)
  | /pyenv/versions/3.10.8/lib/python3.10/site-packages/_pytest/assertion/rewrite.py:359: in _rewrite_test
  | tree = ast.parse(source, filename=strfn)
  | /pyenv/versions/3.10.8/lib/python3.10/ast.py:50: in parse
  | return compile(source, filename, mode, flags,
  | E     File "/pyenv/versions/3.10.8/lib/python3.10/site-packages/pdpyras.py", line 1078
  | E       """
  | E       ^^^
  | E   SyntaxError: invalid escape sequence '\*'

This is due to in pdpyras.py:1078

:param \*\*kwargs:

Why are the * escaped there?

Deconstrained commented 7 months ago

Thanks for pointing this out. The original reason for that escape sequence was because * is a special character in Restructured Text (how Sphinx interprets docstrings) i.e. *emphasis* = emphasis.

However, I think the double-splat operator renders correctly without escaping in other parts of the codebase, so I'll give it a once-over and make them all consistent. It wasn't originally this way as I recall, but things seem to have changed.

Deconstrained commented 7 months ago

It produces warnings in Sphinx but Sphinx renders them correctly, so I'll make a new release to fix this.

kazamatzuri commented 7 months ago

Awesome, thank you!

Deconstrained commented 7 months ago

Fixed in v5.1.3