diff options
| author | Gunnar Aastrand Grimnes <gromgull@gmail.com> | 2014-03-04 12:39:10 +0100 |
|---|---|---|
| committer | Joern Hees <dev@joernhees.de> | 2014-04-11 16:21:31 +0200 |
| commit | 33225fc010d8b1d13122910d5ae3654bd93c6601 (patch) | |
| tree | b75ba665346e849826094a970a3ec2ad92063633 | |
| parent | d5a02f2558efe74c1256e79ffd8fc4bf4b5146fd (diff) | |
| download | rdflib-rm_md5_term_hash.tar.gz | |
removed md5_term_hash, fixes #240rm_md5_term_hash
| -rw-r--r-- | rdflib/graph.py | 5 | ||||
| -rw-r--r-- | rdflib/term.py | 58 | ||||
| -rw-r--r-- | test/test_literal.py | 9 |
3 files changed, 0 insertions, 72 deletions
diff --git a/rdflib/graph.py b/rdflib/graph.py index 5e8be21a..9b412981 100644 --- a/rdflib/graph.py +++ b/rdflib/graph.py @@ -517,11 +517,6 @@ class Graph(Node): 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 diff --git a/rdflib/term.py b/rdflib/term.py index 25c22c5c..ae3a4f86 100644 --- a/rdflib/term.py +++ b/rdflib/term.py @@ -262,20 +262,7 @@ class URIRef(Identifier): 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 @@ -408,21 +395,6 @@ class BNode(Identifier): 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 @@ -1272,21 +1244,6 @@ class Literal(Identifier): 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: @@ -1534,21 +1491,6 @@ class Variable(Identifier): 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): diff --git a/test/test_literal.py b/test/test_literal.py index 9c17cb2f..b31a7e90 100644 --- a/test/test_literal.py +++ b/test/test_literal.py @@ -4,15 +4,6 @@ import rdflib # needed for eval(repr(...)) below 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): |
