You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When running pytest on a project that includes rdflib as a dependency, I am seeing the following warning:
<my venv path>/lib/python3.7/site-packages/rdflib/plugins/sparql/__init__.py:52
<my venv path>/lib/python3.7/site-packages/rdflib/plugins/sparql/__init__.py:52: DeprecationWarning: SelectableGroups dict interface is deprecated. Use select.
for ep in all_entry_points.get(PLUGIN_ENTRY_POINT, []):
Looks like the problematic code is lines 50 onward, in rdflib/plugins/sparql/__init__.py. To avoid the deprecation warning, it'd be better to use the new interface if it's available, and only call the deprecated one if necessary. My suggestion (I'm just changing the if/elif/else conditions and adding an "else" condition which should never be reached; the remaining code is unchanged from the original):
all_entry_points = entry_points()
if hasattr(all_entry_points, 'select') and callable(all_entry_points.select):
for ep in all_entry_points.select(group=PLUGIN_ENTRY_POINT):
CUSTOM_EVALS[ep.name] = ep.load()
elif isinstance(all_entry_points, dict):
# Prior to Python 3.10, this returns a dict instead of the selection interface
for ep in all_entry_points.get(PLUGIN_ENTRY_POINT, []):
CUSTOM_EVALS[ep.name] = ep.load()
else:
raise RuntimeError("entry_points() returned an object lacking either a select() method or a Dict interface")
The text was updated successfully, but these errors were encountered:
When running pytest on a project that includes
rdflib
as a dependency, I am seeing the following warning:Looks like the problematic code is lines 50 onward, in
rdflib/plugins/sparql/__init__.py
. To avoid the deprecation warning, it'd be better to use the new interface if it's available, and only call the deprecated one if necessary. My suggestion (I'm just changing the if/elif/else conditions and adding an "else" condition which should never be reached; the remaining code is unchanged from the original):The text was updated successfully, but these errors were encountered: