diff --git a/poetry.lock b/poetry.lock
index 45c32e3e0..27c05a77e 100644
--- a/poetry.lock
+++ b/poetry.lock
@@ -1119,22 +1119,22 @@ test = ["cython", "filelock", "html5lib", "pytest (>=4.6)"]
[[package]]
name = "sphinx-autodoc-typehints"
-version = "1.25.2"
+version = "2.0.1"
description = "Type hints (PEP 484) support for the Sphinx autodoc extension"
optional = false
python-versions = ">=3.8"
files = [
- {file = "sphinx_autodoc_typehints-1.25.2-py3-none-any.whl", hash = "sha256:5ed05017d23ad4b937eab3bee9fae9ab0dd63f0b42aa360031f1fad47e47f673"},
- {file = "sphinx_autodoc_typehints-1.25.2.tar.gz", hash = "sha256:3cabc2537e17989b2f92e64a399425c4c8bf561ed73f087bc7414a5003616a50"},
+ {file = "sphinx_autodoc_typehints-2.0.1-py3-none-any.whl", hash = "sha256:f73ae89b43a799e587e39266672c1075b2ef783aeb382d3ebed77c38a3fc0149"},
+ {file = "sphinx_autodoc_typehints-2.0.1.tar.gz", hash = "sha256:60ed1e3b2c970acc0aa6e877be42d48029a9faec7378a17838716cacd8c10b12"},
]
[package.dependencies]
sphinx = ">=7.1.2"
[package.extras]
-docs = ["furo (>=2023.7.26)", "sphinx (>=7.1.2)"]
+docs = ["furo (>=2024.1.29)"]
numpy = ["nptyping (>=2.5)"]
-testing = ["covdefaults (>=2.3)", "coverage (>=7.3)", "diff-cover (>=7.7)", "pytest (>=7.4)", "pytest-cov (>=4.1)", "sphobjinv (>=2.3.1)", "typing-extensions (>=4.7.1)"]
+testing = ["covdefaults (>=2.3)", "coverage (>=7.4.2)", "diff-cover (>=8.0.3)", "pytest (>=8.0.1)", "pytest-cov (>=4.1)", "sphobjinv (>=2.3.1)", "typing-extensions (>=4.9)"]
[[package]]
name = "sphinxcontrib-apidoc"
@@ -1339,4 +1339,4 @@ networkx = ["networkx"]
[metadata]
lock-version = "2.0"
python-versions = "^3.8.1"
-content-hash = "d421bb77ca3b06701554aa04e63235909272ef40f10619ca0f64e73b52e76f60"
+content-hash = "7514432973368065fa5482d533d74c83b54642cd6f4e8598c0ec7af28bf2ced9"
diff --git a/pyproject.toml b/pyproject.toml
index b6ea1c9be..4ca58a019 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -60,10 +60,10 @@ setuptools = ">=68,<72"
wheel = ">=0.42,<0.44"
[tool.poetry.group.docs.dependencies]
-sphinx = "^7.1.1"
+sphinx = ">=7.1.2,<8"
myst-parser = ">=2,<4"
sphinxcontrib-apidoc = ">=0.3,<0.6"
-sphinx-autodoc-typehints = "^1.17.1"
+sphinx-autodoc-typehints = ">=1.25.3,<=2.0.1"
typing-extensions = "^4.5.0"
[tool.poetry.group.lint.dependencies]
diff --git a/rdflib/graph.py b/rdflib/graph.py
index ec1f0f989..59bc5246a 100644
--- a/rdflib/graph.py
+++ b/rdflib/graph.py
@@ -433,6 +433,11 @@ class Graph(Node):
For more on named graphs, see: http://www.w3.org/2004/03/trix/
"""
+ context_aware: bool
+ formula_aware: bool
+ default_union: bool
+ base: Optional[str]
+
def __init__(
self,
store: Union[Store, str] = "default",
@@ -1393,9 +1398,9 @@ def parse(
:doc:`Security Considerations `
documentation.
- :param source: An `InputSource`, file-like object, `Path` like object,
- or string. In the case of a string the string is the location of the
- source.
+ :param source: An `xml.sax.xmlreader.InputSource`, file-like object,
+ `pathlib.Path` like object, or string. In the case of a string the string
+ is the location of the source.
:param location: A string indicating the relative or absolute URL of the
source. `Graph`'s absolutize method is used if a relative location
is specified.
@@ -1910,6 +1915,8 @@ class ConjunctiveGraph(Graph):
All queries are carried out against the union of all graphs.
"""
+ default_context: _ContextType
+
def __init__(
self,
store: Union[Store, str] = "default",
@@ -2227,8 +2234,9 @@ def parse(
See :meth:`rdflib.graph.Graph.parse` for documentation on arguments.
- If the source is in a format that does not support named graphs it's triples
- will be added to the default graph (i.e. `Dataset.default_context`).
+ If the source is in a format that does not support named graphs its triples
+ will be added to the default graph
+ (i.e. :attr:`ConjunctiveGraph.default_context`).
:Returns:
@@ -2254,7 +2262,7 @@ def parse(
the ``publicID`` parameter will also not be used as the name for the
graph that the data is loaded into, and instead the triples from sources
that do not support named graphs will be loaded into the default graph
- (i.e. `ConjunctiveGraph.default_context`).
+ (i.e. :attr:`ConjunctiveGraph.default_context`).
"""
source = create_input_source(
@@ -2488,8 +2496,9 @@ def parse(
The source is specified using one of source, location, file or data.
- If the source is in a format that does not support named graphs it's triples
- will be added to the default graph (i.e. `Dataset.default_context`).
+ If the source is in a format that does not support named graphs its triples
+ will be added to the default graph
+ (i.e. :attr:`.Dataset.default_context`).
.. caution::
@@ -2510,7 +2519,7 @@ def parse(
the ``publicID`` parameter will also not be used as the name for the
graph that the data is loaded into, and instead the triples from sources
that do not support named graphs will be loaded into the default graph
- (i.e. `ConjunctiveGraph.default_context`).
+ (i.e. :attr:`.Dataset.default_context`).
"""
c = ConjunctiveGraph.parse(
diff --git a/rdflib/namespace/_WGS.py b/rdflib/namespace/_WGS.py
index b73222cf3..1416154cd 100644
--- a/rdflib/namespace/_WGS.py
+++ b/rdflib/namespace/_WGS.py
@@ -7,7 +7,7 @@ class WGS(DefinedNamespace):
Basic Geo (WGS84 lat/long) Vocabulary
The HTML Specification for the vocabulary can be found
- `here `.
+ here .
"""
_NS = Namespace("https://www.w3.org/2003/01/geo/wgs84_pos#")
diff --git a/rdflib/namespace/__init__.py b/rdflib/namespace/__init__.py
index 4e1e70e72..4077b0be3 100644
--- a/rdflib/namespace/__init__.py
+++ b/rdflib/namespace/__init__.py
@@ -233,6 +233,13 @@ def __repr__(self) -> str:
"_underscore_num",
}
+# Some libraries probe classes for certain attributes or items.
+# This is a list of those attributes and items that should be ignored.
+_IGNORED_ATTR_LOOKUP: Set[str] = {
+ "_pytestfixturefunction", # pytest tries to look this up on Defined namespaces
+ "_partialmethod", # sphinx tries to look this up during autodoc generation
+}
+
class DefinedNamespaceMeta(type):
"""Utility metaclass for generating URIRefs with a common prefix."""
@@ -246,10 +253,13 @@ class DefinedNamespaceMeta(type):
@lru_cache(maxsize=None)
def __getitem__(cls, name: str, default=None) -> URIRef:
name = str(name)
+
if name in _DFNS_RESERVED_ATTRS:
raise AttributeError(
f"DefinedNamespace like object has no attribute {name!r}"
)
+ elif name in _IGNORED_ATTR_LOOKUP:
+ raise KeyError()
if str(name).startswith("__"):
# NOTE on type ignore: This seems to be a real bug, super() does not
# implement this method, it will fail if it is ever reached.
@@ -265,6 +275,8 @@ def __getitem__(cls, name: str, default=None) -> URIRef:
return cls._NS[name]
def __getattr__(cls, name: str):
+ if name in _IGNORED_ATTR_LOOKUP:
+ raise AttributeError()
return cls.__getitem__(name)
def __repr__(cls) -> str: