removed unused hash_values function

This commit is contained in:
Pablo Hoffman 2009-08-17 18:16:44 -03:00
parent 4f06f6ef41
commit c81987f624
2 changed files with 1 additions and 21 deletions

View File

@ -1,15 +1,10 @@
import unittest
from cStringIO import StringIO
from scrapy.utils.misc import hash_values, items_to_csv, load_object, arg_to_iter
from scrapy.utils.misc import items_to_csv, load_object, arg_to_iter
from scrapy.item import ScrapedItem
class UtilsMiscTestCase(unittest.TestCase):
def test_hash_values(self):
self.assertEqual(hash_values('some', 'values', 'to', 'hash'),
'f37f5dc65beaaea35af05e16e26d439fd150c576')
self.assertRaises(ValueError, hash_values, 'some', None, 'value')
def test_items_to_csv(self):
item_1 = ScrapedItem()

View File

@ -112,21 +112,6 @@ def extract_regex(regex, text, encoding):
else:
return [remove_entities(unicode(s, encoding), keep=['lt', 'amp']) for s in strings]
def hash_values(*values):
"""Hash a series of non-None values.
For example:
>>> hash_values('some', 'values', 'to', 'hash')
'f37f5dc65beaaea35af05e16e26d439fd150c576'
"""
hash = hashlib.sha1()
for value in values:
if value is None:
message = "hash_values was passed None at argument index %d" % list(values).index(None)
raise ValueError(message)
hash.update(value)
return hash.hexdigest()
def items_to_csv(file, items, delimiter=';', headers=None):
"""
This function takes a list of items and stores their attributes