Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 6 commits into from
Jul 30, 2024

Conversation

mr-c
Copy link
Contributor

@mr-c mr-c commented Mar 27, 2024

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

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

…id escape sequences.

Before
``` sh
$ 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:
``` sh
$ python -c 'import rdflib.extras.external_graph_libs'
$
```
@mr-c mr-c force-pushed the fix_SyntaxWarning branch from 7bacbed to bc4d1de Compare March 27, 2024 09:24
@coveralls
Copy link

Coverage Status

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

@coveralls
Copy link

coveralls commented Jul 24, 2024

Coverage Status

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

@nicholascar
Copy link
Member

nicholascar commented Jul 25, 2024

@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

@mr-c
Copy link
Contributor Author

mr-c commented Jul 25, 2024

@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
Copy link
Contributor Author

mr-c commented Jul 25, 2024

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/

@ashleysommer
Copy link
Contributor

@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 ashleysommer merged commit d7b2d25 into RDFLib:main Jul 30, 2024
22 checks passed
@mr-c mr-c deleted the fix_SyntaxWarning branch July 31, 2024 13:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants