def filename_to_hex(filename):
 names = filename.rsplit(os.path.sep, 2)[(-2):]
 errmsg = ('Invalid object filename: %s' % filename)
 assert (len(names) == 2), errmsg
 (base, rest) = names
 assert ((len(base) == 2) and (len(rest) == 38)), errmsg
 hex = (base + rest).encode('ascii')
 hex_to_sha(hex)
 return hex

def filename_to_hex ( filename ) : names = filename . rsplit ( os . path . sep , 2 ) [ ( - 2 ) : ] errmsg = ( 'Invalid object filename: %s' % filename ) assert ( len ( names ) == 2 ) , errmsg ( base , rest ) = names assert ( ( len ( base ) == 2 ) and ( len ( rest ) == 38 ) ) , errmsg hex = ( base + rest ) . encode ( 'ascii' ) hex_to_sha ( hex ) return hex
takes an object filename and returns its corresponding hex sha .