diff options
author | Iwan Aucamp <aucampia@gmail.com> | 2022-04-14 20:05:30 +0200 |
---|---|---|
committer | Iwan Aucamp <aucampia@gmail.com> | 2022-04-14 20:05:30 +0200 |
commit | 436bc1e2ed35386ab74cb7319f7100d0b9f63c78 (patch) | |
tree | c47ca36501a14a264d0ffe740fcad9c2ba484ab5 /rdflib/util.py | |
parent | 8bad917cbc8213e176a47fd37d24f487485dda17 (diff) | |
download | rdflib-436bc1e2ed35386ab74cb7319f7100d0b9f63c78.tar.gz |
Remove `(TypeCheck|SubjectType|PredicateType|ObjectType)Error` and related
Also remove
`check_(context|subject|predicate|object|statement|pattern)`.
It seems nothing is using these exceptions and functions.
Technically this does remove parts of the public API, but I would argue
they are "buggy" parts as anything that use them would be sorely
disappointed to find that the behaviour is not as expect, and these
functions/exceptions don't serve any function related to the aim of
RDFLib unless they are integrated with the rest of RDFLib.
Diffstat (limited to 'rdflib/util.py')
-rw-r--r-- | rdflib/util.py | 68 |
1 files changed, 0 insertions, 68 deletions
diff --git a/rdflib/util.py b/rdflib/util.py index 7341a12f..a77d7300 100644 --- a/rdflib/util.py +++ b/rdflib/util.py @@ -18,15 +18,6 @@ Date/time utilities * date_time * parse_date_time -Statement and component type checkers - -* check_context -* check_subject -* check_predicate -* check_object -* check_statement -* check_pattern - """ from calendar import timegm @@ -41,10 +32,6 @@ from time import timezone from os.path import splitext -from rdflib.exceptions import ContextTypeError -from rdflib.exceptions import ObjectTypeError -from rdflib.exceptions import PredicateTypeError -from rdflib.exceptions import SubjectTypeError import rdflib.graph # avoid circular dependency from rdflib.namespace import Namespace, XSD from rdflib.namespace import NamespaceManager @@ -62,12 +49,6 @@ __all__ = [ "from_n3", "date_time", "parse_date_time", - "check_context", - "check_subject", - "check_predicate", - "check_object", - "check_statement", - "check_pattern", "guess_format", "find_roots", "get_tree", @@ -235,55 +216,6 @@ def from_n3(s: str, default=None, backend=None, nsm=None): return BNode(s) -def check_context(c): - if not (isinstance(c, URIRef) or isinstance(c, BNode)): - raise ContextTypeError("%s:%s" % (c, type(c))) - - -def check_subject(s): - """Test that s is a valid subject identifier.""" - if not (isinstance(s, URIRef) or isinstance(s, BNode)): - raise SubjectTypeError(s) - - -def check_predicate(p): - """Test that p is a valid predicate identifier.""" - if not isinstance(p, URIRef): - raise PredicateTypeError(p) - - -def check_object(o): - """Test that o is a valid object identifier.""" - if not (isinstance(o, URIRef) or isinstance(o, Literal) or isinstance(o, BNode)): - raise ObjectTypeError(o) - - -def check_statement(triple): - (s, p, o) = triple - if not (isinstance(s, URIRef) or isinstance(s, BNode)): - raise SubjectTypeError(s) - - if not isinstance(p, URIRef): - raise PredicateTypeError(p) - - if not (isinstance(o, URIRef) or isinstance(o, Literal) or isinstance(o, BNode)): - raise ObjectTypeError(o) - - -def check_pattern(triple): - (s, p, o) = triple - if s and not (isinstance(s, URIRef) or isinstance(s, BNode)): - raise SubjectTypeError(s) - - if p and not isinstance(p, URIRef): - raise PredicateTypeError(p) - - if o and not ( - isinstance(o, URIRef) or isinstance(o, Literal) or isinstance(o, BNode) - ): - raise ObjectTypeError(o) - - def date_time(t=None, local_time_zone=False): """http://www.w3.org/TR/NOTE-datetime ex: 1997-07-16T19:20:30Z |