rdflib icon indicating copy to clipboard operation
rdflib copied to clipboard

Marks some doctstrings as raw, to silence a SyntaxWarning about invalid escape sequences.

Open mr-c opened this issue 10 months ago • 1 comments

Summary of changes

This was reported by a Debian user: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1067726

Before

$ python -c 'import rdflib.extras.external_graph_libs'
rdflib/extras/external_graph_libs.py:79: SyntaxWarning: invalid escape sequence '\*'
  """Converts the given graph into a networkx.MultiDiGraph.
rdflib/extras/external_graph_libs.py:136: SyntaxWarning: invalid escape sequence '\*'
  """Converts the given graph into a networkx.DiGraph.
rdflib/extras/external_graph_libs.py:199: SyntaxWarning: invalid escape sequence '\*'
  """Converts the given graph into a networkx.Graph.
$

After:

$ python -c 'import rdflib.extras.external_graph_libs'
$

Checklist

  • [x] Checked that there aren't other open pull requests for the same change.
  • [ ] Checked that all tests and type checking passes.
  • [x] Considered granting push permissions to the PR branch, so maintainers can fix minor issues and keep your PR up to date.

mr-c avatar Mar 27 '24 09:03 mr-c

Coverage Status

coverage: 91.039% (+0.009%) from 91.03% when pulling d67308aa7d1dec653a46db8f8353fa7d3254b15e on mr-c:fix_SyntaxWarning into 959dec532a3844fde874a36c3ab2328f20b681cb on RDFLib:main.

coveralls avatar Jun 17 '24 15:06 coveralls

Coverage Status

coverage: 90.618% (-0.009%) from 90.627% when pulling 8990bb618879e3164aac7c6b10d24d80866ca5a6 on mr-c:fix_SyntaxWarning into 5c6d942163dae6a91c410782ae392e4d312ffd54 on RDFLib:main.

coveralls avatar Jul 24 '24 22:07 coveralls

@mr-c is this PR still needed now? There have been a number of updates to the various syntax checkers in use recently.

Could you please confirm this is still relevant on Debian and, if so, I will merge.

The Debian bug report seems to indicate this is fixed in RDFLib 7.0.0

nicholascar avatar Jul 25 '24 02:07 nicholascar

@mr-c is this PR still needed now? There have been a number of updates to the various syntax checkers in use recently.

Hello, I'm on vacation and away from any computer. Can you run the following on the tip of the development branch? If any warnings print then yes, this PR is still needed.

python -c 'import rdflib.extras.external_graph_libs'

mr-c avatar Jul 25 '24 06:07 mr-c

The Debian bug report seems to indicate this is fixed in RDFLib 7.0.0

It is fixed in the Debian package of rdflib starting with version 6.3.2-1 (the -1 suffix is the version of the Debian package) because we added this patch ☺️ which we still used for rdflib 7.0.0

https://salsa.debian.org/python-team/packages/rdflib/-/blob/debian/debian/patches/silence_SyntaxWarnings.patch?ref_type=heads

A.k.a. https://sources.debian.org/src/rdflib/7.0.0-1/debian/patches/silence_SyntaxWarnings.patch/

mr-c avatar Jul 25 '24 06:07 mr-c

@nicholascar This isn't related to linting, the warning is emitted when Python is configured to print SyntaxWarnings on import of packages. Its technically a bug in the docstrings on the RDFLib external_graph_libs module. Our linters and tests don't pick it up because they have a #noqa: comment on them to silence the linters.

@mr-c This is a nice simple patch, I'll merge it.

ashleysommer avatar Jul 30 '24 22:07 ashleysommer