forked from Botanical/BotanJS
Deprecating old approach
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
from functools import lru_cache
|
||||
from zlib import adler32 as _HashFunc
|
||||
HashFunc = lambda v: hex( _HashFunc( v ) )[2:]
|
||||
|
||||
@lru_cache( maxsize = 1024 )
|
||||
def checksum( file_path ):
|
||||
return checksum_r( file_path )
|
||||
|
||||
def checksum_r( file_path ):
|
||||
try:
|
||||
with open( file_path, "rb" ) as f:
|
||||
return HashFunc( f.read() )
|
||||
except FileNotFoundError:
|
||||
return HashFunc( b"" )
|
||||
Reference in New Issue
Block a user