diff options
author | Iwan Aucamp <aucampia@gmail.com> | 2023-04-09 21:47:26 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-09 21:47:26 +0200 |
commit | 6e544f5afc365b8e0fc8ad7f98c4c27b9daa755d (patch) | |
tree | 62d395919752b8fea68069794a2ab13f48e9760c | |
parent | 4940798d09b282d47370606ede94fd16e4cb235f (diff) | |
download | rdflib-6e544f5afc365b8e0fc8ad7f98c4c27b9daa755d.tar.gz |
refactor: eliminate unneeded `rdflib.compat` imports (#2336)
Compatibility handling for `collections.abc.Mapping` and
`collections.abc.MutableMapping` is not needed as RDFLib currently only support
Python 3.7 and newer, and those classes are available from `collections.abc` in
Python 3.7.
-rw-r--r-- | rdflib/compat.py | 7 | ||||
-rw-r--r-- | rdflib/plugins/sparql/sparql.py | 2 |
2 files changed, 1 insertions, 8 deletions
diff --git a/rdflib/compat.py b/rdflib/compat.py index cba3a569..1cc4adac 100644 --- a/rdflib/compat.py +++ b/rdflib/compat.py @@ -97,10 +97,3 @@ def decodeUnicodeEscape(escaped: str) -> str: # Most of times, there are no backslashes in strings. return escaped return _turtle_escape_pattern.sub(_turtle_escape_subber, escaped) - - -# Migration to abc in Python 3.8 -try: - from collections.abc import Mapping, MutableMapping -except: - from collections import Mapping, MutableMapping diff --git a/rdflib/plugins/sparql/sparql.py b/rdflib/plugins/sparql/sparql.py index 8f6a002d..0332d4e7 100644 --- a/rdflib/plugins/sparql/sparql.py +++ b/rdflib/plugins/sparql/sparql.py @@ -4,6 +4,7 @@ import collections import datetime import itertools import typing as t +from collections.abc import Mapping, MutableMapping from typing import ( TYPE_CHECKING, Any, @@ -21,7 +22,6 @@ from typing import ( import isodate import rdflib.plugins.sparql -from rdflib.compat import Mapping, MutableMapping from rdflib.graph import ConjunctiveGraph, Graph from rdflib.namespace import NamespaceManager from rdflib.plugins.sparql.parserutils import CompValue |