Skip to content

Commit eec6c24

Browse files
committed
refactor: narrow imports
This change narrows import so that things are imported from the Python module where they are defined instead of importing them from a module that re-exports them, e.g. change import of `Graph` to import from the `rdflib.graph` module instead of from the `rdflib` module. This helps avoid problems with circular imports.
1 parent 4940798 commit eec6c24

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

rdflib/extras/infixowl.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,11 +110,10 @@
110110
import itertools
111111
import logging
112112

113-
from rdflib import OWL, RDF, RDFS, XSD, BNode, Literal, Namespace, URIRef, Variable
114113
from rdflib.collection import Collection
115114
from rdflib.graph import Graph
116-
from rdflib.namespace import NamespaceManager
117-
from rdflib.term import Identifier
115+
from rdflib.namespace import OWL, RDF, RDFS, XSD, Namespace, NamespaceManager
116+
from rdflib.term import BNode, Identifier, Literal, URIRef, Variable
118117
from rdflib.util import first
119118

120119
logger = logging.getLogger(__name__)

rdflib/plugins/sparql/parserutils.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@
1616

1717
from pyparsing import ParseResults, TokenConverter, originalTextFor
1818

19-
from rdflib import BNode, Variable
20-
from rdflib.term import Identifier
19+
from rdflib.term import BNode, Identifier, Variable
2120

2221
if TYPE_CHECKING:
2322
from rdflib.plugins.sparql.sparql import FrozenBindings

rdflib/void.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import collections
22

3-
from rdflib import Graph, Literal, URIRef
3+
from rdflib.graph import Graph
44
from rdflib.namespace import RDF, VOID
5+
from rdflib.term import Literal, URIRef
56

67

78
def generateVoID( # noqa: N802

0 commit comments

Comments
 (0)