Remove unused imports

(imported from commit 9e3050c72a2d1137b9096c6cfa1c3945341b9a56)
This commit is contained in:
Scott Feeney 2013-06-27 14:03:51 -04:00
parent 6144f18101
commit 83cd963c49
53 changed files with 27 additions and 108 deletions

View File

@ -3,7 +3,6 @@ import os
import sys
import optparse
import ConfigParser
from os import path
import humbug

View File

@ -32,7 +32,6 @@
import os
import sys
import subprocess
import time
import os.path
sys.path.insert(0, os.path.dirname(__file__))

View File

@ -1,7 +1,5 @@
#!/usr/bin/env python
import sys
import optparse
import os.path
import humbug
# Nagios passes the notification details as command line options.

View File

@ -31,8 +31,6 @@
import os
import sys
import subprocess
import time
import os.path
import pysvn

View File

@ -3,7 +3,6 @@
import humbug
import glob
import os
from distutils.core import setup

View File

@ -7,7 +7,6 @@ import random
import logging
import subprocess
import hashlib
from os import path
parser = optparse.OptionParser()
parser.add_option('--verbose',

View File

@ -1,7 +1,6 @@
#!/usr/bin/env python
import sys
import subprocess
import time
import optparse
from collections import defaultdict

View File

@ -1,7 +1,6 @@
#!/usr/bin/env python
import sys
import subprocess
import re
import time

View File

@ -1,8 +1,6 @@
#!/usr/bin/env python
import os
import sys
import time
import errno
import datetime
import optparse
import urlparse

View File

@ -23,8 +23,6 @@
import sys
import subprocess
import time
import optparse
import os
import traceback
import signal

View File

@ -1,6 +1,5 @@
from zephyr.models import UserProfile, get_user_profile_by_id, \
get_user_profile_by_email
from django.conf import settings
from openid.consumer.consumer import SUCCESS

View File

@ -1,7 +1,6 @@
# Django settings for humbug project.
import os
import platform
import logging
import time
import re

View File

@ -1,6 +1,5 @@
from settings import *
import os
import logging
DATABASES["default"] = {"NAME": "humbug_test",
"USER": "humbug_test",

View File

@ -10,7 +10,6 @@ Django ORM.
"""
import datetime
import os
import sys
import optparse
import random

View File

@ -7,7 +7,6 @@ import os, sys
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
import optparse
from itertools import dropwhile, takewhile
from datetime import timedelta, datetime
from zephyr.lib.timestamp import datetime_to_timestamp
from zephyr.lib.utils import statsd_key

View File

@ -3,7 +3,7 @@ import os
import logging
import datetime
import shutil
from humbug_tools import DEPLOYMENTS_DIR, LOCK_DIR, TIMESTAMP_FORMAT
from humbug_tools import DEPLOYMENTS_DIR, TIMESTAMP_FORMAT
logging.basicConfig(format="%(asctime)s purge-deployments: %(message)s",
level=logging.INFO)

View File

@ -3,11 +3,9 @@ import os
import sys
import pwd
import subprocess
import pylibmc
import traceback
import logging
import time
from humbug_tools import ENDC, WARNING, OKGREEN, DEPLOYMENTS_DIR
from humbug_tools import ENDC, OKGREEN, DEPLOYMENTS_DIR
logging.basicConfig(format="%(asctime)s restart-server: %(message)s",
level=logging.INFO)

View File

@ -42,7 +42,6 @@ from StringIO import StringIO
from email.message import Message
from email.header import Header
from shutil import rmtree, copyfile, copytree
from tempfile import NamedTemporaryFile
from time import sleep
from signal import SIGINT, SIGTERM
from errno import EAGAIN

View File

@ -2,8 +2,6 @@
import os
import sys
import subprocess
import pylibmc
import traceback
import logging
from humbug_tools import DEPLOYMENTS_DIR, LOCK_DIR, TIMESTAMP_FORMAT, FAIL, ENDC
import datetime

View File

@ -4,18 +4,14 @@ from django.views.decorators.csrf import csrf_exempt
from django.views.decorators.http import require_POST
from django.http import QueryDict
from django.http.multipartparser import MultiPartParser
from zephyr.models import UserProfile, UserActivity, get_client, \
get_user_profile_by_email
from zephyr.lib.response import json_success, json_error, HttpResponseUnauthorized
from zephyr.models import UserProfile, get_client, get_user_profile_by_email
from zephyr.lib.response import json_error, HttpResponseUnauthorized
from django.utils.timezone import now
from django.db import transaction, IntegrityError
from django.conf import settings
import ujson
from StringIO import StringIO
from zephyr.lib.cache import cache_with_key
from zephyr.lib.queue import queue_json_publish
from zephyr.lib.timestamp import datetime_to_timestamp
from zephyr.lib.cache import user_profile_by_email_cache_key
from zephyr.lib.utils import statsd
from zephyr.exceptions import RateLimited
from zephyr.lib.rate_limiter import incr_ratelimit, is_ratelimited, \

View File

@ -1,7 +1,6 @@
from __future__ import absolute_import
from django import forms
from django.core import validators
from django.core.exceptions import ValidationError
from django.utils.safestring import mark_safe
from django.contrib.auth.forms import SetPasswordForm

View File

@ -1,6 +1,5 @@
from __future__ import absolute_import
import sys
import logging
import traceback
import platform
@ -44,7 +43,6 @@ class AdminHumbugHandler(logging.Handler):
def emit(self, record):
# We have to defer imports to avoid circular imports in settings.py.
from zephyr.models import Recipient
from zephyr.lib.actions import internal_send_message

View File

@ -5,9 +5,6 @@ import urlparse
import re
import os.path
import glob
import urllib2
import itertools
import ujson
import twitter
import platform
import time
@ -634,7 +631,6 @@ def do_convert(md, realm):
# https://trac.humbughq.com/ticket/345
return timeout(5, _md_engine.convert, md)
except:
from zephyr.models import Recipient
from zephyr.lib.actions import internal_send_message
cleaned = _sanitize_for_log(md)

View File

@ -1,6 +1,4 @@
import logging
import traceback
from hashlib import sha256
from datetime import datetime, timedelta
# Adapted http://djangosnippets.org/snippets/2242/ by user s29 (October 25, 2010)

View File

@ -1,7 +1,6 @@
from __future__ import absolute_import
from django.conf import settings
from zephyr.models import get_user_profile_by_id
import redis
import time

View File

@ -2,7 +2,7 @@
from __future__ import absolute_import
import hashlib
from time import sleep, time
from time import sleep
from django.conf import settings
def statsd_key(val, clean_periods=False):

View File

@ -1,14 +1,12 @@
from __future__ import absolute_import
from django.core.management.base import BaseCommand
from django.conf import settings
from zephyr.models import UserProfile, UserPresence, UserActivity
from zephyr.models import UserPresence, UserActivity
from zephyr.lib.utils import statsd, statsd_key
from datetime import datetime, timedelta
from collections import defaultdict
import os, time
class Command(BaseCommand):
help = """Sends active user statistics to statsd.

View File

@ -2,9 +2,8 @@ from __future__ import absolute_import
from optparse import make_option
from django.core.management.base import BaseCommand
from zephyr.models import Realm, UserProfile, Recipient, Message, get_client
import ujson
from zephyr.lib.timestamp import datetime_to_timestamp, timestamp_to_datetime
from zephyr.models import Recipient, Message
from zephyr.lib.timestamp import timestamp_to_datetime
import datetime
import time
import logging

View File

@ -1,13 +1,13 @@
from __future__ import absolute_import
from zephyr.models import UserProfile, get_user_profile_by_id
from zephyr.lib.rate_limiter import redis_key, client, max_api_calls, max_api_window
from zephyr.models import get_user_profile_by_id
from zephyr.lib.rate_limiter import client, max_api_calls, max_api_window
from django.core.management.base import BaseCommand
from django.conf import settings
from optparse import make_option
import os, time, logging
import time, logging
class Command(BaseCommand):
help = """Checks redis to make sure our rate limiting system hasn't grown a bug and left redis with a bunch of data

View File

@ -1,7 +1,7 @@
from __future__ import absolute_import
from django.core.management.base import BaseCommand
from zephyr.models import StreamColor, Subscription
from zephyr.models import StreamColor
class Command(BaseCommand):
help = """Copies all colors from the StreamColor table to the Subscription table."""

View File

@ -5,7 +5,7 @@ from optparse import make_option
from django.core.management.base import BaseCommand
from zephyr.lib.actions import do_deactivate, user_sessions
from zephyr.models import UserProfile, get_user_profile_by_email
from zephyr.models import get_user_profile_by_email
class Command(BaseCommand):
help = "Deactivate a user, including forcibly logging them out."

View File

@ -2,7 +2,7 @@ from __future__ import absolute_import
from optparse import make_option
from django.core.management.base import BaseCommand
from zephyr.models import Realm, UserProfile, Message, UserMessage, \
from zephyr.models import UserProfile, Message, UserMessage, \
get_user_profile_by_email
from zephyr.lib.timestamp import datetime_to_timestamp, timestamp_to_datetime
import ujson

View File

@ -2,8 +2,7 @@ from __future__ import absolute_import
from optparse import make_option
from django.core.management.base import BaseCommand
from zephyr.models import Realm, UserActivity, get_client, \
get_user_profile_by_email
from zephyr.models import UserActivity, get_client, get_user_profile_by_email
import ujson
from zephyr.lib.timestamp import datetime_to_timestamp, timestamp_to_datetime

View File

@ -3,8 +3,6 @@ from __future__ import absolute_import
from optparse import make_option
from django.core.management.base import BaseCommand
from zephyr.lib.cache_helpers import fill_memcached_cache, cache_fillers
import subprocess
import os
class Command(BaseCommand):
option_list = BaseCommand.option_list + (

View File

@ -1,7 +1,5 @@
from __future__ import absolute_import
from optparse import make_option
from django.contrib.sites.models import Site
from django.core.management.base import BaseCommand
from confirmation.models import Confirmation
from zephyr.models import UserProfile, PreregistrationUser, \

View File

@ -1,7 +1,7 @@
from __future__ import absolute_import
from django.core.management.base import BaseCommand
from django.utils.timezone import utc, now
from django.utils.timezone import now
from django.contrib.sites.models import Site
from zephyr.models import Message, UserProfile, Stream, Recipient, Client, \
@ -22,7 +22,6 @@ import ujson
import datetime
import random
import glob
import sys
import os
from os import path
from optparse import make_option

View File

@ -1,9 +1,6 @@
from __future__ import absolute_import
from optparse import make_option
from django.core.management.base import BaseCommand
import ujson
import pika
from zephyr.lib.actions import process_user_activity_event, \
process_user_presence_event
from zephyr.lib.queue import SimpleQueueClient

View File

@ -2,11 +2,9 @@ from __future__ import absolute_import
from optparse import make_option
from django.core.management.base import BaseCommand
from confirmation.models import Confirmation
from zephyr.models import get_user_profile_by_email, UserMessage
from zephyr.views import get_old_messages_backend
import cProfile
import time
import logging
from zephyr.middleware import LogRequests

View File

@ -4,13 +4,8 @@ from zephyr.models import UserProfile, get_user_profile_by_email
from zephyr.lib.rate_limiter import block_user, unblock_user
from django.core.management.base import BaseCommand
from django.conf import settings
from optparse import make_option
from datetime import datetime, timedelta
from collections import defaultdict
import os, time
class Command(BaseCommand):
help = """Manually block or unblock a user from accessing the API

View File

@ -5,7 +5,7 @@ from optparse import make_option
from django.core.management.base import BaseCommand
from zephyr.lib.actions import do_remove_subscription
from zephyr.models import Realm, User, UserProfile, get_stream, \
from zephyr.models import Realm, UserProfile, get_stream, \
get_user_profile_by_email
class Command(BaseCommand):

View File

@ -16,7 +16,6 @@ import os
import sys
import tornado.web
import logging
import time
from tornado import ioloop
from zephyr.lib.debug import interactive_debug_listen
from zephyr.lib.response import json_response
@ -47,8 +46,7 @@ class Command(BaseCommand):
interactive_debug_listen()
import django
from django.core.handlers.wsgi import WSGIHandler
from tornado import httpserver, wsgi, web
from tornado import httpserver, web
try:
addr, port = addrport.split(':')

View File

@ -1,12 +1,10 @@
from __future__ import absolute_import
import time
import ujson
from collections import defaultdict
from django.core.management.base import BaseCommand
from django.conf import settings
from zephyr.lib.queue import SimpleQueueClient
from zephyr.lib.actions import handle_missedmessage_emails

View File

@ -5,7 +5,6 @@ from zephyr.lib.actions import set_default_streams, log_event
from optparse import make_option
import sys
import time
class Command(BaseCommand):
help = """Set default streams for a realm

View File

@ -6,7 +6,6 @@ import sys
from django.core.management.base import BaseCommand
from zephyr.lib.actions import do_deactivate
from zephyr.lib import utils
from zephyr.models import UserMessage, get_user_profile_by_email
from django.db import transaction, models

View File

@ -5,7 +5,6 @@ import logging
from django.core.management.base import BaseCommand
from zephyr.lib.actions import do_deactivate
from zephyr.lib import utils
from zephyr.models import UserMessage, UserProfile, \
get_user_profile_by_email

View File

@ -1,6 +1,3 @@
import datetime
import pytz
from django.core.management.base import BaseCommand
from django.db.models import Q
from zephyr.models import Realm, Stream, Message, Subscription, Recipient

View File

@ -1,6 +1,5 @@
from __future__ import absolute_import
import ujson
from postmonkey import PostMonkey
from django.core.management.base import BaseCommand
from django.conf import settings

View File

@ -1,7 +1,6 @@
from __future__ import absolute_import
from django.conf import settings
from zephyr.decorator import RequestVariableMissingError, RequestVariableConversionError
from zephyr.lib.response import json_error
from django.db import connection
from zephyr.lib.utils import statsd

View File

@ -7,13 +7,11 @@ from zephyr.lib.cache import cache_with_key, update_user_profile_cache, \
user_profile_by_id_cache_key, user_profile_by_email_cache_key, \
update_user_presence_cache
from zephyr.lib.utils import make_safe_digest
import os
from django.db import transaction, IntegrityError
from zephyr.lib import bugdown
from zephyr.lib.avatar import gravatar_hash, avatar_url
from django.utils import timezone
from django.contrib.sessions.models import Session
from django.utils.html import escape
from zephyr.lib.timestamp import datetime_to_timestamp
from django.db.models.signals import post_save
import zlib

View File

@ -19,14 +19,11 @@ from zephyr.lib import bugdown
from zephyr.lib.rate_limiter import clear_user_history
from django.conf import settings
import optparse
import os
import random
import re
import subprocess
import sys
import time
import traceback
import ujson
import urllib2
from StringIO import StringIO

View File

@ -7,9 +7,7 @@ from zephyr.models import Message, UserProfile, UserMessage, \
from zephyr.decorator import JsonableError
from zephyr.lib.cache_helpers import cache_get_message
from zephyr.lib.queue import queue_json_publish
from zephyr.lib.timestamp import timestamp_to_datetime
from zephyr.lib.event_queue import get_client_descriptors_for_user, \
add_client_gc_hook, IDLE_EVENT_QUEUE_TIMEOUT_SECS
from zephyr.lib.event_queue import get_client_descriptors_for_user
import os
import sys

View File

@ -1,14 +1,14 @@
from __future__ import absolute_import
from django.conf import settings
from zephyr.models import UserActivity, get_client
from zephyr.models import get_client
from zephyr.decorator import asynchronous, authenticated_api_view, \
authenticated_json_post_view, internal_notify_view, RespondAsynchronously, \
has_request_variables, to_non_negative_int, json_to_bool, json_to_list, \
JsonableError, authenticated_rest_api_view, REQ
authenticated_rest_api_view, REQ
from zephyr.lib.response import json_response, json_success, json_error
from zephyr.lib.response import json_success, json_error
from zephyr.middleware import async_request_restart
from zephyr.tornado_callbacks import \
get_user_pointer, fetch_stream_messages, fetch_user_messages, \
@ -18,12 +18,8 @@ from zephyr.tornado_callbacks import \
from zephyr.lib.cache_helpers import cache_get_message
from zephyr.lib.event_queue import allocate_client_descriptor, get_client_descriptor
import datetime
import ujson
import socket
import time
import sys
import logging
@internal_notify_view
def notify(request):

View File

@ -21,7 +21,7 @@ from zephyr.models import Message, UserProfile, Stream, Subscription, \
MAX_SUBJECT_LENGTH, get_stream, UserPresence, \
get_recipient, valid_stream_name, to_dict_cache_key, to_dict_cache_key_id, \
extract_message_dict, stringify_message_dict, parse_usermessage_flags
from zephyr.lib.actions import do_add_subscription, do_remove_subscription, \
from zephyr.lib.actions import do_remove_subscription, \
do_change_password, create_mit_user_if_needed, do_change_full_name, \
do_change_enable_desktop_notifications, do_change_enter_sends, do_change_enable_sounds, \
do_send_confirmation_email, do_activate_user, do_create_user, check_send_message, \
@ -35,7 +35,7 @@ from zephyr.lib.actions import do_add_subscription, do_remove_subscription, \
from zephyr.forms import RegistrationForm, HomepageForm, ToSForm, CreateBotForm, \
is_unique, is_inactive, isnt_mit
from django.views.decorators.csrf import csrf_exempt
from django_openid_auth.views import default_render_failure, login_complete, parse_openid_response
from django_openid_auth.views import default_render_failure, login_complete
from openid.consumer.consumer import SUCCESS as openid_SUCCESS
from openid.extensions import ax
@ -43,14 +43,13 @@ from zephyr.decorator import require_post, \
authenticated_api_view, authenticated_json_post_view, \
has_request_variables, authenticated_json_view, \
to_non_negative_int, json_to_dict, json_to_list, json_to_bool, \
JsonableError, RequestVariableMissingError, get_user_profile_by_email, \
authenticated_rest_api_view, process_as_post, REQ, rate_limit, rate_limit_user
JsonableError, get_user_profile_by_email, \
authenticated_rest_api_view, process_as_post, REQ, rate_limit_user
from zephyr.lib.query import last_n
from zephyr.lib.avatar import avatar_url
from zephyr.lib.upload import upload_message_image, upload_avatar_image
from zephyr.lib.response import json_success, json_error, json_response, json_method_not_allowed
from zephyr.lib.timestamp import datetime_to_timestamp
from zephyr.lib.cache import cache_with_key, cache_get_many, cache_set_many
from zephyr.lib.cache import cache_get_many, cache_set_many
from zephyr.lib.unminify import SourceMap
from zephyr.lib.queue import queue_json_publish
from zephyr.lib.utils import statsd