mirror of https://github.com/zulip/zulip.git
analytics/zilencer/zproject: Remove unused imports.
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
This commit is contained in:
parent
4e0a79d146
commit
f5197518a9
|
@ -2,11 +2,11 @@ import time
|
||||||
from collections import OrderedDict, defaultdict
|
from collections import OrderedDict, defaultdict
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
import logging
|
import logging
|
||||||
from typing import Any, Callable, Dict, List, \
|
from typing import Callable, Dict, List, \
|
||||||
Optional, Tuple, Type, Union
|
Optional, Tuple, Type, Union
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.db import connection, models
|
from django.db import connection
|
||||||
from django.db.models import F
|
from django.db.models import F
|
||||||
|
|
||||||
from analytics.models import BaseCount, \
|
from analytics.models import BaseCount, \
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
from argparse import ArgumentParser
|
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
|
|
||||||
from django.core.management.base import BaseCommand
|
from django.core.management.base import BaseCommand
|
||||||
from django.utils.timezone import now as timezone_now
|
from django.utils.timezone import now as timezone_now
|
||||||
|
|
||||||
from analytics.models import InstallationCount, installation_epoch, \
|
from analytics.models import installation_epoch, \
|
||||||
last_successful_fill
|
last_successful_fill
|
||||||
from analytics.lib.counts import COUNT_STATS, CountStat
|
from analytics.lib.counts import COUNT_STATS, CountStat
|
||||||
from zerver.lib.timestamp import floor_to_hour, floor_to_day, verify_UTC, \
|
from zerver.lib.timestamp import floor_to_hour, floor_to_day, verify_UTC, \
|
||||||
|
@ -12,7 +11,6 @@ from zerver.lib.timestamp import floor_to_hour, floor_to_day, verify_UTC, \
|
||||||
from zerver.models import Realm
|
from zerver.models import Realm
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
|
||||||
import time
|
import time
|
||||||
from typing import Any, Dict
|
from typing import Any, Dict
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
|
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
from typing import Any, Dict, List, Mapping, Optional, Type, Union
|
from typing import Any, Dict, List, Mapping, Optional, Type
|
||||||
|
|
||||||
from django.core.management.base import BaseCommand
|
from django.core.management.base import BaseCommand
|
||||||
from django.utils.timezone import now as timezone_now
|
from django.utils.timezone import now as timezone_now
|
||||||
|
@ -13,7 +13,7 @@ from analytics.models import BaseCount, FillState, RealmCount, UserCount, \
|
||||||
StreamCount, InstallationCount
|
StreamCount, InstallationCount
|
||||||
from zerver.lib.actions import do_change_is_admin
|
from zerver.lib.actions import do_change_is_admin
|
||||||
from zerver.lib.timestamp import floor_to_day
|
from zerver.lib.timestamp import floor_to_day
|
||||||
from zerver.models import Realm, UserProfile, Stream, Message, Client, \
|
from zerver.models import Realm, UserProfile, Stream, Client, \
|
||||||
RealmAuditLog, Recipient
|
RealmAuditLog, Recipient
|
||||||
|
|
||||||
class Command(BaseCommand):
|
class Command(BaseCommand):
|
||||||
|
|
|
@ -2,7 +2,6 @@ import datetime
|
||||||
from argparse import ArgumentParser
|
from argparse import ArgumentParser
|
||||||
from typing import Any, List
|
from typing import Any, List
|
||||||
|
|
||||||
import pytz
|
|
||||||
from django.core.management.base import BaseCommand
|
from django.core.management.base import BaseCommand
|
||||||
from django.db.models import Count
|
from django.db.models import Count
|
||||||
from django.utils.timezone import now as timezone_now
|
from django.utils.timezone import now as timezone_now
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
import datetime
|
import datetime
|
||||||
from typing import Any, Dict, Optional, Tuple, Union
|
from typing import Optional
|
||||||
|
|
||||||
from django.db import models
|
from django.db import models
|
||||||
|
|
||||||
from zerver.lib.timestamp import floor_to_day
|
from zerver.lib.timestamp import floor_to_day
|
||||||
from zerver.models import Realm, Recipient, Stream, UserProfile
|
from zerver.models import Realm, Stream, UserProfile
|
||||||
|
|
||||||
class FillState(models.Model):
|
class FillState(models.Model):
|
||||||
property = models.CharField(max_length=40, unique=True) # type: str
|
property = models.CharField(max_length=40, unique=True) # type: str
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
|
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
from typing import Any, Dict, List, Optional, Tuple, Type, Union
|
from typing import Any, Dict, List, Optional, Tuple, Type
|
||||||
|
|
||||||
import ujson
|
import ujson
|
||||||
from django.apps import apps
|
from django.apps import apps
|
||||||
|
@ -10,14 +10,14 @@ from django.test import TestCase
|
||||||
from django.utils.timezone import now as timezone_now
|
from django.utils.timezone import now as timezone_now
|
||||||
from django.utils.timezone import utc as timezone_utc
|
from django.utils.timezone import utc as timezone_utc
|
||||||
|
|
||||||
from analytics.lib.counts import COUNT_STATS, CountStat, DataCollector, \
|
from analytics.lib.counts import COUNT_STATS, CountStat, \
|
||||||
DependentCountStat, LoggingCountStat, do_aggregate_to_summary_table, \
|
DependentCountStat, LoggingCountStat, do_aggregate_to_summary_table, \
|
||||||
do_drop_all_analytics_tables, do_drop_single_stat, \
|
do_drop_all_analytics_tables, do_drop_single_stat, \
|
||||||
do_fill_count_stat_at_hour, do_increment_logging_stat, \
|
do_fill_count_stat_at_hour, do_increment_logging_stat, \
|
||||||
process_count_stat, sql_data_collector
|
process_count_stat, sql_data_collector
|
||||||
from analytics.models import BaseCount, \
|
from analytics.models import BaseCount, \
|
||||||
FillState, InstallationCount, RealmCount, StreamCount, \
|
FillState, InstallationCount, RealmCount, StreamCount, \
|
||||||
UserCount, installation_epoch, last_successful_fill
|
UserCount, installation_epoch
|
||||||
from zerver.lib.actions import do_activate_user, do_create_user, \
|
from zerver.lib.actions import do_activate_user, do_create_user, \
|
||||||
do_deactivate_user, do_reactivate_user, update_user_activity_interval, \
|
do_deactivate_user, do_reactivate_user, update_user_activity_interval, \
|
||||||
do_invite_users, do_revoke_user_invite, do_resend_user_invite_email, \
|
do_invite_users, do_revoke_user_invite, do_resend_user_invite_email, \
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
from typing import Dict, List, Optional
|
from typing import List, Optional
|
||||||
|
|
||||||
import mock
|
import mock
|
||||||
from django.utils.timezone import utc
|
from django.utils.timezone import utc
|
||||||
|
@ -8,8 +8,8 @@ from analytics.lib.counts import COUNT_STATS, CountStat
|
||||||
from analytics.lib.time_utils import time_range
|
from analytics.lib.time_utils import time_range
|
||||||
from analytics.models import FillState, \
|
from analytics.models import FillState, \
|
||||||
RealmCount, UserCount, last_successful_fill
|
RealmCount, UserCount, last_successful_fill
|
||||||
from analytics.views import get_chart_data, rewrite_client_arrays, \
|
from analytics.views import rewrite_client_arrays, \
|
||||||
sort_by_totals, sort_client_labels, stats
|
sort_by_totals, sort_client_labels
|
||||||
from zerver.lib.test_classes import ZulipTestCase
|
from zerver.lib.test_classes import ZulipTestCase
|
||||||
from zerver.lib.timestamp import ceiling_to_day, \
|
from zerver.lib.timestamp import ceiling_to_day, \
|
||||||
ceiling_to_hour, datetime_to_timestamp
|
ceiling_to_hour, datetime_to_timestamp
|
||||||
|
|
|
@ -16,12 +16,11 @@ from django.http import HttpRequest, HttpResponse
|
||||||
from django.shortcuts import render
|
from django.shortcuts import render
|
||||||
from django.utils.timezone import now as timezone_now
|
from django.utils.timezone import now as timezone_now
|
||||||
|
|
||||||
from zerver.lib.utils import generate_random_token
|
|
||||||
from zerver.models import PreregistrationUser, EmailChangeStatus, MultiuseInvite, \
|
from zerver.models import PreregistrationUser, EmailChangeStatus, MultiuseInvite, \
|
||||||
UserProfile, Realm
|
UserProfile, Realm
|
||||||
from random import SystemRandom
|
from random import SystemRandom
|
||||||
import string
|
import string
|
||||||
from typing import Any, Dict, Optional, Union
|
from typing import Dict, Optional, Union
|
||||||
|
|
||||||
class ConfirmationKeyException(Exception):
|
class ConfirmationKeyException(Exception):
|
||||||
WRONG_LENGTH = 1
|
WRONG_LENGTH = 1
|
||||||
|
|
|
@ -2,8 +2,6 @@
|
||||||
|
|
||||||
# Copyright: (c) 2008, Jarek Zgoda <jarek.zgoda@gmail.com>
|
# Copyright: (c) 2008, Jarek Zgoda <jarek.zgoda@gmail.com>
|
||||||
|
|
||||||
from typing import Any, Dict
|
|
||||||
|
|
||||||
__revision__ = '$Id: settings.py 12 2008-11-23 19:38:52Z jarek.zgoda $'
|
__revision__ = '$Id: settings.py 12 2008-11-23 19:38:52Z jarek.zgoda $'
|
||||||
|
|
||||||
STATUS_ACTIVE = 1
|
STATUS_ACTIVE = 1
|
||||||
|
|
|
@ -14,7 +14,6 @@ from django.utils.timezone import now as timezone_now
|
||||||
from django.core.signing import Signer
|
from django.core.signing import Signer
|
||||||
import stripe
|
import stripe
|
||||||
|
|
||||||
from zerver.lib.exceptions import JsonableError
|
|
||||||
from zerver.lib.logging_util import log_to_file
|
from zerver.lib.logging_util import log_to_file
|
||||||
from zerver.lib.timestamp import datetime_to_timestamp, timestamp_to_datetime
|
from zerver.lib.timestamp import datetime_to_timestamp, timestamp_to_datetime
|
||||||
from zerver.lib.utils import generate_random_token
|
from zerver.lib.utils import generate_random_token
|
||||||
|
|
|
@ -5,7 +5,7 @@ from typing import Optional
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.db.models import CASCADE
|
from django.db.models import CASCADE
|
||||||
|
|
||||||
from zerver.models import Realm, RealmAuditLog
|
from zerver.models import Realm
|
||||||
|
|
||||||
class Customer(models.Model):
|
class Customer(models.Model):
|
||||||
realm = models.OneToOneField(Realm, on_delete=CASCADE) # type: Realm
|
realm = models.OneToOneField(Realm, on_delete=CASCADE) # type: Realm
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
from functools import partial, wraps
|
from functools import wraps
|
||||||
from mock import Mock, patch
|
from mock import Mock, patch
|
||||||
import operator
|
import operator
|
||||||
import os
|
import os
|
||||||
|
@ -11,7 +11,6 @@ import ujson
|
||||||
import json
|
import json
|
||||||
|
|
||||||
from django.core import signing
|
from django.core import signing
|
||||||
from django.core.management import call_command
|
|
||||||
from django.core.urlresolvers import get_resolver
|
from django.core.urlresolvers import get_resolver
|
||||||
from django.http import HttpResponse
|
from django.http import HttpResponse
|
||||||
from django.utils.timezone import utc as timezone_utc
|
from django.utils.timezone import utc as timezone_utc
|
||||||
|
@ -19,22 +18,20 @@ from django.utils.timezone import utc as timezone_utc
|
||||||
import stripe
|
import stripe
|
||||||
|
|
||||||
from zerver.lib.actions import do_deactivate_user, do_create_user, \
|
from zerver.lib.actions import do_deactivate_user, do_create_user, \
|
||||||
do_activate_user, do_reactivate_user, do_create_realm
|
do_activate_user, do_reactivate_user
|
||||||
from zerver.lib.test_classes import ZulipTestCase
|
from zerver.lib.test_classes import ZulipTestCase
|
||||||
from zerver.lib.timestamp import timestamp_to_datetime, datetime_to_timestamp
|
from zerver.lib.timestamp import timestamp_to_datetime, datetime_to_timestamp
|
||||||
from zerver.models import Realm, UserProfile, get_realm, RealmAuditLog
|
from zerver.models import Realm, UserProfile, get_realm, RealmAuditLog
|
||||||
from corporate.lib.stripe import catch_stripe_errors, attach_discount_to_realm, \
|
from corporate.lib.stripe import catch_stripe_errors, attach_discount_to_realm, \
|
||||||
get_seat_count, sign_string, unsign_string, \
|
get_seat_count, sign_string, unsign_string, \
|
||||||
BillingError, StripeCardError, StripeConnectionError, stripe_get_customer, \
|
BillingError, StripeCardError, stripe_get_customer, \
|
||||||
DEFAULT_INVOICE_DAYS_UNTIL_DUE, MIN_INVOICED_LICENSES, do_create_stripe_customer, \
|
MIN_INVOICED_LICENSES, \
|
||||||
add_months, next_month, next_renewal_date, renewal_amount, \
|
add_months, next_month, \
|
||||||
compute_plan_parameters, update_or_create_stripe_customer, \
|
compute_plan_parameters, update_or_create_stripe_customer, \
|
||||||
process_initial_upgrade, add_plan_renewal_to_license_ledger_if_needed, \
|
process_initial_upgrade, add_plan_renewal_to_license_ledger_if_needed, \
|
||||||
update_license_ledger_if_needed, update_license_ledger_for_automanaged_plan, \
|
update_license_ledger_if_needed, update_license_ledger_for_automanaged_plan, \
|
||||||
invoice_plan, invoice_plans_as_needed
|
invoice_plan, invoice_plans_as_needed
|
||||||
from corporate.models import Customer, CustomerPlan, LicenseLedger
|
from corporate.models import Customer, CustomerPlan, LicenseLedger
|
||||||
from corporate.views import payment_method_string
|
|
||||||
import corporate.urls
|
|
||||||
|
|
||||||
CallableT = TypeVar('CallableT', bound=Callable[..., Any])
|
CallableT = TypeVar('CallableT', bound=Callable[..., Any])
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import itertools
|
import itertools
|
||||||
import mock
|
|
||||||
import os
|
import os
|
||||||
import random
|
import random
|
||||||
from typing import Any, Callable, Dict, Iterable, List, \
|
from typing import Any, Callable, Dict, Iterable, List, \
|
||||||
|
@ -21,13 +20,12 @@ from zerver.lib.cache import cache_set
|
||||||
from zerver.lib.generate_test_data import create_test_data
|
from zerver.lib.generate_test_data import create_test_data
|
||||||
from zerver.lib.onboarding import create_if_missing_realm_internal_bots
|
from zerver.lib.onboarding import create_if_missing_realm_internal_bots
|
||||||
from zerver.lib.push_notifications import logger as push_notifications_logger
|
from zerver.lib.push_notifications import logger as push_notifications_logger
|
||||||
from zerver.lib.upload import upload_backend
|
|
||||||
from zerver.lib.users import add_service
|
from zerver.lib.users import add_service
|
||||||
from zerver.lib.url_preview.preview import CACHE_NAME as PREVIEW_CACHE_NAME
|
from zerver.lib.url_preview.preview import CACHE_NAME as PREVIEW_CACHE_NAME
|
||||||
from zerver.lib.user_groups import create_user_group
|
from zerver.lib.user_groups import create_user_group
|
||||||
from zerver.lib.utils import generate_api_key
|
from zerver.lib.utils import generate_api_key
|
||||||
from zerver.models import CustomProfileField, DefaultStream, Message, Realm, RealmAuditLog, \
|
from zerver.models import CustomProfileField, DefaultStream, Message, Realm, RealmAuditLog, \
|
||||||
RealmDomain, RealmEmoji, Recipient, Service, Stream, Subscription, \
|
RealmDomain, Recipient, Service, Stream, Subscription, \
|
||||||
UserMessage, UserPresence, UserProfile, clear_database, \
|
UserMessage, UserPresence, UserProfile, clear_database, \
|
||||||
email_to_username, get_client, get_huddle, get_realm, get_stream, \
|
email_to_username, get_client, get_huddle, get_realm, get_stream, \
|
||||||
get_system_bot, get_user, get_user_profile_by_id
|
get_system_bot, get_user, get_user_profile_by_id
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import logging
|
import logging
|
||||||
from typing import Any, Dict, List, Set, Tuple, Optional, Sequence
|
from typing import Any, Dict, List, Set, Tuple, Optional
|
||||||
|
|
||||||
from django_auth_ldap.backend import LDAPBackend, _LDAPUser
|
from django_auth_ldap.backend import LDAPBackend, _LDAPUser
|
||||||
import django.contrib.auth
|
import django.contrib.auth
|
||||||
|
@ -14,15 +14,11 @@ from social_core.backends.github import GithubOAuth2, GithubOrganizationOAuth2,
|
||||||
from social_core.backends.azuread import AzureADOAuth2
|
from social_core.backends.azuread import AzureADOAuth2
|
||||||
from social_core.backends.base import BaseAuth
|
from social_core.backends.base import BaseAuth
|
||||||
from social_core.backends.oauth import BaseOAuth2
|
from social_core.backends.oauth import BaseOAuth2
|
||||||
from social_core.utils import handle_http_errors
|
|
||||||
from social_core.exceptions import AuthFailed, SocialAuthBaseException
|
from social_core.exceptions import AuthFailed, SocialAuthBaseException
|
||||||
from social_django.models import DjangoStorage
|
|
||||||
from social_django.strategy import DjangoStrategy
|
|
||||||
|
|
||||||
from zerver.lib.actions import do_create_user, do_reactivate_user, do_deactivate_user
|
from zerver.lib.actions import do_create_user, do_reactivate_user, do_deactivate_user
|
||||||
from zerver.lib.dev_ldap_directory import init_fakeldap
|
from zerver.lib.dev_ldap_directory import init_fakeldap
|
||||||
from zerver.lib.request import JsonableError
|
from zerver.lib.request import JsonableError
|
||||||
from zerver.lib.subdomains import user_matches_subdomain, get_subdomain
|
|
||||||
from zerver.lib.users import check_full_name
|
from zerver.lib.users import check_full_name
|
||||||
from zerver.models import PreregistrationUser, UserProfile, Realm, get_default_stream_groups, \
|
from zerver.models import PreregistrationUser, UserProfile, Realm, get_default_stream_groups, \
|
||||||
get_user_profile_by_id, remote_user_to_email, email_to_username, get_realm, \
|
get_user_profile_by_id, remote_user_to_email, email_to_username, get_realm, \
|
||||||
|
|
|
@ -401,7 +401,7 @@ EMAIL_GATEWAY_IMAP_FOLDER = "INBOX"
|
||||||
# optionally using LDAP as an authentication mechanism.
|
# optionally using LDAP as an authentication mechanism.
|
||||||
|
|
||||||
import ldap
|
import ldap
|
||||||
from django_auth_ldap.config import LDAPSearch, GroupOfNamesType, LDAPSearchUnion
|
from django_auth_ldap.config import LDAPSearch
|
||||||
|
|
||||||
########
|
########
|
||||||
# LDAP integration, part 1: Connecting to the LDAP server.
|
# LDAP integration, part 1: Connecting to the LDAP server.
|
||||||
|
|
|
@ -12,7 +12,6 @@
|
||||||
########################################################################
|
########################################################################
|
||||||
from copy import deepcopy
|
from copy import deepcopy
|
||||||
import os
|
import os
|
||||||
import platform
|
|
||||||
import time
|
import time
|
||||||
import sys
|
import sys
|
||||||
from typing import Any, Optional
|
from typing import Any, Optional
|
||||||
|
|
|
@ -8,7 +8,7 @@ import os
|
||||||
import zerver.forms
|
import zerver.forms
|
||||||
from zproject import dev_urls
|
from zproject import dev_urls
|
||||||
from zproject.legacy_urls import legacy_urls
|
from zproject.legacy_urls import legacy_urls
|
||||||
from zerver.views.integrations import IntegrationView, APIView, MarkdownDirectoryView
|
from zerver.views.integrations import IntegrationView, MarkdownDirectoryView
|
||||||
from zerver.lib.integrations import WEBHOOK_INTEGRATIONS
|
from zerver.lib.integrations import WEBHOOK_INTEGRATIONS
|
||||||
from zerver.webhooks import github_dispatcher
|
from zerver.webhooks import github_dispatcher
|
||||||
|
|
||||||
|
|
|
@ -4,13 +4,8 @@ from __future__ import absolute_import
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
from six.moves.urllib.parse import urlparse
|
|
||||||
from typing import Any, Text, Tuple, Optional
|
from typing import Any, Text, Tuple, Optional
|
||||||
|
|
||||||
if False:
|
|
||||||
# See https://zulip.readthedocs.io/en/latest/testing/mypy.html#mypy-in-production-scripts
|
|
||||||
from thumbor.context import Context
|
|
||||||
|
|
||||||
ZULIP_PATH = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath('__file__'))))
|
ZULIP_PATH = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath('__file__'))))
|
||||||
sys.path.append(ZULIP_PATH)
|
sys.path.append(ZULIP_PATH)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue