Skip to content

Commit

Permalink
checkpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
aucampia committed Feb 20, 2023
1 parent aa10537 commit 3eac68c
Show file tree
Hide file tree
Showing 5 changed files with 151 additions and 87 deletions.
5 changes: 5 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,11 @@ pep8-naming = ["-N802", "-N806", "-N815"]
pycodestyle = ["-E402"]
[tool.flakeheaven.exceptions."test/utils/namespace/_*"]
pep8-naming = ["-N815"]
[tool.flakeheaven.exceptions."rdflib/plugins/parsers/rdfxml.py"]
pep8-naming = ["-N802"]
[tool.flakeheaven.exceptions."rdflib/plugins/parsers/trix.py"]
pep8-naming = ["-N802"]



[tool.black]
Expand Down
22 changes: 14 additions & 8 deletions rdflib/plugins/parsers/jsonld.py
Original file line number Diff line number Diff line change
Expand Up @@ -460,20 +460,23 @@ def _to_object(
term: Optional[Term],
node: Any,
inlist: bool = False,
):
) -> Optional[Node]:
if isinstance(node, tuple):
value, lang = node
if value is None:
return
# type error: Return value expected
return # type: ignore[return-value]
if lang and " " in lang:
return
# type error: Return value expected
return # type: ignore[return-value]
return Literal(value, lang=lang)

if isinstance(node, dict):
node_list = context.get_list(node)
if node_list is not None:
if inlist and not self.allow_lists_of_lists:
return
# type error: Return value expected
return # type: ignore[return-value]
listref = self._add_list(dataset, graph, context, term, node_list)
if listref:
return listref
Expand All @@ -483,7 +486,8 @@ def _to_object(
if term.type == JSON:
node = self._to_typed_json_value(node)
elif node is None:
return
# type error: Return value expected
return # type: ignore[return-value]
elif term.type == ID and isinstance(node, str):
node = {ID: context.resolve(node)}
elif term.type == VOCAB and isinstance(node, str):
Expand All @@ -492,7 +496,8 @@ def _to_object(
node = {TYPE: term.type, VALUE: node}
else:
if node is None:
return
# type error: Return value expected
return # type: ignore[return-value]
if isinstance(node, float):
return Literal(node, datatype=XSD.double)

Expand All @@ -516,7 +521,8 @@ def _to_object(
return None
if lang:
if " " in lang:
return
# type error: Return value expected
return # type: ignore[return-value]
return Literal(value, lang=lang)
elif datatype:
return Literal(value, datatype=context.expand(datatype))
Expand Down Expand Up @@ -549,7 +555,7 @@ def _add_list(
context: Context,
term: Optional[Term],
node_list: Any,
):
) -> IdentifiedNode:
if not isinstance(node_list, list):
node_list = [node_list]

Expand Down
Loading

0 comments on commit 3eac68c

Please sign in to comment.