Skip to content

Commit

Permalink
removed md5_term_hash, fixes #240
Browse files Browse the repository at this point in the history
  • Loading branch information
gromgull authored and joernhees committed Apr 11, 2014
1 parent d5a02f2 commit 33225fc
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 72 deletions.
5 changes: 0 additions & 5 deletions rdflib/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -517,11 +517,6 @@ def __contains__(self, triple):
def __hash__(self):
return hash(self.identifier)

def md5_term_hash(self):
d = md5(str(self.identifier))
d.update("G")
return d.hexdigest()

def __cmp__(self, other):
if other is None:
return -1
Expand Down
58 changes: 0 additions & 58 deletions rdflib/term.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,20 +262,7 @@ def __radd__(self, other):
def __mod__(self, other):
return self.__class__(unicode(self) % other)

def md5_term_hash(self):
"""a string of hex that will be the same for two URIRefs that
are the same. It is not a suitable unique id.

Supported for backwards compatibility; new code should
probably just use __hash__
"""
warnings.warn(
"method md5_term_hash is deprecated, and will be removed " +
"in the future. If you use this please let rdflib-dev know!",
category=DeprecationWarning, stacklevel=2)
d = md5(self.encode())
d.update(b("U"))
return d.hexdigest()

def de_skolemize(self):
""" Create a Blank Node from a skolem URI, in accordance
Expand Down Expand Up @@ -408,21 +395,6 @@ def __repr__(self):
clsName = self.__class__.__name__
return """%s('%s')""" % (clsName, str(self))

def md5_term_hash(self):
"""a string of hex that will be the same for two BNodes that
are the same. It is not a suitable unique id.
Supported for backwards compatibility; new code should
probably just use __hash__
"""
warnings.warn(
"method md5_term_hash is deprecated, and will be removed " +
"in the future. If you use this please let rdflib-dev know!",
category=DeprecationWarning, stacklevel=2)
d = md5(self.encode())
d.update(b("B"))
return d.hexdigest()

def skolemize(self, authority="http://rdlib.net/"):
""" Create a URIRef "skolem" representation of the BNode, in accordance
with http://www.w3.org/TR/rdf11-concepts/#section-skolemization
Expand Down Expand Up @@ -1272,21 +1244,6 @@ def toPython(self):
return self.value
return self

def md5_term_hash(self):
"""a string of hex that will be the same for two Literals that
are the same. It is not a suitable unique id.
Supported for backwards compatibility; new code should
probably just use __hash__
"""
warnings.warn(
"method md5_term_hash is deprecated, and will be removed " +
"removed in the future. If you use this please let rdflib-dev know!",
category=DeprecationWarning, stacklevel=2)
d = md5(self.encode())
d.update(b("L"))
return d.hexdigest()


def _parseXML(xmlstring):
if not py3compat.PY3:
Expand Down Expand Up @@ -1534,21 +1491,6 @@ def n3(self, namespace_manager = None):
def __reduce__(self):
return (Variable, (unicode(self),))

def md5_term_hash(self):
"""a string of hex that will be the same for two Variables that
are the same. It is not a suitable unique id.
Supported for backwards compatibility; new code should
probably just use __hash__
"""
warnings.warn(
"method md5_term_hash is deprecated, and will be removed " +
"removed in the future. If you use this please let rdflib-dev know!",
category=DeprecationWarning, stacklevel=2)
d = md5(self.encode())
d.update(b("V"))
return d.hexdigest()


class Statement(Node, tuple):

Expand Down
9 changes: 0 additions & 9 deletions test/test_literal.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,6 @@
from rdflib.term import Literal, URIRef, _XSD_DOUBLE, bind
from rdflib.py3compat import format_doctest_out as uformat

# these are actually meant for test_term.py, which is not yet merged into trunk

class TestMd5(unittest.TestCase):
def testMd5(self):
self.assertEqual(rdflib.URIRef("http://example.com/").md5_term_hash(),
"40f2c9c20cc0c7716fb576031cceafa4")
self.assertEqual(rdflib.Literal("foo").md5_term_hash(),
"da9954ca5f673f8ab9ebd6faf23d1046")


class TestLiteral(unittest.TestCase):
def setUp(self):
Expand Down

0 comments on commit 33225fc

Please sign in to comment.