Skip to content

Commit

Permalink
Remove a bunch of unused code
Browse files Browse the repository at this point in the history
  • Loading branch information
Jon committed Feb 14, 2023
1 parent cb53165 commit 498b427
Show file tree
Hide file tree
Showing 10 changed files with 0 additions and 317 deletions.
Empty file.
53 changes: 0 additions & 53 deletions tom_nonlocalizedevents/nonlocalizedevent_clients/gracedb.py

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Empty file.
43 changes: 0 additions & 43 deletions tom_nonlocalizedevents/templatetags/superevent_extras.py

This file was deleted.

47 changes: 0 additions & 47 deletions tom_nonlocalizedevents/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
from rest_framework import permissions, viewsets
from django_filters.rest_framework import DjangoFilterBackend

from tom_nonlocalizedevents.nonlocalizedevent_clients.gravitational_wave import GravitationalWaveClient

from tom_nonlocalizedevents.models import EventCandidate, EventLocalization, NonLocalizedEvent
from tom_nonlocalizedevents.serializers import (EventCandidateSerializer, EventLocalizationSerializer,
NonLocalizedEventSerializer)
Expand All @@ -33,51 +31,6 @@ def get_queryset(self):
return qs


class NonLocalizedEventDetailView(DetailView):
"""
Django DetailView subclass for NonLocalizedEvent model.
Has mechanism to supply templates specific to the type of NonLocalizedEvent
(GW, GRB, Nutrino).
"""
model = NonLocalizedEvent
template_name = 'tom_nonlocalizedevents/detail.html'

# TODO: consider combining these dictionaries
template_mapping = {
NonLocalizedEvent.NonLocalizedEventType.GRAVITATIONAL_WAVE:
'tom_nonlocalizedevents/nonlocalizedevent_detail/gravitational_wave.html',
NonLocalizedEvent.NonLocalizedEventType.GAMMA_RAY_BURST:
'tom_nonlocalizedevents/nonlocalizedevent_detail/gamma_ray_burst.html',
NonLocalizedEvent.NonLocalizedEventType.NEUTRINO:
'tom_nonlocalizedevents/nonlocalizedevent_detail/neutrino.html',
}

# A client in this context is the interface to the service providing event info.
# (i.e GraceDB for gravitational wave events)
client_mapping = {
NonLocalizedEvent.NonLocalizedEventType.GRAVITATIONAL_WAVE: GravitationalWaveClient(),
NonLocalizedEvent.NonLocalizedEventType.GAMMA_RAY_BURST: None,
NonLocalizedEvent.NonLocalizedEventType.NEUTRINO: None,
NonLocalizedEvent.NonLocalizedEventType.UNKNOWN: None,
}

def get_template_names(self):
obj = self.get_object()
return [self.template_mapping[obj.event_type]]

# TODO: error handling
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
obj = self.get_object()
superevent_client = self.client_mapping[obj.event_type]
# TODO: should define superevent_client API (via ABC) for clients to implement
if superevent_client is not None:
context['superevent_data'] = superevent_client.get_superevent_data(obj.event_id)
context.update(superevent_client.get_additional_context_data(obj.event_id))
return context


# from the tom_alerts query_result.html

class CreateEventFromSCiMMAAlertView(View):
Expand Down

0 comments on commit 498b427

Please sign in to comment.