python: Sort imports in smaller apps.

This commit is contained in:
Tim Abbott 2017-11-15 15:55:49 -08:00
parent dc8dd2333c
commit 2b43a0302a
49 changed files with 189 additions and 210 deletions

View File

@ -1,21 +1,21 @@
import time
from collections import OrderedDict, defaultdict
from datetime import datetime, timedelta
from typing import Any, Callable, Dict, List, \
Optional, Text, Tuple, Type, Union
from django.conf import settings
from django.db import connection, models
from django.db.models import F
from analytics.models import InstallationCount, RealmCount, \
UserCount, StreamCount, BaseCount, FillState, Anomaly, installation_epoch, \
last_successful_fill
from zerver.models import Realm, UserProfile, Message, Stream, \
UserActivityInterval, RealmAuditLog, models
from zerver.lib.timestamp import floor_to_hour, ceiling_to_day, \
ceiling_to_hour, verify_UTC
from typing import Any, Callable, Dict, List, Optional, Text, Tuple, Type, Union
from collections import defaultdict, OrderedDict
from datetime import timedelta, datetime
from analytics.models import Anomaly, BaseCount, \
FillState, InstallationCount, RealmCount, StreamCount, \
UserCount, installation_epoch, last_successful_fill
from zerver.lib.logging_util import create_logger
import time
from zerver.lib.timestamp import ceiling_to_day, \
ceiling_to_hour, floor_to_hour, verify_UTC
from zerver.models import Message, Realm, RealmAuditLog, \
Stream, UserActivityInterval, UserProfile, models
## Logging setup ##

View File

@ -1,9 +1,9 @@
from analytics.lib.counts import CountStat
from math import sqrt
from random import gauss, random, seed
from typing import List
from analytics.lib.counts import CountStat
def generate_time_series_data(days=100, business_hours_base=10, non_business_hours_base=10,
growth=1, autocorrelation=0, spikiness=1, holiday_rate=0,
frequency=CountStat.DAY, partial_sum=False, random_seed=26):

View File

@ -1,10 +1,9 @@
from zerver.lib.timestamp import floor_to_hour, floor_to_day, \
verify_UTC
from analytics.lib.counts import CountStat
from datetime import datetime, timedelta
from typing import List, Optional
from analytics.lib.counts import CountStat
from zerver.lib.timestamp import floor_to_day, floor_to_hour, verify_UTC
# If min_length is None, returns end_times from ceiling(start) to floor(end), inclusive.
# If min_length is greater than 0, pads the list to the left.
# So informally, time_range(Sep 20, Sep 22, day, None) returns [Sep 20, Sep 21, Sep 22],

View File

@ -1,11 +1,12 @@
import datetime
import logging
import time
from typing import Any, Dict
from django.core.management.base import BaseCommand, CommandParser
from zerver.models import Recipient, Message
from zerver.lib.timestamp import timestamp_to_datetime
import datetime
import time
import logging
from zerver.models import Message, Recipient
def compute_stats(log_level):
# type: (int) -> None

View File

@ -1,12 +1,12 @@
import datetime
from typing import Any, Dict
from zerver.lib.statistics import seconds_usage_between
from django.core.management.base import BaseCommand, CommandParser
from zerver.models import UserProfile
import datetime
from django.utils.timezone import utc
from zerver.lib.statistics import seconds_usage_between
from zerver.models import UserProfile
def analyze_activity(options):
# type: (Dict[str, Any]) -> None
day_start = datetime.datetime.strptime(options["date"], "%Y-%m-%d").replace(tzinfo=utc)

View File

@ -1,12 +1,11 @@
import sys
from argparse import ArgumentParser
from typing import Any
from django.core.management.base import BaseCommand
from analytics.lib.counts import do_drop_all_analytics_tables
from typing import Any
class Command(BaseCommand):
help = """Clear analytics tables."""

View File

@ -1,11 +1,10 @@
import sys
from argparse import ArgumentParser
from typing import Any
from django.core.management.base import BaseCommand
from analytics.lib.counts import do_drop_single_stat, COUNT_STATS
from typing import Any
from analytics.lib.counts import COUNT_STATS, do_drop_single_stat
class Command(BaseCommand):
help = """Clear analytics tables."""

View File

@ -1,14 +1,13 @@
import datetime
from argparse import ArgumentParser
from typing import Any
from argparse import ArgumentParser
from django.db.models import Count, QuerySet
from django.utils.timezone import now as timezone_now
from zerver.lib.management import ZulipBaseCommand
from zerver.models import UserActivity
import datetime
class Command(ZulipBaseCommand):
help = """Report rough client activity globally, for a realm, or for a user

View File

@ -1,19 +1,17 @@
from datetime import datetime, timedelta
from typing import Any, Dict, List, Mapping, Optional, Text, Type, Union
from django.core.management.base import BaseCommand
from django.utils.timezone import now as timezone_now
from analytics.lib.counts import COUNT_STATS, CountStat, do_drop_all_analytics_tables
from analytics.lib.counts import COUNT_STATS, \
CountStat, do_drop_all_analytics_tables
from analytics.lib.fixtures import generate_time_series_data
from analytics.lib.time_utils import time_range
from analytics.models import BaseCount, RealmCount, \
UserCount, FillState
from analytics.models import BaseCount, FillState, RealmCount, UserCount
from zerver.lib.timestamp import floor_to_day
from zerver.models import Realm, UserProfile, Client, \
RealmAuditLog
from datetime import datetime, timedelta
from typing import Any, Dict, List, Optional, Text, Type, Union, Mapping
from zerver.models import Client, Realm, RealmAuditLog, UserProfile
class Command(BaseCommand):
help = """Populates analytics tables with randomly generated data."""

View File

@ -1,15 +1,14 @@
import datetime
from argparse import ArgumentParser
from typing import Any, List
from argparse import ArgumentParser
import datetime
import pytz
from django.core.management.base import BaseCommand
from django.db.models import Count
from django.utils.timezone import now as timezone_now
from zerver.models import UserProfile, Realm, Stream, Message, Recipient, UserActivity, \
Subscription, UserMessage, get_realm
from zerver.models import Message, Realm, Recipient, Stream, \
Subscription, UserActivity, UserMessage, UserProfile, get_realm
MOBILE_CLIENT_LIST = ["Android", "ios"]
HUMAN_CLIENT_LIST = MOBILE_CLIENT_LIST + ["website"]

View File

@ -1,9 +1,11 @@
from argparse import ArgumentParser
from typing import Any
from argparse import ArgumentParser
from django.core.management.base import BaseCommand
from django.db.models import Q
from zerver.models import Realm, Stream, Message, Subscription, Recipient, get_realm
from zerver.models import Message, Realm, \
Recipient, Stream, Subscription, get_realm
class Command(BaseCommand):
help = "Generate statistics on the streams for a realm."

View File

@ -1,21 +1,19 @@
import os
from scripts.lib.zulip_tools import ENDC, WARNING
from argparse import ArgumentParser
import time
from argparse import ArgumentParser
from typing import Any, Dict
from django.conf import settings
from django.core.management.base import BaseCommand
from django.utils.dateparse import parse_datetime
from django.utils.timezone import now as timezone_now
from django.utils.timezone import utc as timezone_utc
from django.utils.dateparse import parse_datetime
from django.conf import settings
from analytics.lib.counts import COUNT_STATS, logger, process_count_stat
from scripts.lib.zulip_tools import ENDC, WARNING
from zerver.lib.timestamp import floor_to_hour
from zerver.models import Realm
from typing import Any, Dict
class Command(BaseCommand):
help = """Fills Analytics tables.

View File

@ -1,11 +1,11 @@
from argparse import ArgumentParser
import datetime
from argparse import ArgumentParser
from typing import Any
from django.core.management.base import BaseCommand
from django.utils.timezone import now as timezone_now
from zerver.models import UserProfile, Realm, Stream, Message, get_realm
from zerver.models import Message, Realm, Stream, UserProfile, get_realm
class Command(BaseCommand):
help = "Generate statistics on user activity."

View File

@ -1,9 +1,9 @@
# -*- coding: utf-8 -*-
from django.db import models, migrations
import django.db.models.deletion
from django.conf import settings
import zerver.lib.str_utils
from django.db import migrations, models
import zerver.lib.str_utils
class Migration(migrations.Migration):

View File

@ -1,7 +1,6 @@
# -*- coding: utf-8 -*-
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [

View File

@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
from django.db import migrations, models
import zerver.lib.str_utils
import zerver.lib.str_utils
class Migration(migrations.Migration):

View File

@ -1,7 +1,6 @@
# -*- coding: utf-8 -*-
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [

View File

@ -1,7 +1,6 @@
# -*- coding: utf-8 -*-
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [

View File

@ -1,7 +1,6 @@
# -*- coding: utf-8 -*-
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [

View File

@ -3,7 +3,6 @@
from django.conf import settings
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [

View File

@ -2,7 +2,6 @@
# Generated by Django 1.10.5 on 2017-02-01 22:28
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [

View File

@ -1,8 +1,7 @@
# -*- coding: utf-8 -*-
from django.db import migrations
from django.db.backends.postgresql_psycopg2.schema import DatabaseSchemaEditor
from django.db.migrations.state import StateApps
from django.db import migrations
def delete_messages_sent_to_stream_stat(apps, schema_editor):
# type: (StateApps, DatabaseSchemaEditor) -> None

View File

@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
from django.db import migrations
from django.db.backends.postgresql_psycopg2.schema import DatabaseSchemaEditor
from django.db.migrations.state import StateApps
from django.db import migrations
def clear_message_sent_by_message_type_values(apps, schema_editor):
# type: (StateApps, DatabaseSchemaEditor) -> None

View File

@ -1,8 +1,7 @@
# -*- coding: utf-8 -*-
from django.db import migrations
from django.db.backends.postgresql_psycopg2.schema import DatabaseSchemaEditor
from django.db.migrations.state import StateApps
from django.db import migrations
def clear_analytics_tables(apps, schema_editor):
# type: (StateApps, DatabaseSchemaEditor) -> None

View File

@ -1,11 +1,10 @@
import datetime
from typing import Any, Dict, Optional, Text, Tuple, Union
from django.db import models
from zerver.models import Realm, UserProfile, Stream, Recipient
from zerver.lib.timestamp import floor_to_day
import datetime
from typing import Optional, Tuple, Union, Dict, Any, Text
from zerver.models import Realm, Recipient, Stream, UserProfile
class FillState(models.Model):
property = models.CharField(max_length=40, unique=True) # type: Text

View File

@ -1,4 +1,8 @@
from datetime import datetime, timedelta
from typing import Any, Dict, List, Optional, Text, Tuple, Type, Union
import ujson
from django.apps import apps
from django.db import models
from django.db.models import Sum
@ -6,23 +10,20 @@ from django.test import TestCase
from django.utils.timezone import now as timezone_now
from django.utils.timezone import utc as timezone_utc
from analytics.lib.counts import CountStat, COUNT_STATS, process_count_stat, \
do_fill_count_stat_at_hour, do_increment_logging_stat, DataCollector, \
sql_data_collector, LoggingCountStat, do_aggregate_to_summary_table, \
do_drop_all_analytics_tables, do_drop_single_stat, DependentCountStat
from analytics.models import BaseCount, InstallationCount, RealmCount, \
UserCount, StreamCount, FillState, Anomaly, installation_epoch, \
last_successful_fill
from zerver.lib.actions import do_create_user, do_deactivate_user, \
do_activate_user, do_reactivate_user, update_user_activity_interval
from zerver.lib.timestamp import floor_to_day, TimezoneNotUTCException
from zerver.models import Realm, UserProfile, Message, Stream, Recipient, \
Huddle, Client, UserActivityInterval, RealmAuditLog, get_client, get_user
from datetime import datetime, timedelta
import ujson
from typing import Any, Dict, List, Optional, Text, Tuple, Type, Union
from analytics.lib.counts import COUNT_STATS, CountStat, DataCollector, \
DependentCountStat, LoggingCountStat, do_aggregate_to_summary_table, \
do_drop_all_analytics_tables, do_drop_single_stat, \
do_fill_count_stat_at_hour, do_increment_logging_stat, \
process_count_stat, sql_data_collector
from analytics.models import Anomaly, BaseCount, \
FillState, InstallationCount, RealmCount, StreamCount, \
UserCount, installation_epoch, last_successful_fill
from zerver.lib.actions import do_activate_user, do_create_user, \
do_deactivate_user, do_reactivate_user, update_user_activity_interval
from zerver.lib.timestamp import TimezoneNotUTCException, floor_to_day
from zerver.models import Client, Huddle, Message, Realm, \
RealmAuditLog, Recipient, Stream, UserActivityInterval, \
UserProfile, get_client, get_user
class AnalyticsTestCase(TestCase):
MINUTE = timedelta(seconds = 60)

View File

@ -1,7 +1,6 @@
from zerver.lib.test_classes import ZulipTestCase
from analytics.lib.counts import CountStat
from analytics.lib.fixtures import generate_time_series_data
from zerver.lib.test_classes import ZulipTestCase
# A very light test suite; the code being tested is not run in production.
class TestFixtures(ZulipTestCase):

View File

@ -1,20 +1,19 @@
from django.utils.timezone import utc
from zerver.lib.test_classes import ZulipTestCase
from zerver.lib.timestamp import ceiling_to_hour, ceiling_to_day, \
datetime_to_timestamp
from zerver.models import Client, get_realm
from analytics.lib.counts import CountStat, COUNT_STATS
from analytics.lib.time_utils import time_range
from analytics.models import RealmCount, UserCount, \
FillState, last_successful_fill
from analytics.views import stats, get_chart_data, sort_by_totals, \
sort_client_labels, rewrite_client_arrays
from datetime import datetime, timedelta
import mock
from typing import Dict, List, Optional
from typing import List, Dict, Optional
import mock
from django.utils.timezone import utc
from analytics.lib.counts import COUNT_STATS, CountStat
from analytics.lib.time_utils import time_range
from analytics.models import FillState, \
RealmCount, UserCount, last_successful_fill
from analytics.views import get_chart_data, rewrite_client_arrays, \
sort_by_totals, sort_client_labels, stats
from zerver.lib.test_classes import ZulipTestCase
from zerver.lib.timestamp import ceiling_to_day, \
ceiling_to_hour, datetime_to_timestamp
from zerver.models import Client, get_realm
class TestStatsEndpoint(ZulipTestCase):
def test_stats(self):

View File

@ -1,7 +1,7 @@
from django.conf.urls import url, include
from zerver.lib.rest import rest_dispatch
from django.conf.urls import include, url
import analytics.views
from zerver.lib.rest import rest_dispatch
i18n_urlpatterns = [
# Server admin (user_profile.is_staff) visible stats pages

View File

@ -1,42 +1,40 @@
import itertools
import json
import logging
import re
import time
from collections import defaultdict
from datetime import datetime, timedelta
from typing import Any, Callable, Dict, List, \
Optional, Set, Text, Tuple, Type, Union
import pytz
from django.conf import settings
from django.core import urlresolvers
from django.db import connection
from django.db.models import Sum
from django.db.models.query import QuerySet
from django.http import HttpResponseNotFound, HttpRequest, HttpResponse
from django.http import HttpRequest, HttpResponse, HttpResponseNotFound
from django.shortcuts import render
from django.template import RequestContext, loader
from django.utils.timezone import now as timezone_now
from django.utils.translation import ugettext as _
from django.shortcuts import render
from jinja2 import Markup as mark_safe
from analytics.lib.counts import CountStat, process_count_stat, COUNT_STATS
from analytics.lib.counts import COUNT_STATS, CountStat, process_count_stat
from analytics.lib.time_utils import time_range
from analytics.models import BaseCount, InstallationCount, RealmCount, \
UserCount, StreamCount, last_successful_fill
from zerver.decorator import require_server_admin, zulip_login_required, \
to_non_negative_int, to_utc_datetime
from analytics.models import BaseCount, InstallationCount, \
RealmCount, StreamCount, UserCount, last_successful_fill
from zerver.decorator import require_server_admin, \
to_non_negative_int, to_utc_datetime, zulip_login_required
from zerver.lib.exceptions import JsonableError
from zerver.lib.request import has_request_variables, REQ
from zerver.lib.request import REQ, has_request_variables
from zerver.lib.response import json_success
from zerver.lib.timestamp import ceiling_to_hour, ceiling_to_day, \
timestamp_to_datetime, convert_to_UTC
from zerver.models import Realm, UserProfile, UserActivity, \
UserActivityInterval, Client
from collections import defaultdict
from datetime import datetime, timedelta
import itertools
import json
import logging
import pytz
import re
import time
from typing import Any, Callable, Dict, List, Optional, Set, Text, \
Tuple, Type, Union
from zerver.lib.timestamp import ceiling_to_day, \
ceiling_to_hour, convert_to_UTC, timestamp_to_datetime
from zerver.models import Client, Realm, \
UserActivity, UserActivityInterval, UserProfile
@zulip_login_required
def stats(request):

View File

@ -1,14 +1,15 @@
# -*- coding: utf-8 -*-
from django.core.management.base import BaseCommand
from zerver.lib.actions import create_stream_if_needed, \
internal_prep_stream_message, do_create_user, do_send_messages, \
do_add_reaction_legacy, bulk_add_subscriptions, do_change_avatar_fields
from zerver.lib.upload import upload_avatar_image
from zerver.models import get_realm, UserProfile, Message
from typing import Any, Dict, List
from django.core.management.base import BaseCommand
from zerver.lib.actions import bulk_add_subscriptions, \
create_stream_if_needed, do_add_reaction_legacy, do_change_avatar_fields, \
do_create_user, do_send_messages, internal_prep_stream_message
from zerver.lib.upload import upload_avatar_image
from zerver.models import Message, UserProfile, get_realm
class Command(BaseCommand):
help = """Add a mock conversation to the development environment.

View File

@ -1,11 +1,11 @@
from zerver.lib.actions import do_create_user, do_create_realm
from zerver.lib.management import ZulipBaseCommand
from zerver.lib.onboarding import setup_initial_streams, \
setup_initial_private_stream, send_initial_realm_messages
from zerver.models import Realm, UserProfile
from typing import Any
from zerver.lib.actions import do_create_realm, do_create_user
from zerver.lib.management import ZulipBaseCommand
from zerver.lib.onboarding import send_initial_realm_messages, \
setup_initial_private_stream, setup_initial_streams
from zerver.models import Realm, UserProfile
class Command(ZulipBaseCommand):
help = """Add a new realm and initial user for manual testing of the onboarding process."""

View File

@ -1,10 +1,11 @@
from typing import Any
from django.core.management.base import CommandParser
from zerver.lib.actions import do_create_user
from zerver.lib.management import ZulipBaseCommand
from zerver.models import Realm, UserProfile
from typing import Any
class Command(ZulipBaseCommand):
help = """Add a new user for manual testing of the onboarding process.
If realm is unspecified, will try to use a realm created by add_new_realm,

View File

@ -1,10 +1,8 @@
from typing import Any
import ijson
from django.core.management.base import BaseCommand, CommandParser
class Command(BaseCommand):
help = """
Render messages to a file.

View File

@ -2,10 +2,11 @@
from typing import Any
from django.conf import settings
from django.core.cache import cache
from django.core.management.base import BaseCommand
from django.db.models import F
from django.core.cache import cache
from zerver.models import UserProfile, UserMessage
from zerver.models import UserMessage, UserProfile
class Command(BaseCommand):
help = """Script to mark all messages as unread."""

View File

@ -2,6 +2,7 @@
from typing import Any
from django.core.management.base import BaseCommand
from zerver.models import Subscription
class Command(BaseCommand):

View File

@ -1,27 +1,26 @@
from django.core.management.base import BaseCommand, CommandParser
from django.utils.timezone import now as timezone_now
from django.db.models import F, Max
import itertools
import os
import random
from typing import Any, Callable, Dict, Iterable, List, \
Mapping, Optional, Sequence, Set, Text, Tuple
from zerver.models import Message, UserProfile, Stream, Recipient, UserPresence, \
Subscription, RealmAuditLog, get_huddle, Realm, RealmEmoji, UserMessage, \
RealmDomain, clear_database, get_client, get_user_profile_by_id, \
email_to_username, Service, get_user, DefaultStream, get_stream, \
get_realm, get_system_bot
from zerver.lib.actions import STREAM_ASSIGNMENT_COLORS, do_send_messages, \
do_change_is_admin
import ujson
from django.conf import settings
from django.core.management.base import BaseCommand, CommandParser
from django.db.models import F, Max
from django.utils.timezone import now as timezone_now
from zerver.lib.actions import STREAM_ASSIGNMENT_COLORS, \
do_change_is_admin, do_send_messages
from zerver.lib.bulk_create import bulk_create_streams, bulk_create_users
from zerver.lib.generate_test_data import create_test_data
from zerver.lib.upload import upload_backend
from zerver.lib.user_groups import create_user_group
import random
import os
import ujson
import itertools
from typing import Any, Callable, Dict, List, Iterable, Mapping, Optional, Sequence, Set, Tuple, Text
from zerver.models import DefaultStream, Message, Realm, RealmAuditLog, \
RealmDomain, RealmEmoji, Recipient, Service, Stream, Subscription, \
UserMessage, UserPresence, UserProfile, clear_database, \
email_to_username, get_client, get_huddle, get_realm, get_stream, \
get_system_bot, get_user, get_user_profile_by_id
settings.TORNADO_SERVER = None
# Disable using memcached caches to avoid 'unsupported pickle

View File

@ -1,6 +1,6 @@
from argparse import ArgumentParser
from typing import Any
from argparse import ArgumentParser
from zerver.lib.initial_password import initial_password
from zerver.lib.management import ZulipBaseCommand

View File

@ -1,13 +1,14 @@
from typing import Any, Dict
from django.http import HttpRequest, HttpResponse
from django.core.management.base import CommandParser
from zerver.lib.management import ZulipBaseCommand
from zerver.models import UserMessage, UserProfile
from zerver.views.messages import get_messages_backend
import cProfile
import logging
from typing import Any, Dict
from django.core.management.base import CommandParser
from django.http import HttpRequest, HttpResponse
from zerver.lib.management import ZulipBaseCommand
from zerver.middleware import LogRequests
from zerver.models import UserMessage, UserProfile
from zerver.views.messages import get_messages_backend
request_logger = LogRequests()

View File

@ -1,14 +1,13 @@
import os
import ujson
from typing import Any, Iterator
import ujson
from django.core.management.base import BaseCommand, CommandParser
from django.db.models import QuerySet
from zerver.lib.message import render_markdown
from zerver.models import Message
def queryset_iterator(queryset, chunksize=5000):
# type: (QuerySet, int) -> Iterator[Any]
queryset = queryset.order_by('id')

View File

@ -1,9 +1,10 @@
import os
from configparser import ConfigParser
from typing import Any
from django.core.management.base import BaseCommand
from zerver.models import get_realm, get_user, UserProfile
import os
from configparser import ConfigParser
from zerver.models import UserProfile, get_realm, get_user
class Command(BaseCommand):
help = """Sync your API key from ~/.zuliprc into your development instance"""

View File

@ -1,6 +1,5 @@
# -*- coding: utf-8 -*-
from django.db import models, migrations
from django.db import migrations, models
class Migration(migrations.Migration):

View File

@ -1,7 +1,6 @@
# -*- coding: utf-8 -*-
from django.db import migrations, models
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):

View File

@ -2,7 +2,6 @@
# Generated by Django 1.10.5 on 2017-05-16 00:03
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [

View File

@ -2,7 +2,6 @@
# Generated by Django 1.11.5 on 2017-10-12 06:27
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [

View File

@ -4,7 +4,6 @@ from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [

View File

@ -1,8 +1,9 @@
from django.db import models
import datetime
from typing import Text
from django.db import models
import zerver.models
import datetime
def get_remote_server_by_uuid(uuid):
# type: (Text) -> RemoteZulipServer

View File

@ -1,9 +1,9 @@
from django.conf.urls import url, include
from typing import Any
from zerver.lib.rest import rest_dispatch
from django.conf.urls import include, url
import zilencer.views
from zerver.lib.rest import rest_dispatch
i18n_urlpatterns = [] # type: Any

View File

@ -1,20 +1,19 @@
from django.utils.translation import ugettext as _
from typing import Any, Dict, Optional, Text, Union, cast
from django.http import HttpRequest, HttpResponse
from django.utils import timezone
from django.http import HttpResponse, HttpRequest
from zilencer.models import RemotePushDeviceToken, RemoteZulipServer
from django.utils.translation import ugettext as _
from zerver.lib.exceptions import JsonableError
from zerver.lib.push_notifications import send_android_push_notification, \
send_apple_push_notification
from zerver.lib.request import REQ, has_request_variables
from zerver.lib.response import json_error, json_success
from zerver.lib.request import has_request_variables, REQ
from zerver.lib.validator import check_int
from zerver.models import UserProfile
from zerver.views.push_notifications import validate_token
from typing import Any, Dict, Optional, Union, Text, cast
from zilencer.models import RemotePushDeviceToken, RemoteZulipServer
def validate_entity(entity):
# type: (Union[UserProfile, RemoteZulipServer]) -> None