summaryrefslogtreecommitdiff
path: root/rdflib/graph.py
diff options
context:
space:
mode:
authorNicholas Car <nicholas.car@surroundaustralia.com>2020-08-27 13:13:45 +1000
committerGitHub <noreply@github.com>2020-08-27 13:13:45 +1000
commit3afffcd19d3a5d240e83b3a59b53e3ee1120c165 (patch)
tree42ba0191f0a8f645cbc5b60aefd8a3cbfc383a8b /rdflib/graph.py
parent3e42f5eea742563cdeab7d655fe55f7d0e25ea16 (diff)
parent94295389204175783c2f369c2826f0ba55a2d42c (diff)
downloadrdflib-improve_graph_parse.tar.gz
Merge branch 'master' into improve_graph_parseimprove_graph_parse
Diffstat (limited to 'rdflib/graph.py')
-rw-r--r--rdflib/graph.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/rdflib/graph.py b/rdflib/graph.py
index 786f193c..49ebcda2 100644
--- a/rdflib/graph.py
+++ b/rdflib/graph.py
@@ -779,13 +779,17 @@ class Graph(Node):
# setup the language filtering
if lang is not None:
if lang == "": # we only want not language-tagged literals
+
def langfilter(l_):
return l_.language is None
+
else:
+
def langfilter(l_):
return l_.language == lang
else: # we don't care about language tags
+
def langfilter(l_):
return True
@@ -1079,9 +1083,11 @@ class Graph(Node):
format = source.content_type
could_not_guess_format = False
if format is None:
- if (hasattr(source, "file")
- and getattr(source.file, "name", None)
- and isinstance(source.file.name, str)):
+ if (
+ hasattr(source, "file")
+ and getattr(source.file, "name", None)
+ and isinstance(source.file.name, str)
+ ):
format = rdflib.util.guess_format(source.file.name)
if format is None:
format = "turtle"