summaryrefslogtreecommitdiff
path: root/rdflib/extras/external_graph_libs.py
diff options
context:
space:
mode:
authorGunnar Aastrand Grimnes <gromgull@gmail.com>2018-10-30 14:21:41 +0100
committerGunnar Aastrand Grimnes <gromgull@gmail.com>2018-10-30 15:38:42 +0100
commit785e37932e71a02ab8c31257694060f550ff72a6 (patch)
tree43bc2158ce60168cebe15a0f88ea2aeddb30520d /rdflib/extras/external_graph_libs.py
parentfac8b840627013e1b9bbe76bd75c8e9d5d7b4cdf (diff)
downloadrdflib-785e37932e71a02ab8c31257694060f550ff72a6.tar.gz
a slightly opinionated autopep8 run
opinions is mainly: no to long lines, but not at any cost. notation3.py crashses autopep :D Also rdflib/__init__.py gets completely broken
Diffstat (limited to 'rdflib/extras/external_graph_libs.py')
-rw-r--r--rdflib/extras/external_graph_libs.py20
1 files changed, 12 insertions, 8 deletions
diff --git a/rdflib/extras/external_graph_libs.py b/rdflib/extras/external_graph_libs.py
index 2bb62a18..8617b370 100644
--- a/rdflib/extras/external_graph_libs.py
+++ b/rdflib/extras/external_graph_libs.py
@@ -19,7 +19,9 @@ see ../../test/test_extras_external_graph_libs.py for conditional tests
import logging
logger = logging.getLogger(__name__)
-_identity = lambda x: x
+
+def _identity(x): return x
+
def _rdflib_to_networkx_graph(
graph,
@@ -65,6 +67,7 @@ def _rdflib_to_networkx_graph(
d = edge_attrs(s, p, o)
data['triples'].extend(d['triples'])
+
def rdflib_to_networkx_multidigraph(
graph,
edge_attrs=lambda s, p, o: {'key': p},
@@ -117,6 +120,7 @@ def rdflib_to_networkx_multidigraph(
_rdflib_to_networkx_graph(graph, mdg, False, edge_attrs, **kwds)
return mdg
+
def rdflib_to_networkx_digraph(
graph,
calc_weights=True,
@@ -238,13 +242,13 @@ def rdflib_to_networkx_graph(
def rdflib_to_graphtool(
- graph,
- v_prop_names=[str('term')],
- e_prop_names=[str('term')],
- transform_s=lambda s, p, o: {str('term'): s},
- transform_p=lambda s, p, o: {str('term'): p},
- transform_o=lambda s, p, o: {str('term'): o},
- ):
+ graph,
+ v_prop_names=[str('term')],
+ e_prop_names=[str('term')],
+ transform_s=lambda s, p, o: {str('term'): s},
+ transform_p=lambda s, p, o: {str('term'): p},
+ transform_o=lambda s, p, o: {str('term'): o},
+):
"""Converts the given graph into a graph_tool.Graph().
The subjects and objects are the later vertices of the Graph.