def valid_hook(hook_file, hook_name):
 filename = os.path.basename(hook_file)
 basename = os.path.splitext(filename)[0]
 matching_hook = (basename == hook_name)
 supported_hook = (basename in _HOOKS)
 backup_file = filename.endswith('~')
 return (matching_hook and supported_hook and (not backup_file))

def valid_hook ( hook_file , hook_name ) : filename = os . path . basename ( hook_file ) basename = os . path . splitext ( filename ) [ 0 ] matching_hook = ( basename == hook_name ) supported_hook = ( basename in _HOOKS ) backup_file = filename . endswith ( '~' ) return ( matching_hook and supported_hook and ( not backup_file ) )
determine if a hook file is valid .