azure-devops-cli-extension icon indicating copy to clipboard operation
azure-devops-cli-extension copied to clipboard

Fix SyntaxWarning: invalid escape sequence

Open kevinoid opened this issue 1 year ago • 0 comments

Loading azure-devops/azext_devops/devops_sdk/*/feed/models.py with Python 3.12 produces the following warnings:

/path/to/azure-devops/azext_devops/devops_sdk/v5_0/feed/models.py:101: SyntaxWarning: invalid escape sequence '\,'
  """FeedCore.
/path/to/azure-devops/azext_devops/devops_sdk/v5_0/feed/models.py:209: SyntaxWarning: invalid escape sequence '\,'
  """FeedUpdate.
/path/to/azure-devops/azext_devops/devops_sdk/v5_0/feed/models.py:985: SyntaxWarning: invalid escape sequence '\,'
  """Feed.

This occurs due to the presence of the invalid escape sequence \, in docstrings for FeedCore, FeedUpdate, and Feed, which produces a SyntaxWarning in Python 3.12 as a result of https://github.com/python/cpython/issues/98401.

Unresolved Issues

This PR changes \, to \\,, which avoids the SyntaxWarning, but doesn't fix the ambiguity of what is being communicated: \\, now appears twice in the list. Is the intention to indicate that comma and backslash are illegal? Perhaps ,, or \\,, would be clearer?

Thanks for considering, Kevin

kevinoid avatar May 24 '24 16:05 kevinoid