#NEWLINE# def _build_metadata( self , year , elections ) : #NEWLINE# #INDENT# meta = [ ] #NEWLINE# year_int = int ( year ) #NEWLINE# for election in elections : #NEWLINE# #INDENT# if election [ 'special' ] : #NEWLINE# #INDENT# results = [ x for x in self . _url_paths ( ) if ( ( x [ 'date' ] == election [ 'start_date' ] ) and ( x [ 'special' ] == True ) ) ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# results = [ x for x in self . _url_paths ( ) if ( ( x [ 'date' ] == election [ 'start_date' ] ) and ( x [ 'special' ] == False ) ) ] #NEWLINE# #UNINDENT# for result in results : #NEWLINE# #INDENT# if result [ 'url' ] : #NEWLINE# #INDENT# raw_url = result [ 'url' ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# raw_url = None #NEWLINE# #UNINDENT# if ( result [ 'county' ] == '' ) : #NEWLINE# #INDENT# generated_filename = self . _generate_filename ( election [ 'start_date' ] , election [ 'race_type' ] , result ) #NEWLINE# ocd_id = 'ocd-division/country:us/state:or' #NEWLINE# name = 'Oregon' #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# generated_filename = self . _generate_county_filename ( election [ 'start_date' ] , result ) #NEWLINE# ocd_id = ( 'ocd-division/country:us/state:or/county:%s' % result [ 'county' ] . lower ( ) . replace ( ' ' , '_' ) ) #NEWLINE# name = result [ 'county' ] #NEWLINE# #UNINDENT# meta . append ( { #NEWLINE# #INDENT# 'generated_filename' : generated_filename , #NEWLINE# 'raw_url' : raw_url , #NEWLINE# 'pre_processed_url' : build_raw_github_url ( self . state , raw_url [ 'start_date' ] [ 0 : 4 ] , generated_filename ) , #NEWLINE# 'ocd_id' : ocd_id , #NEWLINE# 'name' : name , #NEWLINE# 'election' : election [ 'slug' ] , #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# #UNINDENT# return meta