Skip to content

Commit dde9db8

Browse files
author
Nicholas Car
authored
Merge pull request #1186 from white-gecko/avoid_using_assert_in_sparqlconnector
Remove the usage of assert in the SPARQLConnector
2 parents 7a53c61 + b42e5a5 commit dde9db8

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

rdflib/plugins/stores/sparqlconnector.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,10 @@ def __init__(
5252
self.kwargs = kwargs
5353
self.method = method
5454
if auth is not None:
55-
assert type(auth) == tuple, "auth must be a tuple"
56-
assert len(auth) == 2, "auth must be a tuple (user, password)"
55+
if type(auth) != tuple:
56+
raise SPARQLConnectorException("auth must be a tuple")
57+
if len(auth) != 2:
58+
raise SPARQLConnectorException("auth must be a tuple (user, password)")
5759
base64string = base64.b64encode(bytes('%s:%s' % auth, 'ascii'))
5860
self.kwargs.setdefault("headers", {})
5961
self.kwargs["headers"].update({"Authorization": "Basic %s" % base64string.decode('utf-8')})

0 commit comments

Comments
 (0)