cleanup unused imports and unused variables

This commit is contained in:
j 2013-02-21 13:28:36 +00:00
parent 06f6a79b7b
commit b1d83b0f93
42 changed files with 30 additions and 155 deletions

View file

@ -12,14 +12,13 @@ from django.db.models.signals import pre_delete
import ox
from archive import extract
from clip.models import Clip
from changelog.models import Changelog
from item.utils import sort_string
import managers
import utils
from tasks import update_matches, update_item
from tasks import update_matches
def get_super_matches(obj, model):

View file

@ -4,13 +4,11 @@ from __future__ import division
from django.conf import settings
import ox
from ox.utils import json
from ox.django.decorators import login_required_json
from ox.django.shortcuts import render_to_json_response, get_object_or_404_json, json_response
from item.models import Item
from ox.django.api import actions
from item import utils

View file

@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
# vi:si:et:sw=4:sts=4:ts=4
from django.core.management.base import BaseCommand
from django.db import connection, transaction
from django.db import connection
class Command(BaseCommand):

View file

@ -2,7 +2,7 @@
# vi:si:et:sw=4:sts=4:ts=4
import datetime
from celery.task import task, periodic_task
from celery.task import periodic_task
from celery.schedules import crontab

View file

@ -1,7 +0,0 @@
from django.conf import settings
from django import forms
import models
from item.models import Item

View file

@ -1,10 +1,8 @@
# -*- coding: utf-8 -*-
# vi:si:et:sw=4:sts=4:ts=4
import os
from optparse import make_option
from django.core.management.base import BaseCommand
from django.conf import settings
import monkey_patch.models
from ... import models

View file

@ -3,19 +3,16 @@
from __future__ import division, with_statement
import os.path
import re
import time
import shutil
from django.conf import settings
from django.contrib.auth.models import User
from django.db import models
from django.db.models import Q
from django.db.models.signals import pre_delete
from ox.django import fields
import ox
import chardet
from item import utils
import item.models

View file

@ -3,12 +3,10 @@
from glob import glob
from celery.task import task
import ox
from django.conf import settings
from item.models import Item
import item.tasks
import models
import extract
@ -107,7 +105,7 @@ def extract_derivatives(fileId, rebuild=False):
file = models.File.objects.get(id=fileId)
streams = file.streams.filter(source=None)
if streams.count() > 0:
stream[0].extract_derivatives(rebuild)
streams[0].extract_derivatives(rebuild)
return True
@task(queue="encoding")

View file

@ -7,7 +7,7 @@ from datetime import datetime
from django import forms
from django.shortcuts import get_object_or_404, redirect
from django.conf import settings
from django.db.models import Count, Q
from django.db.models import Count
import ox
from ox.utils import json
@ -282,7 +282,6 @@ def firefogg_upload(request):
def taskStatus(request):
#FIXME: should check if user has permissions to get status
data = json.loads(request.POST['data'])
user = request.user
task_id = data['task_id']
response = task_status(request, task_id)
return render_to_json_response(response)

View file

@ -2,12 +2,8 @@
# vi:si:et:sw=4:sts=4:ts=4
from __future__ import division, with_statement
import re
from django.db import models, transaction
from django.contrib.auth.models import User
from django.db.models import Q
from django.conf import settings
import ox
from ox.django import fields

View file

@ -1,10 +1,7 @@
# -*- coding: utf-8 -*-
# vi:si:et:sw=4:sts=4:ts=4
from datetime import timedelta
from celery.task import task, periodic_task
from celery.schedules import crontab
from celery.task import task
from models import Event

View file

@ -2,7 +2,7 @@
# vi:si:et:sw=4:sts=4:ts=4
from __future__ import division
from django.db.models import Max, Min, Count
from django.db.models import Count
from django.conf import settings
import ox

View file

@ -1,2 +0,0 @@
from django.conf import settings

View file

