summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>2023-03-11 12:40:15 +0000
committerGitHub <noreply@github.com>2023-03-11 12:40:15 +0000
commitfcfa4950426719ef62e231147f5fa098f58272c6 (patch)
tree575a35171b078bc8ccfcc3cdc9b0bf534bf40429
parent90cb2e91dcc9fe663e932c12b5995ac80255293d (diff)
downloadrdflib-fcfa4950426719ef62e231147f5fa098f58272c6.tar.gz
build(deps-dev): bump black from 22.12.0 to 23.1.0 (#2248)
-rw-r--r--.pre-commit-config.yaml2
-rw-r--r--docs/developers.rst2
-rw-r--r--poetry.lock44
-rw-r--r--pyproject.toml4
-rw-r--r--rdflib/collection.py1
-rw-r--r--rdflib/compare.py2
-rw-r--r--rdflib/container.py4
-rw-r--r--rdflib/extras/infixowl.py2
-rw-r--r--rdflib/graph.py8
-rw-r--r--rdflib/namespace/__init__.py3
-rw-r--r--rdflib/paths.py1
-rw-r--r--rdflib/plugins/parsers/jsonld.py1
-rwxr-xr-xrdflib/plugins/parsers/notation3.py3
-rw-r--r--rdflib/plugins/parsers/rdfxml.py5
-rw-r--r--rdflib/plugins/parsers/trig.py3
-rw-r--r--rdflib/plugins/parsers/trix.py2
-rw-r--r--rdflib/plugins/serializers/longturtle.py2
-rw-r--r--rdflib/plugins/serializers/n3.py1
-rw-r--r--rdflib/plugins/serializers/rdfxml.py4
-rw-r--r--rdflib/plugins/serializers/trig.py1
-rw-r--r--rdflib/plugins/serializers/trix.py1
-rw-r--r--rdflib/plugins/serializers/turtle.py5
-rw-r--r--rdflib/plugins/shared/jsonld/context.py1
-rw-r--r--rdflib/plugins/sparql/algebra.py3
-rw-r--r--rdflib/plugins/sparql/evaluate.py12
-rw-r--r--rdflib/plugins/sparql/evalutils.py1
-rw-r--r--rdflib/plugins/sparql/operators.py11
-rw-r--r--rdflib/plugins/sparql/results/csvresults.py2
-rw-r--r--rdflib/plugins/sparql/results/graph.py1
-rw-r--r--rdflib/plugins/sparql/results/jsonresults.py1
-rw-r--r--rdflib/plugins/sparql/results/rdfresults.py2
-rw-r--r--rdflib/plugins/sparql/results/tsvresults.py1
-rw-r--r--rdflib/plugins/sparql/sparql.py2
-rw-r--r--rdflib/plugins/sparql/update.py3
-rw-r--r--rdflib/plugins/stores/concurrent.py2
-rw-r--r--rdflib/plugins/stores/sparqlstore.py1
-rw-r--r--rdflib/query.py2
-rw-r--r--rdflib/term.py7
-rw-r--r--rdflib/tools/csv2rdf.py3
-rw-r--r--rdflib/tools/rdf2dot.py1
-rw-r--r--rdflib/tools/rdfpipe.py1
-rw-r--r--rdflib/void.py2
-rw-r--r--test/data/suites/trix/test_trix.py1
-rw-r--r--test/test_conjunctivegraph/test_conjunctive_graph.py1
-rw-r--r--test/test_conjunctivegraph/test_conjunctivegraph_operator_combinations.py5
-rw-r--r--test/test_dataset/test_dataset.py3
-rw-r--r--test/test_dataset/test_dataset_generators.py1
-rw-r--r--test/test_extras/test_infixowl/test_annotatableterms.py3
-rw-r--r--test/test_extras/test_infixowl/test_basic.py1
-rw-r--r--test/test_extras/test_infixowl/test_booleanclass.py8
-rw-r--r--test/test_extras/test_infixowl/test_class.py2
-rw-r--r--test/test_extras/test_infixowl/test_componentterms.py3
-rw-r--r--test/test_extras/test_infixowl/test_context.py1
-rw-r--r--test/test_extras/test_infixowl/test_cover.py2
-rw-r--r--test/test_extras/test_infixowl/test_enumerated_class.py1
-rw-r--r--test/test_extras/test_infixowl/test_individual.py5
-rw-r--r--test/test_extras/test_infixowl/test_logic_structuring.py1
-rw-r--r--test/test_extras/test_infixowl/test_manchester_syntax.py1
-rw-r--r--test/test_extras/test_infixowl/test_ontology.py2
-rw-r--r--test/test_extras/test_infixowl/test_property.py1
-rw-r--r--test/test_extras/test_infixowl/test_restriction.py16
-rw-r--r--test/test_extras/test_infixowl/test_rubric.py1
-rw-r--r--test/test_graph/test_graph_http.py1
-rw-r--r--test/test_graph/test_namespace_rebinding.py7
-rw-r--r--test/test_issues/test_issue161.py1
-rw-r--r--test/test_issues/test_issue545.py1
-rw-r--r--test/test_issues/test_issue604.py1
-rw-r--r--test/test_issues/test_issue_git_200.py1
-rw-r--r--test/test_issues/test_issue_git_336.py1
-rw-r--r--test/test_literal/test_xmlliterals.py1
-rw-r--r--test/test_misc/test_conventions.py1
-rw-r--r--test/test_misc/test_input_source.py3
-rw-r--r--test/test_n3.py1
-rw-r--r--test/test_parsers/test_broken_parse_data_from_jena.py1
-rw-r--r--test/test_parsers/test_parser_helpers.py1
-rw-r--r--test/test_parsers/test_trix_parse.py3
-rw-r--r--test/test_roundtrip.py10
-rw-r--r--test/test_serializers/test_prettyxml.py2
-rw-r--r--test/test_serializers/test_serializer_trix.py1
-rw-r--r--test/test_serializers/test_serializer_xml.py2
-rw-r--r--test/test_serializers/test_xmlwriter_qname.py5
-rw-r--r--test/test_sparql/test_expressions.py4
-rw-r--r--test/test_sparql/test_prepare.py2
-rw-r--r--test/test_sparql/test_sparql.py2
-rw-r--r--test/test_store/test_store_auditable.py4
-rw-r--r--test/test_trig.py2
-rw-r--r--test/test_turtle_sort_issue613.py3
-rw-r--r--test/test_util.py2
-rw-r--r--test/test_w3c_spec/test_n3_w3c.py1
-rw-r--r--test/utils/__init__.py1
-rw-r--r--test/utils/earl.py1
-rw-r--r--test/utils/httpfileserver.py2
-rw-r--r--test/utils/manifest.py2
93 files changed, 52 insertions, 237 deletions
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index b9e93047..6e05165b 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -18,7 +18,7 @@ repos:
- repo: https://github.com/psf/black
# WARNING: version should be the same as in `pyproject.toml`
# Using git ref spec because of https://github.com/psf/black/issues/2493
- rev: 'refs/tags/22.12.0:refs/tags/22.12.0'
+ rev: 'refs/tags/23.1.0:refs/tags/23.1.0'
hooks:
- id: black
pass_filenames: false
diff --git a/docs/developers.rst b/docs/developers.rst
index 89fedb33..0eb73c1a 100644
--- a/docs/developers.rst
+++ b/docs/developers.rst
@@ -10,7 +10,7 @@ This document describes the process and conventions to follow when
developing RDFLib code.
* Please be as Pythonic as possible (:pep:`8`).
-* Code should be formatted using `black <https://github.com/psf/black>`_ and we use Black v22.12.0, with the black config in ``pyproject.toml``.
+* Code should be formatted using `black <https://github.com/psf/black>`_ and we use Black v23.1.0, with the black config in ``pyproject.toml``.
* Code should also pass `flake8 <https://flake8.pycqa.org/en/latest/>`_ linting
and `mypy <http://mypy-lang.org/>`_ type checking.
* You must supply tests for new code.
diff --git a/poetry.lock b/poetry.lock
index 7af1c4a3..9ab027a4 100644
--- a/poetry.lock
+++ b/poetry.lock
@@ -59,32 +59,46 @@ files = [
[[package]]
name = "black"
-version = "22.12.0"
+version = "23.1.0"
description = "The uncompromising code formatter."
category = "dev"
optional = false
python-versions = ">=3.7"
files = [
- {file = "black-22.12.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9eedd20838bd5d75b80c9f5487dbcb06836a43833a37846cf1d8c1cc01cef59d"},
- {file = "black-22.12.0-cp310-cp310-win_amd64.whl", hash = "sha256:159a46a4947f73387b4d83e87ea006dbb2337eab6c879620a3ba52699b1f4351"},
- {file = "black-22.12.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d30b212bffeb1e252b31dd269dfae69dd17e06d92b87ad26e23890f3efea366f"},
- {file = "black-22.12.0-cp311-cp311-win_amd64.whl", hash = "sha256:7412e75863aa5c5411886804678b7d083c7c28421210180d67dfd8cf1221e1f4"},
- {file = "black-22.12.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c116eed0efb9ff870ded8b62fe9f28dd61ef6e9ddd28d83d7d264a38417dcee2"},
- {file = "black-22.12.0-cp37-cp37m-win_amd64.whl", hash = "sha256:1f58cbe16dfe8c12b7434e50ff889fa479072096d79f0a7f25e4ab8e94cd8350"},
- {file = "black-22.12.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:77d86c9f3db9b1bf6761244bc0b3572a546f5fe37917a044e02f3166d5aafa7d"},
- {file = "black-22.12.0-cp38-cp38-win_amd64.whl", hash = "sha256:82d9fe8fee3401e02e79767016b4907820a7dc28d70d137eb397b92ef3cc5bfc"},
- {file = "black-22.12.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:101c69b23df9b44247bd88e1d7e90154336ac4992502d4197bdac35dd7ee3320"},
- {file = "black-22.12.0-cp39-cp39-win_amd64.whl", hash = "sha256:559c7a1ba9a006226f09e4916060982fd27334ae1998e7a38b3f33a37f7a2148"},
- {file = "black-22.12.0-py3-none-any.whl", hash = "sha256:436cc9167dd28040ad90d3b404aec22cedf24a6e4d7de221bec2730ec0c97bcf"},
- {file = "black-22.12.0.tar.gz", hash = "sha256:229351e5a18ca30f447bf724d007f890f97e13af070bb6ad4c0a441cd7596a2f"},
+ {file = "black-23.1.0-cp310-cp310-macosx_10_16_arm64.whl", hash = "sha256:b6a92a41ee34b883b359998f0c8e6eb8e99803aa8bf3123bf2b2e6fec505a221"},
+ {file = "black-23.1.0-cp310-cp310-macosx_10_16_universal2.whl", hash = "sha256:57c18c5165c1dbe291d5306e53fb3988122890e57bd9b3dcb75f967f13411a26"},
+ {file = "black-23.1.0-cp310-cp310-macosx_10_16_x86_64.whl", hash = "sha256:9880d7d419bb7e709b37e28deb5e68a49227713b623c72b2b931028ea65f619b"},
+ {file = "black-23.1.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e6663f91b6feca5d06f2ccd49a10f254f9298cc1f7f49c46e498a0771b507104"},
+ {file = "black-23.1.0-cp310-cp310-win_amd64.whl", hash = "sha256:9afd3f493666a0cd8f8df9a0200c6359ac53940cbde049dcb1a7eb6ee2dd7074"},
+ {file = "black-23.1.0-cp311-cp311-macosx_10_16_arm64.whl", hash = "sha256:bfffba28dc52a58f04492181392ee380e95262af14ee01d4bc7bb1b1c6ca8d27"},
+ {file = "black-23.1.0-cp311-cp311-macosx_10_16_universal2.whl", hash = "sha256:c1c476bc7b7d021321e7d93dc2cbd78ce103b84d5a4cf97ed535fbc0d6660648"},
+ {file = "black-23.1.0-cp311-cp311-macosx_10_16_x86_64.whl", hash = "sha256:382998821f58e5c8238d3166c492139573325287820963d2f7de4d518bd76958"},
+ {file = "black-23.1.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2bf649fda611c8550ca9d7592b69f0637218c2369b7744694c5e4902873b2f3a"},
+ {file = "black-23.1.0-cp311-cp311-win_amd64.whl", hash = "sha256:121ca7f10b4a01fd99951234abdbd97728e1240be89fde18480ffac16503d481"},
+ {file = "black-23.1.0-cp37-cp37m-macosx_10_16_x86_64.whl", hash = "sha256:a8471939da5e824b891b25751955be52ee7f8a30a916d570a5ba8e0f2eb2ecad"},
+ {file = "black-23.1.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8178318cb74f98bc571eef19068f6ab5613b3e59d4f47771582f04e175570ed8"},
+ {file = "black-23.1.0-cp37-cp37m-win_amd64.whl", hash = "sha256:a436e7881d33acaf2536c46a454bb964a50eff59b21b51c6ccf5a40601fbef24"},
+ {file = "black-23.1.0-cp38-cp38-macosx_10_16_arm64.whl", hash = "sha256:a59db0a2094d2259c554676403fa2fac3473ccf1354c1c63eccf7ae65aac8ab6"},
+ {file = "black-23.1.0-cp38-cp38-macosx_10_16_universal2.whl", hash = "sha256:0052dba51dec07ed029ed61b18183942043e00008ec65d5028814afaab9a22fd"},
+ {file = "black-23.1.0-cp38-cp38-macosx_10_16_x86_64.whl", hash = "sha256:49f7b39e30f326a34b5c9a4213213a6b221d7ae9d58ec70df1c4a307cf2a1580"},
+ {file = "black-23.1.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:162e37d49e93bd6eb6f1afc3e17a3d23a823042530c37c3c42eeeaf026f38468"},
+ {file = "black-23.1.0-cp38-cp38-win_amd64.whl", hash = "sha256:8b70eb40a78dfac24842458476135f9b99ab952dd3f2dab738c1881a9b38b753"},
+ {file = "black-23.1.0-cp39-cp39-macosx_10_16_arm64.whl", hash = "sha256:a29650759a6a0944e7cca036674655c2f0f63806ddecc45ed40b7b8aa314b651"},
+ {file = "black-23.1.0-cp39-cp39-macosx_10_16_universal2.whl", hash = "sha256:bb460c8561c8c1bec7824ecbc3ce085eb50005883a6203dcfb0122e95797ee06"},
+ {file = "black-23.1.0-cp39-cp39-macosx_10_16_x86_64.whl", hash = "sha256:c91dfc2c2a4e50df0026f88d2215e166616e0c80e86004d0003ece0488db2739"},
+ {file = "black-23.1.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2a951cc83ab535d248c89f300eccbd625e80ab880fbcfb5ac8afb5f01a258ac9"},
+ {file = "black-23.1.0-cp39-cp39-win_amd64.whl", hash = "sha256:0680d4380db3719ebcfb2613f34e86c8e6d15ffeabcf8ec59355c5e7b85bb555"},
+ {file = "black-23.1.0-py3-none-any.whl", hash = "sha256:7a0f701d314cfa0896b9001df70a530eb2472babb76086344e688829efd97d32"},
+ {file = "black-23.1.0.tar.gz", hash = "sha256:b0bd97bea8903f5a2ba7219257a44e3f1f9d00073d6cc1add68f0beec69692ac"},
]
[package.dependencies]
click = ">=8.0.0"
mypy-extensions = ">=0.4.3"
+packaging = ">=22.0"
pathspec = ">=0.9.0"
platformdirs = ">=2"
-tomli = {version = ">=1.1.0", markers = "python_full_version < \"3.11.0a7\""}
+tomli = {version = ">=1.1.0", markers = "python_version < \"3.11\""}
typed-ast = {version = ">=1.4.2", markers = "python_version < \"3.8\" and implementation_name == \"cpython\""}
typing-extensions = {version = ">=3.10.0.0", markers = "python_version < \"3.10\""}
@@ -1487,4 +1501,4 @@ networkx = ["networkx"]
[metadata]
lock-version = "2.0"
python-versions = "^3.7"
-content-hash = "40828a95b5dfb75366ae3973d448beb58e91322491928da6ef265b7a0e42aac1"
+content-hash = "d49edf98b285b3e44ee553a95842211bdfc910b99ab289b12a2106009e09deae"
diff --git a/pyproject.toml b/pyproject.toml
index e6c9931d..8e9348f3 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -41,7 +41,7 @@ html5lib = {version = "^1.0", optional = true}
lxml = {version = "^4.3.0", optional = true}
[tool.poetry.group.dev.dependencies]
-black = "22.12.0"
+black = "23.1.0"
isort = "^5.10.0"
mypy = "1.0.1"
lxml-stubs = "^0.4.0"
@@ -111,7 +111,7 @@ pep8-naming = ["-N802"]
pep8-naming = ["-N802"]
[tool.black]
-required-version = "22.12.0"
+required-version = "23.1.0"
line-length = "88"
target-version = ['py37']
include = '\.pyi?$'
diff --git a/rdflib/collection.py b/rdflib/collection.py
index 952e2c83..5246184d 100644
--- a/rdflib/collection.py
+++ b/rdflib/collection.py
@@ -232,7 +232,6 @@ class Collection(object):
return self
def __iadd__(self, other):
-
end = self._end()
self.graph.remove((end, RDF.rest, None))
diff --git a/rdflib/compare.py b/rdflib/compare.py
index a7e6eb03..4b8473c7 100644
--- a/rdflib/compare.py
+++ b/rdflib/compare.py
@@ -619,7 +619,7 @@ def similar(g1: Graph, g2: Graph):
def _squashed_graphs_triples(g1: Graph, g2: Graph):
- for (t1, t2) in zip(sorted(_squash_graph(g1)), sorted(_squash_graph(g2))):
+ for t1, t2 in zip(sorted(_squash_graph(g1)), sorted(_squash_graph(g2))):
yield t1, t2
diff --git a/rdflib/container.py b/rdflib/container.py
index e9077e25..b5c0ebd5 100644
--- a/rdflib/container.py
+++ b/rdflib/container.py
@@ -64,10 +64,8 @@ class Container(object):
self.graph.add((self.uri, RDF.type, RDF[self._rtype]))
def n3(self):
-
items = []
for i in range(len(self)):
-
v = self[i + 1]
items.append(v)
@@ -163,7 +161,6 @@ class Container(object):
return l_
def end(self): #
-
# find end index (1-based) of container
container = self.uri
@@ -194,7 +191,6 @@ class Container(object):
container = self.uri
for item in other:
-
end += 1
self._len += 1
elem_uri = str(RDF) + "_" + str(end)
diff --git a/rdflib/extras/infixowl.py b/rdflib/extras/infixowl.py
index ae99d0c3..f4daab77 100644
--- a/rdflib/extras/infixowl.py
+++ b/rdflib/extras/infixowl.py
@@ -1979,7 +1979,7 @@ class Restriction(Class):
)
def restrictionKind(self): # noqa: N802
- for (s, p, o) in self.graph.triples_choices(
+ for s, p, o in self.graph.triples_choices(
(self.identifier, self.restrictionKinds, None)
):
return p.split(str(OWL))[-1]
diff --git a/rdflib/graph.py b/rdflib/graph.py
index d3fa7fdc..56119e43 100644
--- a/rdflib/graph.py
+++ b/rdflib/graph.py
@@ -638,7 +638,6 @@ class Graph(Node):
"""
if isinstance(item, slice):
-
s, p, o = item.start, item.stop, item.step
if s is None and p is None and o is None:
return self.triples((s, p, o))
@@ -659,7 +658,6 @@ class Graph(Node):
return (s, p, o) in self
elif isinstance(item, (Path, Node)):
-
return self.predicate_objects(item)
else:
@@ -741,7 +739,7 @@ class Graph(Node):
retval = type(self)()
except TypeError:
retval = Graph()
- for (prefix, uri) in set(list(self.namespaces()) + list(other.namespaces())):
+ for prefix, uri in set(list(self.namespaces()) + list(other.namespaces())):
retval.bind(prefix, uri)
for x in self:
retval.add(x)
@@ -2548,7 +2546,7 @@ class Seq(object):
self._list: List[Tuple[int, _ObjectType]]
_list = self._list = list()
LI_INDEX = URIRef(str(RDF) + "_") # noqa: N806
- for (p, o) in graph.predicate_objects(subject):
+ for p, o in graph.predicate_objects(subject):
# type error: "Node" has no attribute "startswith"
if p.startswith(LI_INDEX): # type: ignore[attr-defined] # != RDF.Seq:
# type error: "Node" has no attribute "replace"
@@ -2764,7 +2762,7 @@ class ReadOnlyGraphAggregate(ConjunctiveGraph):
# type error: Argument 1 to "triples_choices" of "Graph" has incompatible type "Tuple[Union[List[Node], Node], Union[Node, List[Node]], Union[Node, List[Node]]]"; expected "Union[Tuple[List[Node], Node, Node], Tuple[Node, List[Node], Node], Tuple[Node, Node, List[Node]]]"
# type error note: unpacking discards type info
choices = graph.triples_choices((subject, predicate, object_)) # type: ignore[arg-type]
- for (s, p, o) in choices:
+ for s, p, o in choices:
yield s, p, o
def qname(self, uri: str) -> str:
diff --git a/rdflib/namespace/__init__.py b/rdflib/namespace/__init__.py
index 585ecf30..93f692ad 100644
--- a/rdflib/namespace/__init__.py
+++ b/rdflib/namespace/__init__.py
@@ -488,10 +488,8 @@ class NamespaceManager(object):
return ":".join([qNameParts[0], qNameParts[-1]])
def compute_qname(self, uri: str, generate: bool = True) -> Tuple[str, URIRef, str]:
-
prefix: Optional[str]
if uri not in self.__cache:
-
if not _is_valid_uri(uri):
raise ValueError(
'"{}" does not look like a valid URI, cannot serialize this. Did you want to urlencode it?'.format(
@@ -670,7 +668,6 @@ class NamespaceManager(object):
if bound_namespace:
bound_namespace = URIRef(bound_namespace)
if bound_namespace and bound_namespace != namespace:
-
if replace:
self._store_bind(prefix, namespace, override=override)
insert_trie(self.__trie, str(namespace))
diff --git a/rdflib/paths.py b/rdflib/paths.py
index 9fdd6232..adf87d9c 100644
--- a/rdflib/paths.py
+++ b/rdflib/paths.py
@@ -200,7 +200,6 @@ ZeroOrOne = "?"
@total_ordering
class Path(object):
-
__or__: Callable[["Path", Union["URIRef", "Path"]], "AlternativePath"]
__invert__: Callable[["Path"], "InvPath"]
__neg__: Callable[["Path"], "NegatedPath"]
diff --git a/rdflib/plugins/parsers/jsonld.py b/rdflib/plugins/parsers/jsonld.py
index 8f7e5b88..716b80f4 100644
--- a/rdflib/plugins/parsers/jsonld.py
+++ b/rdflib/plugins/parsers/jsonld.py
@@ -270,7 +270,6 @@ class Parser(object):
reverse: bool = False,
no_id: bool = False,
) -> None:
-
if isinstance(obj, list):
obj_nodes = obj
else:
diff --git a/rdflib/plugins/parsers/notation3.py b/rdflib/plugins/parsers/notation3.py
index 513cc953..25ea0c74 100755
--- a/rdflib/plugins/parsers/notation3.py
+++ b/rdflib/plugins/parsers/notation3.py
@@ -514,7 +514,6 @@ class SinkParser:
self.BadSyntax(s, j, "expected directive or statement")
def directiveOrStatement(self, argstr: str, h: int) -> int:
-
i = self.skipSpace(argstr, h)
if i < 0:
return i # EOF
@@ -680,7 +679,6 @@ class SinkParser:
return -1 # Not a directive, could be something else.
def sparqlDirective(self, argstr: str, i: int) -> int:
-
"""
turtle and trig support BASE/PREFIX without @ and without
terminating .
@@ -1811,7 +1809,6 @@ class Formula(object):
self.existentials[x] = self.newBlankNode()
def close(self) -> QuotedGraph:
-
return self.quotedgraph
diff --git a/rdflib/plugins/parsers/rdfxml.py b/rdflib/plugins/parsers/rdfxml.py
index 1f8e7e68..76775f00 100644
--- a/rdflib/plugins/parsers/rdfxml.py
+++ b/rdflib/plugins/parsers/rdfxml.py
@@ -272,7 +272,7 @@ class RDFXMLHandler(handler.ContentHandler):
# type error: Argument 1 to "join" of "str" has incompatible type "Tuple[Optional[str], str]"; expected "Iterable[str]"
name = URIRef("".join(name)) # type: ignore[assignment, arg-type]
atts = {}
- for (n, v) in attrs.items():
+ for n, v in attrs.items():
if n[0] is None:
att = n[1]
else:
@@ -390,7 +390,6 @@ class RDFXMLHandler(handler.ContentHandler):
# at at top-level
if self.parent.object and self.current != self.stack[2]:
-
self.error(
"Repeat node-elements inside property elements: %s" % "".join(name)
)
@@ -588,7 +587,7 @@ class RDFXMLHandler(handler.ContentHandler):
else:
current.object = "<%s" % name[1]
- for (name, value) in attrs.items():
+ for name, value in attrs.items():
if name[0]:
if not name[0] in current.declared:
current.declared[name[0]] = self._current_context[name[0]]
diff --git a/rdflib/plugins/parsers/trig.py b/rdflib/plugins/parsers/trig.py
index 9e8c8d70..d28198bc 100644
--- a/rdflib/plugins/parsers/trig.py
+++ b/rdflib/plugins/parsers/trig.py
@@ -14,7 +14,6 @@ def becauseSubGraph(*args, **kwargs):
class TrigSinkParser(SinkParser):
def directiveOrStatement(self, argstr: str, h: int) -> int: # noqa: N802
-
# import pdb; pdb.set_trace()
i = self.skipSpace(argstr, h)
@@ -88,7 +87,6 @@ class TrigSinkParser(SinkParser):
self.BadSyntax(argstr, i, "EOF found when expected graph")
if argstr[j : j + 1] == "=": # optional = for legacy support
-
i = self.skipSpace(argstr, j + 1)
if i < 0:
self.BadSyntax(argstr, i, "EOF found when expecting '{'")
@@ -137,7 +135,6 @@ class TrigParser(Parser):
pass
def parse(self, source: InputSource, graph: Graph, encoding: str = "utf-8") -> None:
-
if encoding not in [None, "utf-8"]:
raise Exception(
# type error: Unsupported left operand type for % ("Tuple[str, str]")
diff --git a/rdflib/plugins/parsers/trix.py b/rdflib/plugins/parsers/trix.py
index d1205ac8..187c6d45 100644
--- a/rdflib/plugins/parsers/trix.py
+++ b/rdflib/plugins/parsers/trix.py
@@ -58,7 +58,6 @@ class TriXHandler(handler.ContentHandler):
def startElementNS(
self, name: Tuple[Optional[str], str], qname, attrs: AttributesImpl
) -> None:
-
if name[0] != str(TRIXNS):
self.error(
"Only elements in the TriX namespace are allowed. %s!=%s"
@@ -256,7 +255,6 @@ class TriXHandler(handler.ContentHandler):
def create_parser(store: Store) -> XMLReader:
parser = make_parser()
try:
-
# Workaround for bug in expatreader.py. Needed when
# expatreader is trying to guess a prefix.
# type error: "XMLReader" has no attribute "start_namespace_decl"
diff --git a/rdflib/plugins/serializers/longturtle.py b/rdflib/plugins/serializers/longturtle.py
index 7a106ebb..263604fa 100644
--- a/rdflib/plugins/serializers/longturtle.py
+++ b/rdflib/plugins/serializers/longturtle.py
@@ -33,7 +33,6 @@ _SPACIOUS_OUTPUT = False
class LongTurtleSerializer(RecursiveSerializer):
-
short_name = "longturtle"
indentString = " "
@@ -58,7 +57,6 @@ class LongTurtleSerializer(RecursiveSerializer):
if (prefix > "" and prefix[0] == "_") or self.namespaces.get(
prefix, namespace
) != namespace:
-
if prefix not in self._ns_rewrite:
p = "p" + prefix
while p in self.namespaces:
diff --git a/rdflib/plugins/serializers/n3.py b/rdflib/plugins/serializers/n3.py
index 1135ff9a..6f074f68 100644
--- a/rdflib/plugins/serializers/n3.py
+++ b/rdflib/plugins/serializers/n3.py
@@ -11,7 +11,6 @@ SWAP_LOG = Namespace("http://www.w3.org/2000/10/swap/log#")
class N3Serializer(TurtleSerializer):
-
short_name = "n3"
def __init__(self, store: Graph, parent=None):
diff --git a/rdflib/plugins/serializers/rdfxml.py b/rdflib/plugins/serializers/rdfxml.py
index 0308b516..2bba8b40 100644
--- a/rdflib/plugins/serializers/rdfxml.py
+++ b/rdflib/plugins/serializers/rdfxml.py
@@ -135,7 +135,6 @@ class XMLSerializer(Serializer):
% (indent, qname, attributes, escape(object, ESCAPE_ENTITIES), qname)
)
else:
-
if isinstance(object, BNode):
write('%s<%s rdf:nodeID="%s"/>\n' % (indent, qname, object))
else:
@@ -309,7 +308,6 @@ class PrettyXMLSerializer(Serializer):
writer.text(object)
elif object in self.__serialized or not (object, None, None) in store:
-
if isinstance(object, BNode):
if more_than(store.triples((None, None, object)), 0):
writer.attribute(RDFVOC.nodeID, fix(object))
@@ -337,7 +335,6 @@ class PrettyXMLSerializer(Serializer):
col = Collection(store, object)
for item in col:
-
if isinstance(item, URIRef):
self.forceRDFAbout.add(item)
self.subject(item)
@@ -356,7 +353,6 @@ class PrettyXMLSerializer(Serializer):
self.subject(object, depth + 1)
elif isinstance(object, BNode):
-
if (
object not in self.__serialized
and (object, None, None) in store
diff --git a/rdflib/plugins/serializers/trig.py b/rdflib/plugins/serializers/trig.py
index d4052b29..3b8b2aab 100644
--- a/rdflib/plugins/serializers/trig.py
+++ b/rdflib/plugins/serializers/trig.py
@@ -13,7 +13,6 @@ __all__ = ["TrigSerializer"]
class TrigSerializer(TurtleSerializer):
-
short_name = "trig"
indentString = 4 * " "
diff --git a/rdflib/plugins/serializers/trix.py b/rdflib/plugins/serializers/trix.py
index 1ff9008f..c29a8559 100644
--- a/rdflib/plugins/serializers/trix.py
+++ b/rdflib/plugins/serializers/trix.py
@@ -28,7 +28,6 @@ class TriXSerializer(Serializer):
encoding: Optional[str] = None,
**args,
):
-
nm = self.store.namespace_manager
self.writer = XMLWriter(stream, nm, encoding, extra_ns={"": TRIXNS})
diff --git a/rdflib/plugins/serializers/turtle.py b/rdflib/plugins/serializers/turtle.py
index 21df28ff..ff4cd164 100644
--- a/rdflib/plugins/serializers/turtle.py
+++ b/rdflib/plugins/serializers/turtle.py
@@ -37,7 +37,6 @@ def _object_comparator(a, b):
class RecursiveSerializer(Serializer):
-
topClasses = [RDFS.Class]
predicateOrder = [RDF.type, RDFS.label]
maxDepth = 10
@@ -45,7 +44,6 @@ class RecursiveSerializer(Serializer):
roundtrip_prefixes = ()
def __init__(self, store):
-
super(RecursiveSerializer, self).__init__(store)
self.stream = None
self.reset()
@@ -180,7 +178,6 @@ _SPACIOUS_OUTPUT = False
class TurtleSerializer(RecursiveSerializer):
-
short_name = "turtle"
indentString = " "
@@ -205,7 +202,6 @@ class TurtleSerializer(RecursiveSerializer):
if (prefix > "" and prefix[0] == "_") or self.namespaces.get(
prefix, namespace
) != namespace:
-
if prefix not in self._ns_rewrite:
p = "p" + prefix
while p in self.namespaces:
@@ -278,7 +274,6 @@ class TurtleSerializer(RecursiveSerializer):
try:
parts = self.store.compute_qname(uri, generate=gen_prefix)
except:
-
# is the uri a namespace in itself?
pfx = self.store.store.prefix(uri)
diff --git a/rdflib/plugins/shared/jsonld/context.py b/rdflib/plugins/shared/jsonld/context.py
index 7b2f87f1..23ab6db2 100644
--- a/rdflib/plugins/shared/jsonld/context.py
+++ b/rdflib/plugins/shared/jsonld/context.py
@@ -419,7 +419,6 @@ class Context(object):
referenced_contexts: Set[str],
in_source_url: Optional[str] = None,
):
-
for source in inputs:
source_url = in_source_url
if isinstance(source, str):
diff --git a/rdflib/plugins/sparql/algebra.py b/rdflib/plugins/sparql/algebra.py
index 5f6a774a..5fd9e59b 100644
--- a/rdflib/plugins/sparql/algebra.py
+++ b/rdflib/plugins/sparql/algebra.py
@@ -617,7 +617,6 @@ def translateValues(
if not v.value:
return res
if not isinstance(v.value[0], list):
-
for val in v.value:
res.append({v.var[0]: val})
else:
@@ -821,7 +820,6 @@ def translatePrologue(
initNs: Optional[Mapping[str, Any]] = None,
prologue: Optional[Prologue] = None,
) -> Prologue:
-
if prologue is None:
prologue = Prologue()
prologue.base = ""
@@ -940,7 +938,6 @@ def translateQuery(
P, PV = translate(q[1])
datasetClause = q[1].datasetClause
if q[1].name == "ConstructQuery":
-
template = triples(q[1].template) if q[1].template else None
res = CompValue(q[1].name, p=P, template=template, datasetClause=datasetClause)
diff --git a/rdflib/plugins/sparql/evaluate.py b/rdflib/plugins/sparql/evaluate.py
index 06fc170d..6b8284f9 100644
--- a/rdflib/plugins/sparql/evaluate.py
+++ b/rdflib/plugins/sparql/evaluate.py
@@ -125,7 +125,6 @@ def evalLazyJoin(
def evalJoin(ctx: QueryContext, join: CompValue) -> Generator[FrozenDict, None, None]:
-
# TODO: Deal with dict returned from evalPart from GROUP BY
# only ever for join.p1
@@ -174,7 +173,6 @@ def evalLeftJoin(
_ebv(join.expr, b)
for b in evalPart(ctx.thaw(a.remember(p1_vars)), join.p2)
):
-
yield a
@@ -193,7 +191,6 @@ def evalFilter(
def evalGraph(
ctx: QueryContext, part: CompValue
) -> Generator[FrozenBindings, None, None]:
-
if ctx.dataset is None:
raise Exception(
"Non-conjunctive-graph doesn't know about "
@@ -204,9 +201,7 @@ def evalGraph(
graph = ctx[part.term]
prev_graph = ctx.graph
if graph is None:
-
for graph in ctx.dataset.contexts():
-
# in SPARQL the default graph is NOT a named graph
if graph == ctx.dataset.default_context:
continue
@@ -241,7 +236,6 @@ def evalValues(
def evalMultiset(ctx: QueryContext, part: CompValue):
-
if part.p.name == "values":
return evalValues(ctx, part)
@@ -249,7 +243,6 @@ def evalMultiset(ctx: QueryContext, part: CompValue):
def evalPart(ctx: QueryContext, part: CompValue):
-
# try custom evaluation functions
for name, c in CUSTOM_EVALS.items():
try:
@@ -466,11 +459,9 @@ def evalAggregateJoin(
def evalOrderBy(
ctx: QueryContext, part: CompValue
) -> Generator[FrozenBindings, None, None]:
-
res = evalPart(ctx, part.p)
for e in reversed(part.expr):
-
reverse = bool(e.order and e.order == "DESC")
res = sorted(
res, key=lambda x: _val(value(x, e.expr, variables=True)), reverse=reverse
@@ -547,7 +538,6 @@ def evalProject(ctx: QueryContext, project: CompValue):
def evalSelectQuery(ctx: QueryContext, query: CompValue):
-
res = {}
res["type_"] = "SELECT"
res["bindings"] = evalPart(ctx, query.p)
@@ -621,7 +611,6 @@ def evalDescribeQuery(ctx: QueryContext, query) -> Dict[str, Union[str, Graph]]:
def evalQuery(graph: Graph, query: Query, initBindings, base=None):
-
initBindings = dict((Variable(k), v) for k, v in initBindings.items())
ctx = QueryContext(graph, initBindings=initBindings)
@@ -641,7 +630,6 @@ def evalQuery(graph: Graph, query: Query, initBindings, base=None):
firstDefault = False
for d in main.datasetClause:
if d.default:
-
if firstDefault:
# replace current default graph
dg = ctx.dataset.get_context(BNode())
diff --git a/rdflib/plugins/sparql/evalutils.py b/rdflib/plugins/sparql/evalutils.py
index ebec86df..b5181dbf 100644
--- a/rdflib/plugins/sparql/evalutils.py
+++ b/rdflib/plugins/sparql/evalutils.py
@@ -104,7 +104,6 @@ def _fillTemplate(template, solution):
]
if _s is not None and _p is not None and _o is not None:
-
yield (_s, _p, _o)
diff --git a/rdflib/plugins/sparql/operators.py b/rdflib/plugins/sparql/operators.py
index fe463579..7e9e4d1c 100644
--- a/rdflib/plugins/sparql/operators.py
+++ b/rdflib/plugins/sparql/operators.py
@@ -669,7 +669,6 @@ def default_cast(e: Expr, ctx: FrozenBindings) -> Literal: # type: ignore[retur
x = e.expr[0]
if e.iri == XSD.string:
-
if isinstance(x, (URIRef, Literal)):
return Literal(x, datatype=XSD.string)
else:
@@ -739,7 +738,6 @@ def UnaryPlus(expr: Expr, ctx: FrozenBindings) -> Literal:
def MultiplicativeExpression(
e: Expr, ctx: Union[QueryContext, FrozenBindings]
) -> Literal:
-
expr = e.expr
other = e.other
@@ -768,7 +766,6 @@ def MultiplicativeExpression(
# type error: Missing return statement
def AdditiveExpression(e: Expr, ctx: Union[QueryContext, FrozenBindings]) -> Literal: # type: ignore[return]
-
expr = e.expr
other = e.other
@@ -782,12 +779,10 @@ def AdditiveExpression(e: Expr, ctx: Union[QueryContext, FrozenBindings]) -> Lit
if hasattr(expr, "datatype") and (
expr.datatype in XSD_DateTime_DTs or expr.datatype in XSD_Duration_DTs
):
-
res = dateTimeObjects(expr)
dt = expr.datatype
for op, term in zip(e.op, other):
-
# check if operation is datetime,date,time operation over
# another datetime,date,time datatype
if dt in XSD_DateTime_DTs and dt == term.datatype and op == "-":
@@ -844,7 +839,6 @@ def AdditiveExpression(e: Expr, ctx: Union[QueryContext, FrozenBindings]) -> Lit
def RelationalExpression(e: Expr, ctx: Union[QueryContext, FrozenBindings]) -> Literal:
-
expr = e.expr
other = e.other
op = e.op
@@ -868,7 +862,6 @@ def RelationalExpression(e: Expr, ctx: Union[QueryContext, FrozenBindings]) -> L
)
if op in ("IN", "NOT IN"):
-
res = op == "NOT IN"
error: Union[bool, SPARQLError] = False
@@ -905,7 +898,6 @@ def RelationalExpression(e: Expr, ctx: Union[QueryContext, FrozenBindings]) -> L
raise SPARQLError("I cannot compare this non-node: %r" % other)
if isinstance(expr, Literal) and isinstance(other, Literal):
-
if (
expr.datatype is not None
and expr.datatype not in XSD_DTs
@@ -928,7 +920,6 @@ def RelationalExpression(e: Expr, ctx: Union[QueryContext, FrozenBindings]) -> L
def ConditionalAndExpression(
e: Expr, ctx: Union[QueryContext, FrozenBindings]
) -> Literal:
-
# TODO: handle returned errors
expr = e.expr
@@ -945,7 +936,6 @@ def ConditionalAndExpression(
def ConditionalOrExpression(
e: Expr, ctx: Union[QueryContext, FrozenBindings]
) -> Literal:
-
# TODO: handle errors
expr = e.expr
@@ -1202,7 +1192,6 @@ def EBV(rt: Union[Identifier, SPARQLError, Expr]) -> bool:
"""
if isinstance(rt, Literal):
-
if rt.datatype == XSD.boolean:
return rt.toPython()
diff --git a/rdflib/plugins/sparql/results/csvresults.py b/rdflib/plugins/sparql/results/csvresults.py
index 73f31977..cc99ddf9 100644
--- a/rdflib/plugins/sparql/results/csvresults.py
+++ b/rdflib/plugins/sparql/results/csvresults.py
@@ -24,7 +24,6 @@ class CSVResultParser(ResultParser):
# type error: Signature of "parse" incompatible with supertype "ResultParser"
def parse(self, source: IO, content_type: Optional[str] = None) -> Result: # type: ignore[override]
-
r = Result("SELECT")
# type error: Incompatible types in assignment (expression has type "StreamReader", variable has type "IO[Any]")
@@ -70,7 +69,6 @@ class CSVResultSerializer(ResultSerializer):
raise Exception("CSVSerializer can only serialize select query results")
def serialize(self, stream: IO, encoding: str = "utf-8", **kwargs) -> None:
-
# the serialiser writes bytes in the given encoding
# in py3 csv.writer is unicode aware and writes STRINGS,
# so we encode afterwards
diff --git a/rdflib/plugins/sparql/results/graph.py b/rdflib/plugins/sparql/results/graph.py
index b3492f84..bfd03c00 100644
--- a/rdflib/plugins/sparql/results/graph.py
+++ b/rdflib/plugins/sparql/results/graph.py
@@ -9,7 +9,6 @@ from rdflib.query import Result, ResultParser
class GraphResultParser(ResultParser):
# type error: Signature of "parse" incompatible with supertype "ResultParser"
def parse(self, source: IO, content_type: Optional[str]) -> Result: # type: ignore[override]
-
res = Result("CONSTRUCT") # hmm - or describe?type_)
res.graph = Graph()
res.graph.parse(source, format=content_type)
diff --git a/rdflib/plugins/sparql/results/jsonresults.py b/rdflib/plugins/sparql/results/jsonresults.py
index a5dd7561..ecdb0124 100644
--- a/rdflib/plugins/sparql/results/jsonresults.py
+++ b/rdflib/plugins/sparql/results/jsonresults.py
@@ -33,7 +33,6 @@ class JSONResultSerializer(ResultSerializer):
# type error: Signature of "serialize" incompatible with supertype "ResultSerializer"
def serialize(self, stream: IO, encoding: str = None) -> None: # type: ignore[override]
-
res: Dict[str, Any] = {}
if self.result.type == "ASK":
res["head"] = {}
diff --git a/rdflib/plugins/sparql/results/rdfresults.py b/rdflib/plugins/sparql/results/rdfresults.py
index 97f3f22c..903734f5 100644
--- a/rdflib/plugins/sparql/results/rdfresults.py
+++ b/rdflib/plugins/sparql/results/rdfresults.py
@@ -15,7 +15,6 @@ class RDFResultParser(ResultParser):
class RDFResult(Result):
def __init__(self, source: Union[IO, Graph], **kwargs: Any):
-
if not isinstance(source, Graph):
graph = Graph()
graph.parse(source, **kwargs)
@@ -33,7 +32,6 @@ class RDFResult(Result):
g += graph
else:
-
askAnswer = graph.value(rs, RS.boolean)
if askAnswer is not None:
diff --git a/rdflib/plugins/sparql/results/tsvresults.py b/rdflib/plugins/sparql/results/tsvresults.py
index 3bfce411..02274f26 100644
--- a/rdflib/plugins/sparql/results/tsvresults.py
+++ b/rdflib/plugins/sparql/results/tsvresults.py
@@ -65,7 +65,6 @@ HEADER.parseWithTabs()
class TSVResultParser(ResultParser):
# type error: Signature of "parse" incompatible with supertype "ResultParser" [override]
def parse(self, source: IO, content_type: typing.Optional[str] = None) -> Result: # type: ignore[override]
-
if isinstance(source.read(0), bytes):
# if reading from source returns bytes do utf-8 decoding
# type error: Incompatible types in assignment (expression has type "StreamReader", variable has type "IO[Any]")
diff --git a/rdflib/plugins/sparql/sparql.py b/rdflib/plugins/sparql/sparql.py
index 8a924023..f1b514e5 100644
--- a/rdflib/plugins/sparql/sparql.py
+++ b/rdflib/plugins/sparql/sparql.py
@@ -162,7 +162,6 @@ class FrozenBindings(FrozenDict):
self.ctx = ctx
def __getitem__(self, key: Union[Identifier, str]) -> Identifier:
-
if not isinstance(key, Node):
key = Variable(key)
@@ -320,7 +319,6 @@ class QueryContext(object):
# Unsupported left operand type for + ("None")
self.graph += self.dataset.get_context(source) # type: ignore[operator]
else:
-
if default:
_load(self.graph, source)
else:
diff --git a/rdflib/plugins/sparql/update.py b/rdflib/plugins/sparql/update.py
index 371d4301..887d1add 100644
--- a/rdflib/plugins/sparql/update.py
+++ b/rdflib/plugins/sparql/update.py
@@ -125,7 +125,6 @@ def evalDeleteWhere(ctx, u):
def evalModify(ctx, u):
-
originalctx = ctx
# Using replaces the dataset for evaluating the where-clause
@@ -133,7 +132,6 @@ def evalModify(ctx, u):
otherDefault = False
for d in u.using:
if d.default:
-
if not otherDefault:
# replace current default graph
dg = Graph()
@@ -274,7 +272,6 @@ def evalUpdate(graph, update, initBindings={}):
"""
for u in update.algebra:
-
initBindings = dict((Variable(k), v) for k, v in initBindings.items())
ctx = QueryContext(graph, initBindings=initBindings)
diff --git a/rdflib/plugins/stores/concurrent.py b/rdflib/plugins/stores/concurrent.py
index fd416798..cdf41ba0 100644
--- a/rdflib/plugins/stores/concurrent.py
+++ b/rdflib/plugins/stores/concurrent.py
@@ -58,7 +58,7 @@ class ConcurrentStore(object):
if not (s, p, o) in pending_removes:
yield s, p, o
- for (s, p, o) in self.__pending_adds:
+ for s, p, o in self.__pending_adds:
if (
(su is None or su == s)
and (pr is None or pr == p)
diff --git a/rdflib/plugins/stores/sparqlstore.py b/rdflib/plugins/stores/sparqlstore.py
index 1653b029..a372de79 100644
--- a/rdflib/plugins/stores/sparqlstore.py
+++ b/rdflib/plugins/stores/sparqlstore.py
@@ -816,7 +816,6 @@ class SPARQLUpdateStore(SPARQLStore):
self._timeout = int(timeout)
def _update(self, update):
-
self._updates += 1
SPARQLConnector.update(self, update)
diff --git a/rdflib/query.py b/rdflib/query.py
index 7bb4550d..5211c326 100644
--- a/rdflib/query.py
+++ b/rdflib/query.py
@@ -221,7 +221,6 @@ class Result(object):
"""
def __init__(self, type_: str):
-
if type_ not in ("CONSTRUCT", "DESCRIBE", "SELECT", "ASK"):
raise ResultException("Unknown Result type: %s" % type_)
@@ -252,7 +251,6 @@ class Result(object):
Iterator[Mapping[Variable, Identifier]],
],
) -> None:
-
if isinstance(b, (types.GeneratorType, itertools.islice)):
self._genbindings = b
self._bindings = []
diff --git a/rdflib/term.py b/rdflib/term.py
index 5d1377a6..a42d524a 100644
--- a/rdflib/term.py
+++ b/rdflib/term.py
@@ -610,7 +610,6 @@ class Literal(Identifier):
datatype: Optional[str] = None,
normalize: Optional[bool] = None,
) -> "Literal":
-
if lang == "":
lang = None # no empty lang-tags in RDF
@@ -1090,7 +1089,6 @@ class Literal(Identifier):
if other is None:
return True # Everything is greater than None
if isinstance(other, Literal):
-
if (
self.datatype in _NUMERIC_LITERAL_TYPES
and other.datatype in _NUMERIC_LITERAL_TYPES
@@ -1328,7 +1326,6 @@ class Literal(Identifier):
"""
if isinstance(other, Literal):
-
if (
self.datatype in _NUMERIC_LITERAL_TYPES
and other.datatype in _NUMERIC_LITERAL_TYPES
@@ -1366,13 +1363,11 @@ class Literal(Identifier):
# maybe there are counter examples
if self.value is not None and other.value is not None:
-
if self.datatype in (_RDF_XMLLITERAL, _RDF_HTMLLITERAL):
return _isEqualXMLNode(self.value, other.value)
return self.value == other.value
else:
-
if str.__eq__(self, other):
return True
@@ -2248,7 +2243,7 @@ def _isEqualXMLNode( # noqa: N802
# for the length becomes necessary...
if len(node.childNodes) != len(other.childNodes):
return False
- for (nc, oc) in map(lambda x, y: (x, y), node.childNodes, other.childNodes):
+ for nc, oc in map(lambda x, y: (x, y), node.childNodes, other.childNodes):
if not _isEqualXMLNode(nc, oc):
return False
# if we got here then everything is fine:
diff --git a/rdflib/tools/csv2rdf.py b/rdflib/tools/csv2rdf.py
index 0179629f..2bf7dc86 100644
--- a/rdflib/tools/csv2rdf.py
+++ b/rdflib/tools/csv2rdf.py
@@ -122,7 +122,6 @@ def index(l_, i):
def csv_reader(csv_data, dialect=csv.excel, **kwargs):
-
csv_reader = csv.reader(csv_data, dialect=dialect, **kwargs)
for row in csv_reader:
yield row
@@ -299,7 +298,6 @@ def column(v):
class CSV2RDF(object):
def __init__(self):
-
self.CLASS = None
self.BASE = None
self.PROPBASE = None
@@ -322,7 +320,6 @@ class CSV2RDF(object):
self.triples += 1
def convert(self, csvreader):
-
start = time.time()
if self.OUT:
diff --git a/rdflib/tools/rdf2dot.py b/rdflib/tools/rdf2dot.py
index c59f78b8..1a33ee26 100644
--- a/rdflib/tools/rdf2dot.py
+++ b/rdflib/tools/rdf2dot.py
@@ -87,7 +87,6 @@ def rdf2dot(g, stream, opts={}):
nodes = {}
def node(x):
-
if x not in nodes:
nodes[x] = "node%d" % len(nodes)
return nodes[x]
diff --git a/rdflib/tools/rdfpipe.py b/rdflib/tools/rdfpipe.py
index 5553170a..f9313842 100644
--- a/rdflib/tools/rdfpipe.py
+++ b/rdflib/tools/rdfpipe.py
@@ -31,7 +31,6 @@ def parse_and_serialize(
store_conn="",
store_type=None,
):
-
if store_type:
store = plugin.get(store_type, Store)()
store.open(store_conn)
diff --git a/rdflib/void.py b/rdflib/void.py
index e0ac04f8..ff81e247 100644
--- a/rdflib/void.py
+++ b/rdflib/void.py
@@ -45,7 +45,6 @@ def generateVoID( # noqa: N802
propObjects = collections.defaultdict(set) # noqa: N806
for s, p, o in g:
-
triples += 1
subjects.add(s)
properties.add(p)
@@ -109,7 +108,6 @@ def generateVoID( # noqa: N802
res.add((part, VOID.property, p))
if distinctForPartitions:
-
entities = 0
propClasses = set() # noqa: N806
for s in propSubjects[p]:
diff --git a/test/data/suites/trix/test_trix.py b/test/data/suites/trix/test_trix.py
index e434cdfd..5e553c5c 100644
--- a/test/data/suites/trix/test_trix.py
+++ b/test/data/suites/trix/test_trix.py
@@ -19,7 +19,6 @@ def trix(test: RDFTest):
g = ConjunctiveGraph()
try:
-
base = "https://rdflib.github.io/tests/trix/" + split_uri(test.action)[1]
g.parse(test.action, publicID=base, format="trix")
diff --git a/test/test_conjunctivegraph/test_conjunctive_graph.py b/test/test_conjunctivegraph/test_conjunctive_graph.py
index f26cb77e..54393ac3 100644
--- a/test/test_conjunctivegraph/test_conjunctive_graph.py
+++ b/test/test_conjunctivegraph/test_conjunctive_graph.py
@@ -18,7 +18,6 @@ PUBLIC_ID = "http://example.org/record/1"
def test_bnode_publicid():
-
g = ConjunctiveGraph()
b = BNode()
data = "<d:d> <e:e> <f:f> ."
diff --git a/test/test_conjunctivegraph/test_conjunctivegraph_operator_combinations.py b/test/test_conjunctivegraph/test_conjunctivegraph_operator_combinations.py
index 85204996..dd95dd7b 100644
--- a/test/test_conjunctivegraph/test_conjunctivegraph_operator_combinations.py
+++ b/test/test_conjunctivegraph/test_conjunctivegraph_operator_combinations.py
@@ -7,7 +7,6 @@ sportquadstrig = open(os.path.join(TEST_DATA_DIR, "sportquads.trig")).read()
def test_operators_with_conjunctivegraph_and_graph():
-
cg = ConjunctiveGraph()
cg.add((tarek, likes, pizza))
cg.add((tarek, likes, michel))
@@ -26,7 +25,6 @@ def test_operators_with_conjunctivegraph_and_graph():
def test_reversed_operators_with_conjunctivegraph_and_graph():
-
cg = ConjunctiveGraph()
cg.add((tarek, likes, pizza))
cg.add((tarek, likes, michel))
@@ -45,7 +43,6 @@ def test_reversed_operators_with_conjunctivegraph_and_graph():
def test_reversed_operators_with_conjunctivegraph_with_contexts_and_graph():
-
cg = ConjunctiveGraph()
cg.add((tarek, likes, pizza))
cg.add((tarek, likes, michel))
@@ -67,7 +64,6 @@ def test_reversed_operators_with_conjunctivegraph_with_contexts_and_graph():
def test_operators_with_two_conjunctivegraphs():
-
cg1 = ConjunctiveGraph()
cg1.add([tarek, likes, pizza])
cg1.add([tarek, likes, michel])
@@ -88,7 +84,6 @@ def test_operators_with_two_conjunctivegraphs():
def test_operators_with_two_conjunctivegraphs_one_with_contexts():
-
cg1 = ConjunctiveGraph()
cg1.add([tarek, likes, pizza])
cg1.add([tarek, likes, michel])
diff --git a/test/test_dataset/test_dataset.py b/test/test_dataset/test_dataset.py
index 577e289c..3733a556 100644
--- a/test/test_dataset/test_dataset.py
+++ b/test/test_dataset/test_dataset.py
@@ -108,7 +108,6 @@ def get_dataset(request):
def test_graph_aware(get_dataset):
-
store, dataset = get_dataset
if not dataset.store.graph_aware:
@@ -184,7 +183,6 @@ def test_default_graph(get_dataset):
def test_not_union(get_dataset):
-
store, dataset = get_dataset
# Union depends on the SPARQL endpoint configuration
if store == "SPARQLUpdateStore":
@@ -201,7 +199,6 @@ def test_not_union(get_dataset):
def test_iter(get_dataset):
-
store, d = get_dataset
"""PR 1382: adds __iter__ to Dataset"""
uri_a = URIRef("https://example.com/a")
diff --git a/test/test_dataset/test_dataset_generators.py b/test/test_dataset/test_dataset_generators.py
index 28f076d7..165ba9b1 100644
--- a/test/test_dataset/test_dataset_generators.py
+++ b/test/test_dataset/test_dataset_generators.py
@@ -69,7 +69,6 @@ no_of_unique_objects = 62
def test_parse_berners_lee_card_into_dataset_default():
-
# Workaround pending completion of identifier-as-context work
# current W-I-P allows parsing direct to Dataset default context
# and doesn't require the dubious creation of a graph with the
diff --git a/test/test_extras/test_infixowl/test_annotatableterms.py b/test/test_extras/test_infixowl/test_annotatableterms.py
index 1e638267..598b9924 100644
--- a/test/test_extras/test_infixowl/test_annotatableterms.py
+++ b/test/test_extras/test_infixowl/test_annotatableterms.py
@@ -21,7 +21,6 @@ def graph():
def test_annotatableterms_comment_gettersetter(graph):
-
u = URIRef(EXNS.foo)
at = AnnotatableTerms(u, graph, EXNS.foo, True)
@@ -38,7 +37,6 @@ def test_annotatableterms_comment_gettersetter(graph):
def test_annotatableterms_seealso_gettersetter(graph):
-
u = URIRef(EXNS.foo)
at = AnnotatableTerms(u, graph, EXNS.foo, True)
@@ -54,7 +52,6 @@ def test_annotatableterms_seealso_gettersetter(graph):
def test_annotatableterms_label_gettersetter(graph):
-
u = URIRef(EXNS.foo)
at = AnnotatableTerms(u, graph, EXNS.foo, True)
diff --git a/test/test_extras/test_infixowl/test_basic.py b/test/test_extras/test_infixowl/test_basic.py
index 6566a4ae..139238ba 100644
--- a/test/test_extras/test_infixowl/test_basic.py
+++ b/test/test_extras/test_infixowl/test_basic.py
@@ -80,7 +80,6 @@ def test_infixowl_serialization():
def test_infix_owl_example1():
-
g = Graph(identifier=context0)
g.bind("ex", EXNS)
diff --git a/test/test_extras/test_infixowl/test_booleanclass.py b/test/test_extras/test_infixowl/test_booleanclass.py
index 86ac474d..86f7a223 100644
--- a/test/test_extras/test_infixowl/test_booleanclass.py
+++ b/test/test_extras/test_infixowl/test_booleanclass.py
@@ -19,7 +19,6 @@ def graph():
@pytest.mark.xfail(reason="assert len(props) == 1, repr(props), so AssertionError: []")
def test_booleanclass_operator_as_none(graph):
-
fire = Class(EXNS.Fire)
water = Class(EXNS.Water)
@@ -30,7 +29,6 @@ def test_booleanclass_operator_as_none(graph):
@pytest.mark.xfail(reason="This is a previous boolean class description!'( )")
def test_booleanclass_operator_as_none_with_intersection(graph):
-
fire = Class(EXNS.Fire)
water = Class(EXNS.Water)
@@ -42,7 +40,6 @@ def test_booleanclass_operator_as_none_with_intersection(graph):
def test_booleanclass_default_and_operator(graph):
-
fire = Class(EXNS.Fire)
water = Class(EXNS.Water)
@@ -54,7 +51,6 @@ def test_booleanclass_default_and_operator(graph):
def test_booleanclass_with_or_operator(graph):
-
fire = Class(EXNS.Fire)
water = Class(EXNS.Water)
@@ -71,7 +67,6 @@ def test_booleanclass_with_or_operator(graph):
reason="BooleanClass.getIntersections() - TypeError: 'Callable' object is not callable"
)
def test_getintersections(graph):
-
_ = BooleanClass.getIntersections()
@@ -79,12 +74,10 @@ def test_getintersections(graph):
reason="BooleanClass.getUnions() - TypeError: 'Callable' object is not callable"
)
def test_getunions(graph):
-
_ = BooleanClass.getUnions()
def test_booleanclass_copy(graph):
-
fire = Class(EXNS.Fire)
water = Class(EXNS.Water)
@@ -98,7 +91,6 @@ def test_booleanclass_copy(graph):
def test_booleanclass_serialize(graph):
-
fire = Class(EXNS.Fire)
water = Class(EXNS.Water)
diff --git a/test/test_extras/test_infixowl/test_class.py b/test/test_extras/test_infixowl/test_class.py
index 37adf571..f82f63c2 100644
--- a/test/test_extras/test_infixowl/test_class.py
+++ b/test/test_extras/test_infixowl/test_class.py
@@ -31,7 +31,6 @@ def graph():
def test_class_instantiation(graph):
-
name = EXNS.Man
assert isinstance(name, URIRef)
@@ -195,7 +194,6 @@ def test_class_getparents(graph):
def test_class_serialize(graph):
-
father = Class(EXNS.Father)
sister = Class(EXNS.Sister)
parent = Class(EXNS.Parent)
diff --git a/test/test_extras/test_infixowl/test_componentterms.py b/test/test_extras/test_infixowl/test_componentterms.py
index c0833a3a..ba1c0d61 100644
--- a/test/test_extras/test_infixowl/test_componentterms.py
+++ b/test/test_extras/test_infixowl/test_componentterms.py
@@ -28,7 +28,6 @@ def graph():
def test_componentterms_restriction():
-
name = EXNS.Man
assert isinstance(name, URIRef)
@@ -45,7 +44,6 @@ def test_componentterms_restriction():
def test_componentterms_booleanclass(graph):
-
fire = Class(EXNS.Fire)
water = Class(EXNS.Water)
@@ -59,7 +57,6 @@ def test_componentterms_booleanclass(graph):
def test_componentterms_booleanclass_bnodeid(graph):
-
fire = Class(EXNS.Fire)
water = Class(EXNS.Water)
diff --git a/test/test_extras/test_infixowl/test_context.py b/test/test_extras/test_infixowl/test_context.py
index 1515be0c..927785b2 100644
--- a/test/test_extras/test_infixowl/test_context.py
+++ b/test/test_extras/test_infixowl/test_context.py
@@ -29,7 +29,6 @@ def graph():
def test_context(graph):
-
# Now we have an empty graph, we can construct OWL classes in it
# using the Python classes defined in this module
diff --git a/test/test_extras/test_infixowl/test_cover.py b/test/test_extras/test_infixowl/test_cover.py
index b790adf4..9dd8b161 100644
--- a/test/test_extras/test_infixowl/test_cover.py
+++ b/test/test_extras/test_infixowl/test_cover.py
@@ -135,7 +135,6 @@ EXCL = ClassNamespaceFactory(EXNS)
def test_classnamespacefactory():
-
leg = EXCL.Leg
x = EXCL.__getitem__(leg.identifier)
@@ -351,7 +350,6 @@ def test_changeoperator():
def test_cardinality_zero():
-
g = Graph()
g.bind("ex", EXNS)
diff --git a/test/test_extras/test_infixowl/test_enumerated_class.py b/test/test_extras/test_infixowl/test_enumerated_class.py
index e3434046..956738a3 100644
--- a/test/test_extras/test_infixowl/test_enumerated_class.py
+++ b/test/test_extras/test_infixowl/test_enumerated_class.py
@@ -52,7 +52,6 @@ def test_enumerated_class(graph):
def test_enumerated_class_serialize(graph):
-
sg = Graph()
contlist = [Class(EXNS.Africa, graph=graph), Class(EXNS.NorthAmerica, graph=graph)]
diff --git a/test/test_extras/test_infixowl/test_individual.py b/test/test_extras/test_infixowl/test_individual.py
index 6500b6e9..3937fdff 100644
--- a/test/test_extras/test_infixowl/test_individual.py
+++ b/test/test_extras/test_infixowl/test_individual.py
@@ -20,7 +20,6 @@ def graph():
def test_infixowl_individual_type(graph):
-
b = Individual(OWL.Restriction, graph)
b.type = RDFS.Resource
assert len(list(b.type)) == 1
@@ -30,7 +29,6 @@ def test_infixowl_individual_type(graph):
def test_infixowl_individual_label(graph):
-
b = Individual(OWL.Restriction, graph)
b.label = Literal("boo")
@@ -41,7 +39,6 @@ def test_infixowl_individual_label(graph):
def test_individual_type_settergetter(graph):
-
b = Individual(OWL.Restriction, graph)
b.type = OWL.Restriction
@@ -72,7 +69,6 @@ def test_individual_type_settergetter(graph):
def test_individual_identity__settergetter(graph):
-
b = Individual(OWL.Restriction, graph)
assert b.identifier == URIRef("http://www.w3.org/2002/07/owl#Restriction")
@@ -93,7 +89,6 @@ def test_individual_identity__settergetter(graph):
def test_individual_sameas__settergetter(graph):
-
b = Individual(OWL.Restriction, graph)
assert list(b.sameAs) == []
diff --git a/test/test_extras/test_infixowl/test_logic_structuring.py b/test/test_extras/test_infixowl/test_logic_structuring.py
index 53458786..de3134f3 100644
--- a/test/test_extras/test_infixowl/test_logic_structuring.py
+++ b/test/test_extras/test_infixowl/test_logic_structuring.py
@@ -20,7 +20,6 @@ def graph():
def test_logic_structuring(graph):
-
isPartOf = Property(EXNS.isPartOf) # noqa: N806
graph.add((isPartOf.identifier, RDF.type, OWL.TransitiveProperty))
diff --git a/test/test_extras/test_infixowl/test_manchester_syntax.py b/test/test_extras/test_infixowl/test_manchester_syntax.py
index 98827041..52669af6 100644
--- a/test/test_extras/test_infixowl/test_manchester_syntax.py
+++ b/test/test_extras/test_infixowl/test_manchester_syntax.py
@@ -44,7 +44,6 @@ def test_manchester_syntax(graph):
def test_manchester_syntax_parse_with_transientlist(graph):
-
graph.parse(TEST_DATA_DIR / "owl" / "pizza.owl", format="xml")
res = manchesterSyntax(
diff --git a/test/test_extras/test_infixowl/test_ontology.py b/test/test_extras/test_infixowl/test_ontology.py
index 5ff7e9cc..135465f4 100644
--- a/test/test_extras/test_infixowl/test_ontology.py
+++ b/test/test_extras/test_infixowl/test_ontology.py
@@ -17,7 +17,6 @@ def graph():
def test_ontology_instantiation(graph):
-
name = Literal("TestOntology", lang="en")
pizza = URIRef("http://example.org/ontologies/pizza.owl")
@@ -66,7 +65,6 @@ def test_ontology_instantiation(graph):
def test_ontology_instantiation_exists_in_graph(graph):
-
name = Literal("TestOntology", lang="en")
graph.add((URIRef(name), RDF.type, OWL.Ontology))
diff --git a/test/test_extras/test_infixowl/test_property.py b/test/test_extras/test_infixowl/test_property.py
index 8440381e..c6d09798 100644
--- a/test/test_extras/test_infixowl/test_property.py
+++ b/test/test_extras/test_infixowl/test_property.py
@@ -20,7 +20,6 @@ def graph():
def test_property(graph):
-
comment = Literal("This is a woman")
verbannotations = ("woman", "Women", "Womens")
nameannotation = Literal("Woman")
diff --git a/test/test_extras/test_infixowl/test_restriction.py b/test/test_extras/test_infixowl/test_restriction.py
index 4f022137..c57cacb2 100644
--- a/test/test_extras/test_infixowl/test_restriction.py
+++ b/test/test_extras/test_infixowl/test_restriction.py
@@ -21,7 +21,6 @@ def graph():
def test_restriction_str_and_hash(graph):
-
r1 = (
(Property(EXNS.someProp, baseType=OWL.DatatypeProperty))
@ some
@@ -49,7 +48,6 @@ def test_restriction_str_and_hash(graph):
def test_restriction_range(graph):
-
r1 = Restriction(
onProperty=EXNS.hasParent,
graph=graph,
@@ -67,7 +65,6 @@ def test_restriction_range(graph):
def test_restriction_onproperty(graph):
-
r = Restriction(
onProperty=EXNS.hasChild,
graph=graph,
@@ -80,7 +77,6 @@ def test_restriction_onproperty(graph):
def test_restriction_inputs_bnode(graph):
-
r = Restriction(
onProperty=EXNS.hasChild,
graph=graph,
@@ -104,7 +100,6 @@ def test_restriction_inputs_bnode(graph):
def test_restriction_inputs_with_identifier(graph):
-
r = Restriction(
onProperty=EXNS.hasChild,
graph=graph,
@@ -128,7 +123,6 @@ def test_restriction_inputs_with_identifier(graph):
def test_restriction_allvalues(graph):
-
r = Restriction(
onProperty=EXNS.hasChild,
graph=graph,
@@ -150,7 +144,6 @@ def test_restriction_allvalues(graph):
def test_restriction_somevalues(graph):
-
r = Restriction(
onProperty=EXNS.hasChild,
graph=graph,
@@ -176,7 +169,6 @@ def test_restriction_somevalues(graph):
def test_restriction_hasvalue(graph):
-
r = Restriction(
onProperty=EXNS.hasChild,
graph=graph,
@@ -200,7 +192,6 @@ def test_restriction_hasvalue(graph):
def test_restriction_cardinality(graph):
-
r = Restriction(
onProperty=EXNS.hasChild,
graph=graph,
@@ -221,7 +212,6 @@ def test_restriction_cardinality(graph):
def test_restriction_cardinality_value(graph):
-
r = Restriction(
onProperty=EXNS.hasChild,
graph=graph,
@@ -248,7 +238,6 @@ def test_restriction_cardinality_value(graph):
@pytest.mark.xfail(reason="_set_cardinality fails to handle Literal")
def test_restriction_cardinality_set_value(graph):
-
r = Restriction(
onProperty=EXNS.hasChild,
graph=graph,
@@ -279,7 +268,6 @@ def test_restriction_cardinality_set_value(graph):
def test_restriction_maxcardinality(graph):
-
r = Restriction(
onProperty=EXNS.hasChild,
graph=graph,
@@ -300,7 +288,6 @@ def test_restriction_maxcardinality(graph):
def test_restriction_mincardinality(graph):
-
r = Restriction(
onProperty=EXNS.hasChild,
graph=graph,
@@ -321,7 +308,6 @@ def test_restriction_mincardinality(graph):
def test_restriction_kind(graph):
-
r = Restriction(
onProperty=EXNS.hasChild,
graph=graph,
@@ -331,7 +317,6 @@ def test_restriction_kind(graph):
def test_deleted_restriction_kind(graph):
-
r = Restriction(
onProperty=EXNS.hasChild,
graph=graph,
@@ -346,7 +331,6 @@ def test_deleted_restriction_kind(graph):
@pytest.mark.xfail(reason="assert len(validRestrProps) fails to handle None")
def test_omitted_restriction_kind(graph):
-
r = Restriction(
onProperty=EXNS.hasChild,
graph=graph,
diff --git a/test/test_extras/test_infixowl/test_rubric.py b/test/test_extras/test_infixowl/test_rubric.py
index bd12f80a..7e97ed7d 100644
--- a/test/test_extras/test_infixowl/test_rubric.py
+++ b/test/test_extras/test_infixowl/test_rubric.py
@@ -177,7 +177,6 @@ def test_class_or_term() -> None:
def test_property_or_identifier() -> None:
-
g = Graph()
g.bind("ex", EXNS)
diff --git a/test/test_graph/test_graph_http.py b/test/test_graph/test_graph_http.py
index 9c8d47a6..6a406718 100644
--- a/test/test_graph/test_graph_http.py
+++ b/test/test_graph/test_graph_http.py
@@ -62,7 +62,6 @@ EG = Namespace("http://example.org/")
class ContentNegotiationHandler(BaseHTTPRequestHandler):
def do_GET(self): # noqa: N802
-
self.send_response(200, "OK")
# fun fun fun parsing accept header.
diff --git a/test/test_graph/test_namespace_rebinding.py b/test/test_graph/test_namespace_rebinding.py
index f83da974..3125d57e 100644
--- a/test/test_graph/test_namespace_rebinding.py
+++ b/test/test_graph/test_namespace_rebinding.py
@@ -15,7 +15,6 @@ FOAF2 = Namespace(foaf2_uri)
def test_binding_replace():
-
# The confusion here is in the two arguments “override” and “replace” and
# how they serve two different purposes --- changing a prefix already bound
# to a namespace versus changing a namespace already bound to a prefix.
@@ -186,7 +185,6 @@ def test_binding_replace():
def test_prefix_alias_disallowed():
-
# CANNOT BIND A PREFIX ALIASED TO AN EXISTING BOUND NAMESPACE
g = Graph(bind_namespaces="none")
@@ -199,7 +197,6 @@ def test_prefix_alias_disallowed():
def test_rebind_prefix_succeeds():
-
# CAN REPLACE A PREFIX-NAMESPACE BINDING
g = Graph(bind_namespaces="none")
@@ -212,7 +209,6 @@ def test_rebind_prefix_succeeds():
def test_parse_rebinds_prefix():
-
# PARSED PREFIX-NAMESPACE BINDINGS REPLACE EXISTING BINDINGS
data = """@prefix friend-of-a-friend: <http://xmlns.com/foaf/0.1/> .
@@ -241,7 +237,6 @@ def test_parse_rebinds_prefix():
"""
)
def test_automatic_handling_of_unknown_predicates():
-
# AUTOMATIC HANDLING OF UNKNOWN PREDICATES
"""
@@ -260,7 +255,6 @@ def test_automatic_handling_of_unknown_predicates():
def test_automatic_handling_of_unknown_predicates_only_effected_after_serialization():
-
g = Graph(bind_namespaces="none")
g.add((tarek, URIRef("http://xmlns.com/foaf/0.1/name"), Literal("Tarek")))
@@ -398,7 +392,6 @@ def test_new_namespace_override_false():
def test_change_namespace_and_prefix():
-
# A more extensive illustration of attempted rebinds of
# `foaf` being intercepted and changed to a non-clashing
# prefix of `foafN` (where N is an incrementing integer) ...
diff --git a/test/test_issues/test_issue161.py b/test/test_issues/test_issue161.py
index 936cf6d6..b1df9bca 100644
--- a/test/test_issues/test_issue161.py
+++ b/test/test_issues/test_issue161.py
@@ -5,7 +5,6 @@ from rdflib.graph import ConjunctiveGraph
class EntityTest(TestCase):
def test_turtle_namespace_prefixes(self):
-
g = ConjunctiveGraph()
n3 = """
@prefix _9: <http://data.linkedmdb.org/resource/movie/> .
diff --git a/test/test_issues/test_issue545.py b/test/test_issues/test_issue545.py
index c677b2ac..3c6efbc4 100644
--- a/test/test_issues/test_issue545.py
+++ b/test/test_issues/test_issue545.py
@@ -3,7 +3,6 @@ from rdflib.plugins import sparql
def test_issue():
-
query = sparql.prepareQuery(
"""
SELECT DISTINCT ?property ?parent
diff --git a/test/test_issues/test_issue604.py b/test/test_issues/test_issue604.py
index cc48afea..d5662943 100644
--- a/test/test_issues/test_issue604.py
+++ b/test/test_issues/test_issue604.py
@@ -3,7 +3,6 @@ from rdflib.collection import Collection
def test_issue604():
-
EX = Namespace("http://ex.co/")
g = Graph()
bn = BNode()
diff --git a/test/test_issues/test_issue_git_200.py b/test/test_issues/test_issue_git_200.py
index b5640a53..953c1312 100644
--- a/test/test_issues/test_issue_git_200.py
+++ b/test/test_issues/test_issue_git_200.py
@@ -4,7 +4,6 @@ import rdflib
def test_broken_add():
-
g = rdflib.Graph()
with pytest.raises(AssertionError):
g.add((1, 2, 3))
diff --git a/test/test_issues/test_issue_git_336.py b/test/test_issues/test_issue_git_336.py
index 2cf24a83..511e6861 100644
--- a/test/test_issues/test_issue_git_336.py
+++ b/test/test_issues/test_issue_git_336.py
@@ -27,7 +27,6 @@ import rdflib
def test_ns_localname_roundtrip() -> None:
-
XNS = rdflib.Namespace("http://example.net/fs")
g = rdflib.Graph()
diff --git a/test/test_literal/test_xmlliterals.py b/test/test_literal/test_xmlliterals.py
index 7aa7443c..626755e2 100644
--- a/test/test_literal/test_xmlliterals.py
+++ b/test/test_literal/test_xmlliterals.py
@@ -92,7 +92,6 @@ def testRoundtrip():
@pytest.mark.skipif(not have_html5lib, reason="requires html5lib")
def testHTML():
-
l1 = Literal("<msg>hello</msg>", datatype=RDF.XMLLiteral)
assert l1.value is not None, "xml must have been parsed"
assert l1.datatype == RDF.XMLLiteral, "literal must have right datatype"
diff --git a/test/test_misc/test_conventions.py b/test/test_misc/test_conventions.py
index d45cbfc1..ad03b613 100644
--- a/test/test_misc/test_conventions.py
+++ b/test/test_misc/test_conventions.py
@@ -12,7 +12,6 @@ modules should all be lower-case initial
class TestA:
def module_names(self, path=None, names=None, parent=""):
-
skip_as_ignorably_private = ["embeddedRDF", "OpenID", "DublinCore", "RDFVOC"]
if path is None:
diff --git a/test/test_misc/test_input_source.py b/test/test_misc/test_input_source.py
index f34f77cb..f3da062b 100644
--- a/test/test_misc/test_input_source.py
+++ b/test/test_misc/test_input_source.py
@@ -220,7 +220,6 @@ def call_create_input_source(
input_path = input
with ExitStack() as xstack:
-
if source_param is not None:
source = xstack.enter_context(source_param.from_path(input_path))
if location_param is not None:
@@ -535,7 +534,7 @@ def generate_create_input_source_cases() -> Iterable[ParameterSet]:
),
).as_pytest_param(marks, id)
- for (param, stream_check, format) in itertools.product(
+ for param, stream_check, format in itertools.product(
itertools.chain(SourceParam, LocationParam, FileParam, DataParam),
StreamCheck,
formats,
diff --git a/test/test_n3.py b/test/test_n3.py
index ffebf8f7..c22278ef 100644
--- a/test/test_n3.py
+++ b/test/test_n3.py
@@ -240,7 +240,6 @@ foo-bar:Ex foo-bar:name "Test" . """
assert o == Literal("o")
def test_empty_prefix(self):
-
# this is issue https://github.com/RDFLib/rdflib/issues/312
g1 = Graph()
g1.parse(data=":a :b :c .", format="n3")
diff --git a/test/test_parsers/test_broken_parse_data_from_jena.py b/test/test_parsers/test_broken_parse_data_from_jena.py
index 0c9deb4e..ec176a4c 100644
--- a/test/test_parsers/test_broken_parse_data_from_jena.py
+++ b/test/test_parsers/test_broken_parse_data_from_jena.py
@@ -33,7 +33,6 @@ def xfail_broken_parse_data(request):
@pytest.mark.parametrize("testfile", os.listdir(broken_parse_data))
@pytest.mark.usefixtures("xfail_broken_parse_data")
def test_n3_serializer_roundtrip(testfile) -> None:
-
g1 = rdflib.ConjunctiveGraph()
g1.parse(os.path.join(broken_parse_data, testfile), format="n3")
diff --git a/test/test_parsers/test_parser_helpers.py b/test/test_parsers/test_parser_helpers.py
index 090a8a49..ea44c08a 100644
--- a/test/test_parsers/test_parser_helpers.py
+++ b/test/test_parsers/test_parser_helpers.py
@@ -9,7 +9,6 @@ def pt(ts):
def test_1():
-
t0 = TriplesSameSubject.parseString("[] ?p ?o ")
print(t0, len(t0))
assert len(t0) % 3 == 0
diff --git a/test/test_parsers/test_trix_parse.py b/test/test_parsers/test_trix_parse.py
index 57999829..89b74465 100644
--- a/test/test_parsers/test_trix_parse.py
+++ b/test/test_parsers/test_trix_parse.py
@@ -13,7 +13,6 @@ class TestTrixParse:
pass
def testAperture(self):
-
g = ConjunctiveGraph()
trix_path = os.path.relpath(
@@ -31,7 +30,6 @@ class TestTrixParse:
# print "Parsed %d triples"%t
def testSpec(self):
-
g = ConjunctiveGraph()
trix_path = os.path.relpath(
@@ -43,7 +41,6 @@ class TestTrixParse:
# print "Parsed %d triples"%len(g)
def testNG4j(self):
-
g = ConjunctiveGraph()
trix_path = os.path.relpath(
diff --git a/test/test_roundtrip.py b/test/test_roundtrip.py
index 4e868864..f06db6b8 100644
--- a/test/test_roundtrip.py
+++ b/test/test_roundtrip.py
@@ -72,11 +72,17 @@ INVALID_NT_FILES = {
N3_DATA_DIR = Path(TEST_DATA_DIR) / "suites" / "n3roundtrip"
XFAILS = {
- ("xml", "n3-writer-test-29.n3",): pytest.mark.xfail(
+ (
+ "xml",
+ "n3-writer-test-29.n3",
+ ): pytest.mark.xfail(
reason="has predicates that cannot be shortened to strict qnames",
raises=ValueError,
),
- ("xml", "n3-writer-test-32.n3",): pytest.mark.xfail(
+ (
+ "xml",
+ "n3-writer-test-32.n3",
+ ): pytest.mark.xfail(
reason="has a predicate that cannot be shortened to strict qnames",
raises=ValueError,
),
diff --git a/test/test_serializers/test_prettyxml.py b/test/test_serializers/test_prettyxml.py
index 91098394..1876fa2c 100644
--- a/test/test_serializers/test_prettyxml.py
+++ b/test/test_serializers/test_prettyxml.py
@@ -8,7 +8,6 @@ from rdflib.term import BNode, Literal, URIRef
class SerializerTestBase(object):
-
repeats = 8
def setup(self):
@@ -75,7 +74,6 @@ def serialize_and_load(sourceGraph, makeSerializer):
class TestPrettyXmlSerializer(SerializerTestBase):
-
serializer = PrettyXMLSerializer
testContent = """
diff --git a/test/test_serializers/test_serializer_trix.py b/test/test_serializers/test_serializer_trix.py
index 0f5ca5d7..f536c8d0 100644
--- a/test/test_serializers/test_serializer_trix.py
+++ b/test/test_serializers/test_serializer_trix.py
@@ -7,7 +7,6 @@ from rdflib.term import Literal, URIRef
def test_serialize():
-
s1 = URIRef("store:1")
r1 = URIRef("resource:1")
r2 = URIRef("resource:2")
diff --git a/test/test_serializers/test_serializer_xml.py b/test/test_serializers/test_serializer_xml.py
index ae75db0a..f305f508 100644
--- a/test/test_serializers/test_serializer_xml.py
+++ b/test/test_serializers/test_serializer_xml.py
@@ -7,7 +7,6 @@ from rdflib.term import BNode, URIRef
class SerializerTestBase(object):
-
repeats = 8
def setup(self):
@@ -74,7 +73,6 @@ def serialize_and_load(sourceGraph, makeSerializer):
class TestXMLSerializer(SerializerTestBase):
-
serializer = XMLSerializer
testContent = """
diff --git a/test/test_serializers/test_xmlwriter_qname.py b/test/test_serializers/test_xmlwriter_qname.py
index fb888b35..662d3f59 100644
--- a/test/test_serializers/test_xmlwriter_qname.py
+++ b/test/test_serializers/test_xmlwriter_qname.py
@@ -10,11 +10,9 @@ TRIXNS = rdflib.Namespace("http://www.w3.org/2004/03/trix/trix-1/")
def test_xmlwriter_namespaces():
-
g = rdflib.Graph()
with tempfile.TemporaryFile() as fp:
-
xmlwr = XMLWriter(fp, g.namespace_manager, extra_ns={"": TRIXNS, "ex": EXNS})
xmlwr.namespaces()
@@ -34,11 +32,9 @@ def test_xmlwriter_namespaces():
def test_xmlwriter_decl():
-
g = rdflib.Graph()
with tempfile.TemporaryFile() as fp:
-
xmlwr = XMLWriter(fp, g.namespace_manager, decl=0, extra_ns={"": TRIXNS})
xmlwr.namespaces()
@@ -67,7 +63,6 @@ def test_xmlwriter_decl():
],
)
def test_xmlwriter_qname(uri):
-
g = rdflib.Graph()
g.bind("", TRIXNS)
g.bind("ex", EXNS)
diff --git a/test/test_sparql/test_expressions.py b/test/test_sparql/test_expressions.py
index a547d40a..45573d8a 100644
--- a/test/test_sparql/test_expressions.py
+++ b/test/test_sparql/test_expressions.py
@@ -26,7 +26,6 @@ def _translate(e):
def testRegex():
-
assert _eval(_translate((p.Expression.parseString('REGEX("zxcabczxc","abc")')[0])))
eq(
@@ -40,7 +39,6 @@ def testRegex():
def test_arithmetic():
-
eq(_eval(_translate((p.Expression.parseString("2+3")[0]))).value, 5)
eq(_eval(_translate((p.Expression.parseString("3-2")[0]))).value, 1)
@@ -91,7 +89,6 @@ def test_arithmetic_var():
def test_comparisons():
-
eq(bool(_eval(_translate((p.Expression.parseString("2<3")[0])))), True)
eq(bool(_eval(_translate((p.Expression.parseString("2<3.0")[0])))), True)
eq(bool(_eval(_translate((p.Expression.parseString("2<3e0")[0])))), True)
@@ -110,7 +107,6 @@ def test_comparisons():
def test_comparisons_var():
-
ctx = QueryContext()
ctx[Variable("x")] = Literal(2)
diff --git a/test/test_sparql/test_prepare.py b/test/test_sparql/test_prepare.py
index e4b5bd31..ccb2e614 100644
--- a/test/test_sparql/test_prepare.py
+++ b/test/test_sparql/test_prepare.py
@@ -6,7 +6,6 @@ from rdflib.plugins.sparql import prepareQuery, prepareUpdate
def test_prepare_update():
-
q = prepareUpdate(
"""\
PREFIX dc: <http://purl.org/dc/elements/1.1/>
@@ -24,7 +23,6 @@ INSERT DATA
def test_prepare_query():
-
q = prepareQuery(
"SELECT ?name WHERE { ?person foaf:knows/foaf:name ?name . }",
initNs={"foaf": FOAF},
diff --git a/test/test_sparql/test_sparql.py b/test/test_sparql/test_sparql.py
index 7d66f2c1..02406bdf 100644
--- a/test/test_sparql/test_sparql.py
+++ b/test/test_sparql/test_sparql.py
@@ -65,7 +65,6 @@ def test_graph_prefix():
def test_variable_order():
-
g = Graph()
g.add((URIRef("http://foo"), URIRef("http://bar"), URIRef("http://baz")))
res = g.query("SELECT (42 AS ?a) ?b { ?b ?c ?d }")
@@ -125,7 +124,6 @@ def test_sparql_polist():
def test_complex_sparql_construct():
-
g = Graph()
q = """select ?subject ?study ?id where {
?s a <urn:Person>;
diff --git a/test/test_store/test_store_auditable.py b/test/test_store/test_store_auditable.py
index c445da97..f8d8e3d4 100644
--- a/test/test_store/test_store_auditable.py
+++ b/test/test_store/test_store_auditable.py
@@ -9,7 +9,6 @@ EX = Namespace("http://example.org/")
@pytest.fixture
def get_graph():
-
g = Graph("Memory")
g.add((EX.s0, EX.p0, EX.o0))
@@ -230,7 +229,6 @@ def test_remove_add_rollback(get_graph):
@pytest.fixture
def get_empty_graph():
-
g = Graph("Memory")
t = Graph(AuditableStore(g.store), g.identifier)
@@ -263,7 +261,6 @@ def test_add_rollback_empty(get_empty_graph):
@pytest.fixture
def get_concurrent_graph():
-
g = Graph("Memory")
g.add((EX.s0, EX.p0, EX.o0))
@@ -328,7 +325,6 @@ def test_rollback_rollback(get_concurrent_graph):
@pytest.fixture
def get_embedded_graph():
-
g = Graph("Memory")
g.add((EX.s0, EX.p0, EX.o0))
diff --git a/test/test_trig.py b/test/test_trig.py
index 30bff634..49572e44 100644
--- a/test/test_trig.py
+++ b/test/test_trig.py
@@ -133,7 +133,6 @@ def test_graph_parsing():
resulting in the default graph content appearing multipile times in the output.""",
)
def test_round_trips():
-
data = """
<http://example.com/thing#thing_a> <http://example.com/knows> <http://example.com/thing#thing_b> .
@@ -172,7 +171,6 @@ def test_default_graph_serializes_without_name():
def test_prefixes():
-
data = """
@prefix ns1: <http://ex.org/schema#> .
<http://ex.org/docs/document1> = {
diff --git a/test/test_turtle_sort_issue613.py b/test/test_turtle_sort_issue613.py
index a26ede28..89857b46 100644
--- a/test/test_turtle_sort_issue613.py
+++ b/test/test_turtle_sort_issue613.py
@@ -15,7 +15,6 @@ https://github.com/RDFLib/rdflib/issues/676
def test_sort_dates():
-
g = rdflib.Graph()
y = """@prefix ex: <http://ex.org> .
ex:X ex:p "2016-01-01T00:00:00"^^<http://www.w3.org/2001/XMLSchema#dateTime>, "2016-01-01T00:00:00Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> . """
@@ -25,7 +24,6 @@ ex:X ex:p "2016-01-01T00:00:00"^^<http://www.w3.org/2001/XMLSchema#dateTime>, "2
def test_sort_docfrag():
-
g = rdflib.Graph()
y = """@prefix ex: <http://ex.org> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@@ -36,5 +34,4 @@ ex:X ex:p "<h1>hi</h1>"^^rdf:HTML, "<h1>ho</h1>"^^rdf:HTML . """
if __name__ == "__main__":
-
test_sort_docfrag()
diff --git a/test/test_util.py b/test/test_util.py
index 949731c3..3e60bbb8 100644
--- a/test/test_util.py
+++ b/test/test_util.py
@@ -432,7 +432,6 @@ def test_find_roots(
roots: Optional[Set[Node]],
expected_result: Union[Set[URIRef], Type[Exception]],
) -> None:
-
catcher: Optional[pytest.ExceptionInfo[Exception]] = None
graph = cached_graph(graph_sources)
@@ -558,7 +557,6 @@ def test_get_tree(
dir: str,
expected_result: Union[Tuple[IdentifiedNode, List[Any]], Type[Exception]],
) -> None:
-
catcher: Optional[pytest.ExceptionInfo[Exception]] = None
graph = cached_graph(graph_sources)
diff --git a/test/test_w3c_spec/test_n3_w3c.py b/test/test_w3c_spec/test_n3_w3c.py
index 0fe5e164..436e0790 100644
--- a/test/test_w3c_spec/test_n3_w3c.py
+++ b/test/test_w3c_spec/test_n3_w3c.py
@@ -21,7 +21,6 @@ def n3(test: RDFTest):
g = Graph()
try:
-
base = "https://w3c.github.io/N3/tests/N3Tests/" + split_uri(test.action)[1]
g.parse(test.action, publicID=base, format="n3")
diff --git a/test/utils/__init__.py b/test/utils/__init__.py
index 815496da..a5c40e3f 100644
--- a/test/utils/__init__.py
+++ b/test/utils/__init__.py
@@ -316,6 +316,7 @@ class GraphHelper:
This asserts that the two graphs are isomorphic, providing a nicely
formatted error message if they are not.
"""
+
# TODO FIXME: This should possibly raise an error when used on a ConjunctiveGraph
def format_report(message: Optional[str] = None) -> str:
in_both, in_lhs, in_rhs = rdflib.compare.graph_diff(lhs, rhs)
diff --git a/test/utils/earl.py b/test/utils/earl.py
index dd132305..7628c787 100644
--- a/test/utils/earl.py
+++ b/test/utils/earl.py
@@ -186,7 +186,6 @@ PYTEST_PLUGIN_NAME = "rdflib_earl_reporter"
def pytest_configure(config: pytest.Config):
-
if config.option.earl_log_level is not None:
log_level = config.option.earl_log_level
logger.setLevel(log_level)
diff --git a/test/utils/httpfileserver.py b/test/utils/httpfileserver.py
index 43daf72a..c9a9dc5a 100644
--- a/test/utils/httpfileserver.py
+++ b/test/utils/httpfileserver.py
@@ -47,7 +47,6 @@ class Resource(ProtoResource):
@dataclass(frozen=True)
class ProtoRedirectResource(ProtoResource):
-
status: int
location_type: LocationType
@@ -59,7 +58,6 @@ class ProtoFileResource(ProtoResource):
@dataclass(frozen=True)
class RedirectResource(Resource, ProtoRedirectResource):
-
location: str
diff --git a/test/utils/manifest.py b/test/utils/manifest.py
index 548aa7ed..940f7f8b 100644
--- a/test/utils/manifest.py
+++ b/test/utils/manifest.py
@@ -38,7 +38,6 @@ def read_manifest(f, base=None, legacy=False) -> Iterable[Tuple[Node, Node, RDFT
g.parse(f, publicID=base, format="turtle")
for m in g.subjects(RDF.type, MF.Manifest):
-
for col in g.objects(m, MF.include):
for i in g.items(col):
for x in read_manifest(i):
@@ -47,7 +46,6 @@ def read_manifest(f, base=None, legacy=False) -> Iterable[Tuple[Node, Node, RDFT
for col in g.objects(m, MF.entries):
e: Node
for e in g.items(col):
-
approved = (
(e, DAWGT.approval, DAWGT.Approved) in g
or (e, DAWGT.approval, DAWGT.NotClassified) in g