Clean up some unused imports.

(imported from commit 0c5d8e2a55ba1b8909ba807fee3afe863dcdc226)
This commit is contained in:
Tim Abbott 2013-11-04 11:22:58 -05:00 committed by Zev Benjamin
parent 2b24fbf523
commit 68dcc760c3
30 changed files with 31 additions and 81 deletions

View File

@ -31,7 +31,6 @@
import requests
import logging
import calendar
import time
import sys
import os

View File

@ -10,9 +10,7 @@ import irc.bot
import irc.strings
from irc.client import ip_numstr_to_quad, ip_quad_to_numstr
import zulip
import time
import optparse
import sys
def zulip_sender(sender_string):
nick = sender_string.split("!")[0]

View File

@ -1,6 +1,5 @@
#!/usr/bin/python
import sys
import os
import subprocess
import base64

View File

@ -1,8 +1,6 @@
#!/usr/bin/env python
import os
import sys
import re
import glob
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
from zulip_tools import check_output

View File

@ -5,7 +5,6 @@ from django.core.exceptions import ValidationError
from django.utils.safestring import mark_safe
from django.contrib.auth.forms import SetPasswordForm
from zproject import settings
from zerver.models import Realm, get_user_profile_by_email, UserProfile, \
completely_open
from zerver.lib.actions import do_change_password

View File

@ -20,7 +20,7 @@ from django.core.exceptions import ValidationError
from django.utils.importlib import import_module
from django.template import loader
from django.core.mail import EmailMultiAlternatives, EmailMessage
from django.utils.timezone import utc, is_naive, now
from django.utils.timezone import now
from confirmation.models import Confirmation
@ -45,8 +45,6 @@ from zerver.lib.alert_words import user_alert_words, add_user_alert_words, \
remove_user_alert_words, set_user_alert_words
from zerver.lib.push_notifications import num_push_devices_for_user, send_apple_push_notification
import confirmation.settings
from zerver import tornado_callbacks
import DNS

View File

@ -1,13 +1,7 @@
from __future__ import absolute_import
import re
import zerver.models
from zerver.lib.cache import cache_with_key, realm_alert_words_cache_key
import itertools
import logging
import ujson
@cache_with_key(realm_alert_words_cache_key, timeout=3600*24)

View File

@ -25,14 +25,8 @@
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
import base64
import json
import os
import readline
import struct
import subprocess
import sys
# Some DER encoding stuff. Bleh. This is because the ccache contains a
# DER-encoded krb5 Ticket structure, whereas Webathena deserializes

View File

@ -16,7 +16,6 @@ import tornado
import random
from zerver.lib.utils import statsd
from zerver.middleware import async_request_restart
from zerver.models import get_client
# The idle timeout used to be a week, but we found that in that
# situation, queues from dead browser sessions would grow quite large

View File

@ -1,10 +1,5 @@
from __future__ import absolute_import
import re
from django.db.models import F, Q
import zerver.models
# Match multi-word string between @** ** or match any one-word
# sequences after @
find_mentions = r'(?<![^\s\'\"\(,:<])@(?:\*\*([^\*]+)\*\*|(\w+))'

View File

@ -1,10 +1,10 @@
from __future__ import absolute_import
from zerver.models import UserProfile, AppleDeviceToken
from zerver.models import AppleDeviceToken
from zerver.lib.timestamp import timestamp_to_datetime
from zerver.decorator import statsd_increment
from apnsclient import Session, Connection, Message, APNs
from apnsclient import Session, Message, APNs
from django.conf import settings

View File

@ -1,11 +1,11 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from zerver.models import UserProfile, Realm, UserActivity, UserActivityInterval
from zerver.models import UserProfile, UserActivity, UserActivityInterval
from django.utils.timezone import utc
from datetime import timedelta, datetime
from datetime import timedelta
from itertools import chain
def median(data):

View File

@ -13,7 +13,6 @@ import base64
import os
from PIL import Image, ImageOps
from StringIO import StringIO
import errno
import random
# Performance Note:

View File

@ -4,11 +4,9 @@ from zerver.lib.statistics import seconds_usage_between
from optparse import make_option
from django.core.management.base import BaseCommand
from zerver.models import get_user_profile_by_email, UserActivityInterval, \
UserProfile
import sys
from zerver.models import UserProfile
import datetime
from django.utils.timezone import utc, is_naive
from django.utils.timezone import utc
def analyze_activity(options):
day_start = datetime.datetime.strptime(options["date"], "%Y-%m-%d").replace(tzinfo=utc)

View File

