MCPcopy Create free account
hub / github.com/Syncplay/syncplay / hashFilename

Function hashFilename

syncplay/utils.py:337–346  ·  view source on GitHub ↗
(filename, stripURL=False)

Source from the content-addressed store, hash-verified

335
336
337def hashFilename(filename, stripURL=False):
338 if isURL(filename):
339 stripURL = True
340 strippedFilename = stripfilename(filename, stripURL)
341 try:
342 strippedFilename = strippedFilename.encode('utf-8')
343 except UnicodeDecodeError:
344 pass
345 filenameHash = hashlib.sha256(strippedFilename).hexdigest()[:12]
346 return filenameHash
347
348
349def hashFilesize(size):

Callers 1

sameFilenameFunction · 0.85

Calls 2

isURLFunction · 0.85
stripfilenameFunction · 0.85

Tested by

no test coverage detected