mirror of https://github.com/scrapy/scrapy.git
removed unused hash_values function
This commit is contained in:
parent
4f06f6ef41
commit
c81987f624
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue