Rev477, FindHashId command for optional files, Renaming some variables to make it more clear, Optional files downloading in WorkerManager, Test FindHash, Test Optional download, Test FindOptional
This commit is contained in:
parent
e8ce26587d
commit
a8dae8dd85
9 changed files with 348 additions and 93 deletions
|
@ -2,6 +2,7 @@ import os
|
|||
import socket
|
||||
import struct
|
||||
import re
|
||||
import collections
|
||||
|
||||
|
||||
def atomicWrite(dest, content, mode="w"):
|
||||
|
@ -44,3 +45,17 @@ def getDirname(path):
|
|||
# Return: data/site/content.json -> content.json
|
||||
def getFilename(path):
|
||||
return re.sub("^.*/", "", path)
|
||||
|
||||
|
||||
# Convert hash to hashid for hashfield
|
||||
def toHashId(hash):
|
||||
return int(hash[0:4], 16)
|
||||
|
||||
|
||||
# Merge dict values
|
||||
def mergeDicts(dicts):
|
||||
back = collections.defaultdict(set)
|
||||
for d in dicts:
|
||||
for key, val in d.iteritems():
|
||||
back[key].update(val)
|
||||
return dict(back)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue