@@ -78,7 +78,8 @@ def hermes_alert_handler(alert, metadata):
7878 def resolve_target (target_name ):
7979 if target_name not in target_cache :
8080 # We first attempt to match to an existing target in the TOM by target_name or any specified aliases
81- target_entry = next ((t for t in target_table if t .get ('name' , '' ) == target_name ), {}) if target_table else {}
81+ target_entry = next ((t for t in target_table if t .get ('name' , '' )
82+ == target_name ), {}) if target_table else {}
8283 aliases = target_entry .get ('aliases' , [])
8384 query = Target .matches .match_name (target_name )
8485 if not query :
@@ -195,15 +196,17 @@ def _ingest_hermes_spectroscopy_file(url, spectroscopy_row, target, hermes_alert
195196 spectroscopy_keys = ['date_obs' , 'flux_units' , 'wavelength_units' , 'telescope' , 'instrument' , 'reducer' ,
196197 'observer' , 'spec_type' , 'flux_type' , 'classification' , 'comments' , 'exposure_time' ,
197198 'setup' , 'proprietary_period' , 'proprietary_period_units' ]
198- spectroscopy_data = {key : spectroscopy_row [key ] for key in spectroscopy_keys if key in spectroscopy_row and spectroscopy_row [key ]}
199+ spectroscopy_data = {key : spectroscopy_row [key ]
200+ for key in spectroscopy_keys if key in spectroscopy_row and spectroscopy_row [key ]}
199201 # Inject these two extra fields since they should be associated with the ReducedDatums somehow
200202 spectroscopy_data ['source_name' ] = hermes_alert .topic
201203 spectroscopy_data ['source_location' ] = alert_url
202204
203205 try :
204206 dp , created = DataProduct .objects .get_or_create (
205207 product_id = url ,
206- defaults = {'target' : target , 'data_product_type' : 'spectroscopy' , 'extra_data' : json .dumps (spectroscopy_data )},
208+ defaults = {'target' : target , 'data_product_type' : 'spectroscopy' ,
209+ 'extra_data' : json .dumps (spectroscopy_data )},
207210 )
208211 if created :
209212 _ , ext = os .path .splitext (filename )
0 commit comments