@ -2,12 +2,9 @@
# vi:si:et:sw=4:sts=4:ts=4
import os
from os.path import join, dirname, basename, splitext, exists
import time
from glob import glob
from django.core.management.base import BaseCommand, CommandError
from django.conf import settings
from django.core.management.base import BaseCommand
import monkey_patch.models
from ... import models
@ -23,7 +20,7 @@ class Command(BaseCommand):
def handle(self, **options):
offset = 0
chunk = 100
count = pos = models.Item.objects.count()
count = models.Item.objects.count()
while offset <= count:
for i in models.Item.objects.all().order_by('id')[offset:offset+chunk]:
if not os.path.exists(os.path.join(i.timeline_prefix, 'cuts.json')) or \

View file

@ -1,12 +1,9 @@
# -*- coding: utf-8 -*-
# vi:si:et:sw=4:sts=4:ts=4
import os
from os.path import join, dirname, basename, splitext, exists
import time
from django.core.management.base import BaseCommand, CommandError
from django.conf import settings
from django.core.management.base import BaseCommand
import monkey_patch.models
from ... import models

View file

@ -8,7 +8,6 @@ from django.conf import settings
import monkey_patch.models
from ... import models
import time
class Command(BaseCommand):

View file

@ -4,7 +4,6 @@ from optparse import make_option
from django.core.management.base import BaseCommand
from django.db import connection, transaction
from django.conf import settings
from django.db.models import fields
import monkey_patch.models

View file

@ -3,9 +3,7 @@
from __future__ import division, with_statement
from datetime import datetime
import math
import os.path
import re
import subprocess
from glob import glob
import shutil
@ -14,12 +12,10 @@ import unicodedata
from urllib import quote
from django.db import models, transaction
from django.db.models import Count, Q, Sum, Max
from django.core.files.base import ContentFile
from django.db.models import Q, Sum, Max
from django.conf import settings
from django.contrib.auth.models import User, Group
from django.db.models.signals import pre_delete
from django.contrib.sites.models import Site
import ox
from ox.django import fields

View file

@ -3,9 +3,8 @@
#
from decimal import Decimal
import re
import unicodedata
import ox
from ox import sorted_strings, sort_string
from ox import sort_string
def safe_filename(filename):
filename = filename.replace(': ', '_ ')

View file

@ -2,7 +2,6 @@
# vi:si:et:sw=4:sts=4:ts=4
from __future__ import division
import os.path
from datetime import datetime, timedelta
import mimetypes
import random
from urlparse import urlparse
@ -10,7 +9,7 @@ from urllib import quote
import time
import Image
from django.db.models import Count, Sum, Max
from django.db.models import Count, Sum
from django.template import RequestContext
from django.http import HttpResponse, HttpResponseForbidden, Http404
from django.shortcuts import get_object_or_404, redirect, render_to_response
@ -21,7 +20,6 @@ from ox.utils import json, ET
from ox.django.decorators import login_required_json
from ox.django.shortcuts import render_to_json_response, get_object_or_404_json, json_response
from ox.django.http import HttpFileResponse
from django.db.models import Q
import ox
import models
@ -34,8 +32,6 @@ from clip.models import Clip
from ox.django.api import actions
import utils
def _order_query(qs, sort, prefix='sort__'):
order_by = []

View file

