示例#1
0
 def is_fingerprinted(self):
     """
     Lazy implementation (needs to be fixed); we'll re-fingerprint the file
     and check whether that happens to be in the filename.
     """
     #TODO: FixMe!
     return checksum(self.data()) in self.path
示例#2
0
 def prepare(self):
     """
     Prepare the file for upload
     """
     payload = self.payload()  # Decide whether we'll compress or not.
     self.payload_checksum = checksum(payload)
     self.lastUpload = 0
示例#3
0
文件: file.py 项目: krallin/Cactus
 def is_fingerprinted(self):
     """
     Lazy implementation (needs to be fixed); we'll re-fingerprint the file
     and check whether that happens to be in the filename.
     """
     #TODO: FixMe!
     return checksum(self.data()) in self.path
示例#4
0
文件: file.py 项目: krallin/Cactus
 def prepare(self):
     """
     Prepare the file for upload
     """
     payload = self.payload()  # Decide whether we'll compress or not.
     self.payload_checksum = checksum(payload)
     self.lastUpload = 0
示例#5
0
 def put_object(self, req):
     return TestHTTPResponse(
         200, headers={"ETag": '"{0}"'.format(checksum(req.body))})
示例#6
0
文件: file.py 项目: dreadatour/Cactus
def file_changed_hash(path):
    info = os.stat(path)
    hashKey = text_type(info.st_mtime) + text_type(info.st_size)
    return checksum(hashKey.encode('utf-8'))
示例#7
0
def file_changed_hash(path):
    info = os.stat(path)
    hashKey = str(info.st_mtime) + str(info.st_size)
    return checksum(hashKey)
示例#8
0
def file_changed_hash(path):
    info = os.stat(path)
    hashKey = text_type(info.st_mtime) + text_type(info.st_size)
    return checksum(hashKey.encode('utf-8'))
示例#9
0
文件: file.py 项目: krallin/Cactus
def calculate_file_checksum(path):
    """
    Calculate the MD5 sum for a file (needs to fit in memory)
    """
    with open(path, 'rb') as f:
        return checksum(f.read())
示例#10
0
 def put_object(self, req):
     return TestHTTPResponse(200, headers={"ETag":'"{0}"'.format(checksum(req.body))})