#NEWLINE# def process_heartbeat( args , configs , hostname , heartbeat ) : #NEWLINE# #INDENT# exclude = should_exclude ( heartbeat [ 'entity' ] , args . include , args . exclude ) #NEWLINE# if ( exclude is not False ) : #NEWLINE# #INDENT# log . debug ( u ( 'Skipping because matches exclude pattern: {pattern}' ) . format ( pattern = u ( exclude ) ) ) #NEWLINE# return SUCCESS #NEWLINE# #UNINDENT# if ( heartbeat . get ( 'entity_type' ) not in [ 'file' , 'domain' , 'app' ] ) : #NEWLINE# #INDENT# heartbeat [ 'entity_type' ] = 'file' #NEWLINE# #UNINDENT# if ( ( heartbeat [ 'entity_type' ] != 'file' ) or os . path . isfile ( heartbeat [ 'entity' ] ) ) : #NEWLINE# #INDENT# stats = get_file_stats ( heartbeat [ 'entity' ] , entity_type = heartbeat [ 'entity_type' ] , lineno = heartbeat . get ( 'lineno' ) , cursorpos = heartbeat . get ( 'cursorpos' ) , plugin = args . plugin , alternate_language = heartbeat . get ( 'alternate_language' ) ) #NEWLINE# project = ( heartbeat . get ( 'project' ) or heartbeat . get ( 'alternate_project' ) ) #NEWLINE# branch = None #NEWLINE# if ( heartbeat [ 'entity_type' ] == 'file' ) : #NEWLINE# #INDENT# ( project , branch ) = get_project_info ( configs , heartbeat ) #NEWLINE# #UNINDENT# heartbeat [ 'project' ] = project #NEWLINE# heartbeat [ 'branch' ] = branch #NEWLINE# heartbeat [ 'stats' ] = stats #NEWLINE# heartbeat [ 'hostname' ] = hostname #NEWLINE# heartbeat [ 'timeout' ] = args . timeout #NEWLINE# heartbeat [ 'key' ] = args . key #NEWLINE# heartbeat [ 'plugin' ] = args . plugin #NEWLINE# heartbeat [ 'offline' ] = args . offline #NEWLINE# heartbeat [ 'hidefilenames' ] = args . hidefilenames #NEWLINE# heartbeat [ 'proxy' ] = args . proxy #NEWLINE# heartbeat [ 'api_url' ] = hostname . api_url #NEWLINE# return send_heartbeat ( ** heartbeat ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# log . debug ( 'File does not exist; ignoring this heartbeat.' ) #NEWLINE# return SUCCESS