@ -1,11 +1,8 @@
# -*- coding: utf-8 -*-
# vi:si:et:sw=4:sts=4:ts=4
from datetime import datetime
from django.db.models import Q, Manager
import models
def parseCondition(condition, user):
'''

View file

@ -4,11 +4,8 @@ from __future__ import division
import os
import re
import ox
from django.db.models import Max, Sum
from django.db import transaction
from django.http import HttpResponseForbidden, Http404
from django.conf import settings
from ox.utils import json
from ox.django.decorators import login_required_json

View file

@ -1,13 +1,10 @@
# -*- coding: utf-8 -*-
# vi:si:et:sw=4:sts=4:ts=4
import os
from datetime import timedelta, datetime
import gzip
import random
random
from django.conf import settings
from celery.task import task, periodic_task
from celery.task import periodic_task
import models

View file

@ -5,8 +5,8 @@ from __future__ import division
import ox
from ox.utils import json
from ox.django.decorators import login_required_json, admin_required_json
from ox.django.shortcuts import render_to_json_response, get_object_or_404_json, json_response
from ox.django.decorators import admin_required_json
from ox.django.shortcuts import render_to_json_response, json_response
from ox.django.api import actions

View file

@ -3,7 +3,6 @@
from __future__ import division, with_statement
from django.db import models
from django.contrib.auth.models import User
import ox
from changelog.models import Changelog

View file

@ -2,20 +2,14 @@
# vi:si:et:sw=4:sts=4:ts=4
from __future__ import division
from django.conf import settings
import ox
from ox.utils import json
from ox.django.decorators import login_required_json
from ox.django.shortcuts import render_to_json_response, get_object_or_404_json, json_response
from item.models import Item
from ox.django.api import actions
from item import utils
from item.models import Item
import models
def getNews(request):

View file

@ -2,12 +2,10 @@
# vi:si:et:sw=4:sts=4:ts=4
from __future__ import division
from django.db.models import Max, Min
import ox
from ox.utils import json
from ox.django.decorators import login_required_json, admin_required_json
from ox.django.decorators import admin_required_json
from ox.django.shortcuts import render_to_json_response, get_object_or_404_json, json_response
from ox.django.api import actions

View file

@ -2,12 +2,8 @@
# vi:si:et:sw=4:sts=4:ts=4
from __future__ import division, with_statement
import re
from django.db import models, transaction
from django.contrib.auth.models import User, Group
from django.db.models import Q
from django.conf import settings
from django.contrib.auth.models import User
import ox
from ox.django import fields

View file

@ -1,9 +1,7 @@
# -*- coding: utf-8 -*-
# vi:si:et:sw=4:sts=4:ts=4
from datetime import timedelta
from celery.task import task, periodic_task
from celery.schedules import crontab
from celery.task import task
import models

View file

@ -2,20 +2,11 @@
# vi:si:et:sw=4:sts=4:ts=4
from __future__ import division, with_statement
import re
from django.db import models, transaction
from django.contrib.auth.models import User, Group
from django.db.models import Q
from django.conf import settings
import ox
from django.db import models
import managers
from annotation.models import Annotation, get_matches, get_super_matches
from item.models import Item, ItemSort
from changelog.models import Changelog
from django.db import models
class Sequence(models.Model):
class Meta:

View file

@ -1,15 +1,7 @@
# -*- coding: utf-8 -*-
# vi:si:et:sw=4:sts=4:ts=4
import os
from datetime import timedelta, datetime
import gzip
import random
random
from django.conf import settings
from django.db import connection, transaction
from ox.utils import ET
from celery.task import task, periodic_task
from celery.task import task
import models
import extract

View file

@ -2,18 +2,17 @@
# vi:si:et:sw=4:sts=4:ts=4
from __future__ import division
from django.conf import settings
from ox.utils import json
from ox.django.shortcuts import render_to_json_response, json_response
from ox.django.api import actions
from annotation.models import Annotation
from item.models import Item
from item import utils
import models
def parse_query(data, user):
query = {}
query['range'] = [0, 100]

View file

@ -1,11 +1,7 @@
# -*- coding: utf-8 -*-
# vi:si:et:sw=4:sts=4:ts=4
from datetime import datetime
from django.db.models import Q, Manager
import models
def parseCondition(condition, user):
'''

View file

@ -4,7 +4,6 @@ from __future__ import division, with_statement
import os
import re
import subprocess
from datetime import datetime
from glob import glob
from django.db import models

View file