@ -1,12 +1,7 @@
from __future__ import absolute_import
from django.core.management.base import BaseCommand
from django.conf import settings
from zerver.models import AppleDeviceToken
from zerver.lib.push_notifications import check_apns_feedback
import logging
class Command(BaseCommand):
help = """Checks the Apple Push Notifications Service for any tokens that have been

View File

@ -1,7 +1,6 @@
from __future__ import absolute_import
from optparse import make_option
from django.template import loader
from django.core.management.base import BaseCommand
from zerver.lib.actions import send_local_email_template_with_delay, clear_followup_emails_queue
from datetime import timedelta

View File

@ -1,9 +1,8 @@
from __future__ import absolute_import
import sys
import requests
from zerver.models import get_user_profile_by_email, UserProfile
from zerver.lib.avatar import gravatar_hash, user_avatar_hash
from zerver.lib.avatar import gravatar_hash
from zerver.lib.upload import upload_avatar_image
from django.core.management.base import BaseCommand, CommandError
from django.core.files.uploadedfile import SimpleUploadedFile

View File

@ -1,16 +1,13 @@
from __future__ import absolute_import
import sys
from optparse import make_option
from django.core.management.base import BaseCommand, CommandError
from django.core.exceptions import ValidationError
from django.db.utils import IntegrityError
from django.core import validators
from guardian.shortcuts import assign_perm, remove_perm
from zerver.models import Realm, UserProfile
from zerver.models import UserProfile
class Command(BaseCommand):
help = """Give an existing user administrative permissions over their (own) Realm.

View File

@ -3,7 +3,6 @@ from __future__ import absolute_import
from django.core.management.base import BaseCommand
from django.core.management import CommandError
from zerver.lib.queue import SimpleQueueClient
import logging
class Command(BaseCommand):
args = "<queue name>"

View File

@ -2,7 +2,7 @@ from __future__ import absolute_import
from optparse import make_option
from django.core.management.base import BaseCommand
from zerver.models import RealmEmoji, Realm
from zerver.models import Realm
from zerver.lib.actions import do_add_realm_emoji, do_remove_realm_emoji
import sys

View File

@ -2,7 +2,7 @@ from __future__ import absolute_import
from django.core.management.base import BaseCommand
from zerver.models import UserProfile, Message, get_user_profile_by_email
from zerver.models import Message
import datetime
import time

View File

@ -8,7 +8,7 @@ from django.core.management.base import BaseCommand
from zerver.lib import utils
from zerver.models import UserMessage, get_user_profile_by_email
from django.db import transaction, models
from django.db import models
class Command(BaseCommand):

View File

@ -9,7 +9,7 @@ from zerver.lib.cache import cache_with_key, update_user_profile_cache, \
generic_bulk_cached_fetch, cache_set, \
display_recipient_cache_key, active_user_dicts_in_realm_cache_key
from zerver.lib.utils import make_safe_digest, generate_random_token
from django.db import transaction, IntegrityError
from django.db import transaction
from zerver.lib import bugdown
from zerver.lib.avatar import gravatar_hash, get_avatar_url
from django.utils import timezone

View File

@ -7,7 +7,7 @@ from zerver.models import get_client
from zerver.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, \
authenticated_rest_api_view, REQ
REQ
from zerver.lib.response import json_success, json_error
from zerver.middleware import async_request_restart

View File

