Remove unused imports
[htsworkflow.git] / samples / views.py
index cc94c620474ce1e8267b0e969921157141e63a3a..e173b08d5974f193ee7ea27fabbc545f4894973c 100644 (file)
@@ -3,32 +3,23 @@ from __future__ import absolute_import, print_function, unicode_literals
 # Create your views here.
 import logging
 import os
-import sys
-
-try:
-    import json
-except ImportError as e:
-    import simplejson as json
+import json
 
 from django.views.decorators.csrf import csrf_exempt
-from django.core.exceptions import ObjectDoesNotExist
 from django.http import HttpResponse, HttpResponseRedirect, Http404
 from django.shortcuts import render_to_response, get_object_or_404
 from django.template import RequestContext
 from django.template.loader import get_template
 from django.contrib.auth.decorators import login_required
-from django.conf import settings
 
 from htsworkflow.auth import require_api_key
-from experiments.models import FlowCell, Lane, LANE_STATUS_MAP
-from experiments.admin import LaneOptions
+from experiments.models import FlowCell, LANE_STATUS_MAP
 from .changelist import HTSChangeList
-from .models import Antibody, Library, Species, HTSUser
+from .models import Antibody, Library, Species
 from .admin import LibraryOptions
 from .results import get_flowcell_result_dict
 from bcmagic.forms import BarcodeMagicForm
 from htsworkflow.pipelines import runfolder
-from htsworkflow.pipelines.eland import ResultLane
 from htsworkflow.pipelines.samplekey import SampleKey
 from htsworkflow.util.conversion import str_or_none, parse_flowcell_id
 from htsworkflow.util import makebed
@@ -86,10 +77,10 @@ def create_library_context(cl):
             summary['amplified_from'] = ''
         lanes_run = count_lanes(lib.lane_set)
         # suppress zeros
-        for row in xrange(len(lanes_run)):
-            for col in xrange(len(lanes_run[row])):
-                if lanes_run[row][col] == 0:
-                    lanes_run[row][col] = ''
+        for row_index, row in enumerate(lanes_run):
+            for col_index, cell in enumerate(row):
+                if lanes_run[row_index][col_index] == 0:
+                    lanes_run[row_index][col_index] = ''
         summary['lanes_run'] = lanes_run
         summary['is_archived'] = lib.is_archived()
         records.append(summary)
@@ -163,31 +154,6 @@ def library_to_flowcells(request, lib_id):
         context_instance=RequestContext(request))
 
 
-def lanes_for(request, username=None):
-    """
-    Generate a report of recent activity for a user
-    """
-    query = {}
-    if username is not None:
-        user = HTSUser.objects.get(username=username)
-        query.update({'library__affiliations__users__id': user.id})
-    fcl = HTSChangeList(request, Lane,
-                        list_filter=[],
-                        search_fields=['flowcell__flowcell_id', 'library__id', 'library__library_name'],
-                        list_per_page=200,
-                        model_admin=LaneOptions,
-                        queryset=Lane.objects.filter(**query)
-                        )
-
-    context = {'lanes': fcl, 'title': 'Lane Index'}
-
-    return render_to_response(
-        'samples/lanes_for.html',
-        context,
-        context_instance=RequestContext(request)
-    )
-
-
 def summaryhtm_fc_cnm(request, flowcell_id, cnm):
     """
     returns a Summary.htm file if it exists.