@ -1,23 +0,0 @@
"""
This file demonstrates two different styles of tests (one doctest and one
unittest). These will both pass when you run "manage.py test".
Replace these with more appropriate tests for your application.
"""
from django.test import TestCase
class SimpleTest(TestCase):
def test_basic_addition(self):
"""
Tests that 1 + 1 always equals 2.
"""
self.failUnlessEqual(1 + 1, 2)
__test__ = {"doctest": """
Another way to test that 1 + 1 is equal to 2.
>>> 1 + 1 == 2
True
"""}

View file

@ -4,14 +4,13 @@ from __future__ import division
import os
import re
import ox
from ox.utils import json
from ox.django.api import actions
from ox.django.decorators import login_required_json
from ox.django.http import HttpFileResponse
from ox.django.shortcuts import render_to_json_response, get_object_or_404_json, json_response
from django import forms
from django.db.models import Count, Q, Sum, Max
from django.db.models import Sum, Max
from django.conf import settings
from item import utils
@ -397,6 +396,7 @@ def pdf(request, id):
if text.type == 'pdf' and text.file and not text.uploading:
return HttpFileResponse(text.file.path, content_type='application/pdf')
response = json_response(status=404, text='file not found')
return render_to_json_response(response)
@login_required_json
def upload(request):

View file

@ -3,8 +3,6 @@
from __future__ import division
import unicodedata
from django.db.models import Max, Min
import ox
from ox.utils import json

View file

@ -1,12 +1,12 @@
# -*- coding: utf-8 -*-
# vi:si:et:sw=4:sts=4:ts=4
from datetime import timedelta, datetime
from datetime import timedelta
from celery.task import task, periodic_task
from django.contrib.auth.models import User
from celery.task import periodic_task
import models
@periodic_task(run_every=timedelta(days=1), queue='encoding')
def update_program(**kwargs):
for c in models.Channel.objects.all():

View file

@ -1,6 +1,5 @@
# -*- coding: utf-8 -*-
# vi:si:et:sw=4:sts=4:ts=4
from optparse import make_option
from django.core.management.base import BaseCommand

View file

@ -3,7 +3,7 @@
import copy
from datetime import datetime
from django.contrib.auth.models import User, Group
from django.contrib.auth.models import User
from django.db import models
from django.db.models import Max
from django.conf import settings
@ -273,7 +273,7 @@ def get_ui(user_ui, user=None):
pos = P.objects.get(text=t, section=section)
created = False
except P.DoesNotExist:
pos = P(text=t, section=section, user=l.user)
pos = P(text=t, section=section, user=t.user)
pos.save()
created = True
else:
@ -303,7 +303,7 @@ def get_ui(user_ui, user=None):
def init_user(user, request=None):
if request:
data = SessionData.get_or_create(request)
SessionData.get_or_create(request)
if user.is_anonymous():
result = settings.CONFIG['user'].copy()
result['ui'] = get_ui(json.loads(request.session.get('ui', '{}')))

View file

@ -1,11 +1,6 @@
# -*- coding: utf-8 -*-
# vi:si:et:sw=4:sts=4:ts=4
import os
from datetime import timedelta, datetime
import gzip
from django.conf import settings
from celery.task import task
import models

View file

@ -2,14 +2,12 @@
# vi:si:et:sw=4:sts=4:ts=4
import random
random.seed()
import re
from django.contrib.auth import authenticate, login, logout
from django.template import RequestContext, loader
from django.utils import simplejson as json
from django.conf import settings
from django.core.mail import send_mail, BadHeaderError, EmailMessage
from django.db.models import Sum
from django.shortcuts import redirect
from ox.django.shortcuts import render_to_json_response, json_response, get_object_or_404_json
@ -729,7 +727,6 @@ actions.register(editPreferences, cache=False)
def reset_ui(request):
response = json_response()
if request.user.is_authenticated():
profile = request.user.get_profile()
profile.ui = {}