@ -7,7 +7,7 @@ from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect, HttpResponseForbidden
from django.shortcuts import render_to_response, redirect
from django.template import RequestContext, loader
from django.utils.timezone import now, utc
from django.utils.timezone import now
from django.utils.html import mark_safe
from django.utils.cache import patch_cache_control
from django.core.exceptions import ValidationError
@ -16,35 +16,35 @@ from django.contrib.auth.views import login as django_login_page, \
logout_then_login as django_logout_then_login
from django.db.models import Q, F
from django.core.mail import send_mail, mail_admins, EmailMessage
from django.db import transaction, IntegrityError
from django.db import transaction
from zerver.models import Message, UserProfile, Stream, Subscription, \
Recipient, Realm, UserMessage, bulk_get_recipients, \
PreregistrationUser, get_client, MitUser, UserActivity, UserActivityInterval, \
MAX_SUBJECT_LENGTH, get_stream, bulk_get_streams, UserPresence, \
get_recipient, valid_stream_name, to_dict_cache_key, to_dict_cache_key_id, \
get_stream, bulk_get_streams, UserPresence, \
get_recipient, valid_stream_name, to_dict_cache_key_id, \
extract_message_dict, stringify_message_dict, parse_usermessage_flags, \
email_to_domain, email_to_username, get_realm, completely_open, \
is_super_user, AppleDeviceToken, get_active_user_dicts_in_realm
from zerver.lib.actions import do_remove_subscription, bulk_remove_subscriptions, \
from zerver.lib.actions import bulk_remove_subscriptions, \
do_change_password, create_mirror_user_if_needed, compute_irc_user_fullname, \
compute_jabber_user_fullname, 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, \
do_activate_user, do_create_user, check_send_message, \
do_change_subscription_property, internal_send_message, \
create_stream_if_needed, gather_subscriptions, subscribed_to_stream, \
create_stream_if_needed, gather_subscriptions, \
update_user_presence, bulk_add_subscriptions, do_update_message_flags, \
recipient_for_emails, extract_recipients, do_events_register, \
get_status_dict, do_change_enable_offline_email_notifications, \
do_update_message, internal_prep_message, \
do_send_messages, do_add_subscription, get_default_subs, do_deactivate, \
do_send_messages, get_default_subs, do_deactivate, \
user_email_is_unique, do_invite_users, do_refer_friend, compute_mit_user_fullname, \
do_add_alert_words, do_remove_alert_words, do_set_alert_words, get_subscriber_emails, \
update_user_activity_interval, do_set_muted_topics, do_rename_stream, \
do_set_muted_topics, do_rename_stream, \
notify_for_streams_by_default, do_change_enable_offline_push_notifications
from zerver.lib.create_user import random_api_key
from zerver.lib.push_notifications import num_push_devices_for_user
from zerver.forms import RegistrationForm, HomepageForm, ToSForm, CreateBotForm, \
is_inactive, not_mit_mailing_list
is_inactive
from django.views.decorators.csrf import csrf_exempt, csrf_protect
from django_openid_auth.views import default_render_failure, login_complete
from openid.consumer.consumer import SUCCESS as openid_SUCCESS
@ -56,16 +56,14 @@ from zerver.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, get_user_profile_by_email, \
authenticated_rest_api_view, process_as_post, REQ, rate_limit_user, \
JsonableError, get_user_profile_by_email, process_as_post, REQ, \
zulip_internal
from zerver.lib.query import last_n
from zerver.lib.avatar import avatar_url
from zerver.lib.upload import upload_message_image_through_web_client, upload_avatar_image, \
get_signed_upload_url
from zerver.lib.response import json_success, json_error, json_response, json_method_not_allowed
from zerver.lib.cache import cache_get_many, cache_set_many, \
generic_bulk_cached_fetch
from zerver.lib.cache import generic_bulk_cached_fetch
from zerver.lib.unminify import SourceMap
from zerver.lib.queue import queue_json_publish
from zerver.lib.utils import statsd, generate_random_token

View File

@ -5,10 +5,10 @@ from __future__ import absolute_import
from django.conf import settings
from django.views.decorators.csrf import csrf_exempt
from zerver.models import UserProfile, get_client, MAX_SUBJECT_LENGTH, \
get_user_profile_by_email, Realm
get_user_profile_by_email
from zerver.lib.actions import check_send_message
from zerver.lib.response import json_success, json_error
from zerver.decorator import rate_limit_user, authenticated_api_view, REQ, \
from zerver.decorator import authenticated_api_view, REQ, \
has_request_variables, json_to_dict, authenticated_rest_api_view, \
api_key_only_webhook_view
from zerver.views import send_message_backend
@ -20,7 +20,6 @@ import base64
import logging
import re
import ujson
import markdown.inlinepatterns
from functools import wraps
def github_generic_subject(noun, repository, blob):

View File

@ -2,7 +2,7 @@ from __future__ import absolute_import
from django.conf import settings
from postmonkey import PostMonkey, MailChimpException
from zerver.models import UserActivityInterval, get_user_profile_by_email, \
from zerver.models import get_user_profile_by_email, \
get_user_profile_by_id, get_prereg_user_by_email, get_client
from zerver.lib.context_managers import lockfile
from zerver.lib.queue import SimpleQueueClient, queue_json_publish
@ -18,7 +18,6 @@ from confirmation.models import Confirmation
import os
import sys
import ujson
import traceback
from collections import defaultdict
import time
import datetime

View File

@ -1,6 +1,5 @@
from __future__ import absolute_import
from optparse import make_option
import re
import sys
from django.core.management.base import BaseCommand

View File

@ -1,13 +1,12 @@
from django.http import HttpResponse
from django.views.decorators.csrf import csrf_exempt, csrf_protect
from django.views.decorators.csrf import csrf_exempt
from zerver.decorator import has_request_variables, REQ, json_to_dict
from zerver.lib.actions import internal_send_message
from zerver.lib.response import json_success, json_error, json_response, json_method_not_allowed
from zerver.lib.rest import rest_dispatch as _rest_dispatch
from zerver.models import get_realm, get_user_profile_by_email, email_to_domain, \
UserProfile, Realm
from zilencer.models import Deployment
UserProfile
rest_dispatch = csrf_exempt((lambda request, *args, **kwargs: _rest_dispatch(request, globals(), *args, **kwargs)))

View File

@ -1,7 +1,4 @@
# Template for Django settings for the Zulip local servers
import os
import platform
import re
# This is the user-accessible Zulip hostname for this installation
EXTERNAL_HOST = ''