def CreateAFF4Object(stat_response, client_id, token, sync=False):
 stat_response.aff4path = aff4_grr.VFSGRRClient.PathspecToURN(stat_response.pathspec, client_id)
 if stat_response.pathspec.last.stream_name:
  stat_response.st_mode &= (~ stat_type_mask)
  stat_response.st_mode |= stat.S_IFREG
 if stat.S_ISDIR(stat_response.st_mode):
  ftype = standard.VFSDirectory
 else:
  ftype = aff4_grr.VFSFile
 fd = aff4.FACTORY.Create(stat_response.aff4path, ftype, mode='w', token=token)
 fd.Set(fd.Schema.STAT(stat_response))
 fd.Set(fd.Schema.PATHSPEC(stat_response.pathspec))
 fd.Close(sync=sync)

def CreateAFF4Object ( stat_response , client_id , token , sync = False ) : stat_response . aff4path = aff4_grr . VFSGRRClient . PathspecToURN ( stat_response . pathspec , client_id ) if stat_response . pathspec . last . stream_name : stat_response . st_mode &= ( ~ stat_type_mask ) stat_response . st_mode |= stat . S_IFREG if stat . S_ISDIR ( stat_response . st_mode ) : ftype = standard . VFSDirectory else : ftype = aff4_grr . VFSFile fd = aff4 . FACTORY . Create ( stat_response . aff4path , ftype , mode = 'w' , token = token ) fd . Set ( fd . Schema . STAT ( stat_response ) ) fd . Set ( fd . Schema . PATHSPEC ( stat_response . pathspec ) ) fd . Close ( sync = sync )
this creates a file or a directory from a stat response .