Skip to content

Commit 918d615

Browse files
author
Jon
committed
appease the line length gods
1 parent 275e398 commit 918d615

4 files changed

Lines changed: 10 additions & 9 deletions

File tree

tom_dataproducts/alertstreams/hermes_ingester.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -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)

tom_dataproducts/alertstreams/hermes_publisher.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
from tom_alerts.models import AlertStreamMessage
99
from tom_targets.models import Target
1010

11-
12-
1311
logger = logging.getLogger(__name__)
1412
logger.setLevel(logging.DEBUG)
1513

@@ -292,5 +290,3 @@ def get_hermes_topics(**kwargs):
292290
except (KeyError, requests.exceptions.JSONDecodeError):
293291
pass
294292
return topics
295-
296-

tom_dataproducts/templatetags/dataproduct_extras.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,8 @@ def spectroscopy_for_target(context, target, dataproduct=None):
390390
else:
391391
datums = get_objects_for_user(context['request'].user,
392392
'tom_dataproducts.view_reduceddatum',
393-
klass=ReducedDatum.objects.filter(target=target, data_type=spectroscopy_data_type))
393+
klass=ReducedDatum.objects.filter(target=target,
394+
data_type=spectroscopy_data_type))
394395

395396
# If a dataproduct is specified, filter on that specific dataproduct
396397
if dataproduct:

tom_dataproducts/tests/test_sharing.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from django.test import TestCase, override_settings
22

3-
from tom_dataproducts.alertstreams.hermes_publisher import create_hermes_alert, BuildHermesMessage, HermesMessageException
3+
from tom_dataproducts.alertstreams.hermes_publisher import (create_hermes_alert, BuildHermesMessage,
4+
HermesMessageException)
45
from tom_dataproducts.models import ReducedDatum
56
from tom_observations.tests.utils import FakeRoboticFacility
67
from tom_observations.tests.factories import SiderealTargetFactory, ObservingRecordFactory

0 commit comments

Comments
 (0)