Skip to content

Commit

Permalink
Marks some doctstrings as raw, to silence a SyntaxWarning about inval…
Browse files Browse the repository at this point in the history
…id escape sequences. (#2756)

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'
$
```

Co-authored-by: Nicholas Car <[email protected]>
Co-authored-by: Ashley Sommer <[email protected]>
  • Loading branch information
3 people authored Jul 30, 2024
1 parent 5c6d942 commit d7b2d25
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions rdflib/extras/external_graph_libs.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def _rdflib_to_networkx_graph(
def rdflib_to_networkx_multidigraph(
graph: Graph, edge_attrs=lambda s, p, o: {"key": p}, **kwds
):
"""Converts the given graph into a networkx.MultiDiGraph.
r"""Converts the given graph into a networkx.MultiDiGraph.
The subjects and objects are the later nodes of the MultiDiGraph.
The predicates are used as edge keys (to identify multi-edges).
Expand Down Expand Up @@ -119,7 +119,7 @@ def rdflib_to_networkx_multidigraph(
True
>>> mdg.has_edge(a, b, key=1)
True
""" # noqa: W605
"""
import networkx as nx

mdg = nx.MultiDiGraph()
Expand All @@ -133,7 +133,7 @@ def rdflib_to_networkx_digraph(
edge_attrs=lambda s, p, o: {"triples": [(s, p, o)]},
**kwds,
):
"""Converts the given graph into a networkx.DiGraph.
r"""Converts the given graph into a networkx.DiGraph.
As an rdflib.Graph() can contain multiple edges between nodes, by default
adds the a 'triples' attribute to the single DiGraph edge with a list of
Expand Down Expand Up @@ -182,7 +182,7 @@ def rdflib_to_networkx_digraph(
>>> 'triples' in dg[a][b]
False
""" # noqa: W605
"""
import networkx as nx

dg = nx.DiGraph()
Expand All @@ -196,7 +196,7 @@ def rdflib_to_networkx_graph(
edge_attrs=lambda s, p, o: {"triples": [(s, p, o)]},
**kwds,
):
"""Converts the given graph into a networkx.Graph.
r"""Converts the given graph into a networkx.Graph.
As an rdflib.Graph() can contain multiple directed edges between nodes, by
default adds the a 'triples' attribute to the single DiGraph edge with a
Expand Down Expand Up @@ -245,7 +245,7 @@ def rdflib_to_networkx_graph(
False
>>> 'triples' in ug[a][b]
False
""" # noqa: W605
"""
import networkx as nx

g = nx.Graph()
Expand Down

0 comments on commit d7b2d25

Please sign in to comment.