mirror of https://github.com/zulip/zulip.git
python: Sort imports with isort.
Fixes #2665. Regenerated by tabbott with `lint --fix` after a rebase and change in parameters. Note from tabbott: In a few cases, this converts technical debt in the form of unsorted imports into different technical debt in the form of our largest files having very long, ugly import sequences at the start. I expect this change will increase pressure for us to split those files, which isn't a bad thing. Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
parent
b666aef2d3
commit
365fe0b3d5
|
@ -1,23 +1,35 @@
|
||||||
|
import logging
|
||||||
import time
|
import time
|
||||||
from collections import OrderedDict, defaultdict
|
from collections import OrderedDict, defaultdict
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
import logging
|
from typing import Callable, Dict, List, Optional, Tuple, Type, Union
|
||||||
from typing import Callable, Dict, List, \
|
|
||||||
Optional, Tuple, Type, Union
|
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.db import connection
|
from django.db import connection
|
||||||
from django.db.models import F
|
from django.db.models import F
|
||||||
from psycopg2.sql import Composable, Identifier, Literal, SQL
|
from psycopg2.sql import SQL, Composable, Identifier, Literal
|
||||||
|
|
||||||
from analytics.models import BaseCount, \
|
from analytics.models import (
|
||||||
FillState, InstallationCount, RealmCount, StreamCount, \
|
BaseCount,
|
||||||
UserCount, installation_epoch, last_successful_fill
|
FillState,
|
||||||
|
InstallationCount,
|
||||||
|
RealmCount,
|
||||||
|
StreamCount,
|
||||||
|
UserCount,
|
||||||
|
installation_epoch,
|
||||||
|
last_successful_fill,
|
||||||
|
)
|
||||||
from zerver.lib.logging_util import log_to_file
|
from zerver.lib.logging_util import log_to_file
|
||||||
from zerver.lib.timestamp import ceiling_to_day, \
|
from zerver.lib.timestamp import ceiling_to_day, ceiling_to_hour, floor_to_hour, verify_UTC
|
||||||
ceiling_to_hour, floor_to_hour, verify_UTC
|
from zerver.models import (
|
||||||
from zerver.models import Message, Realm, RealmAuditLog, \
|
Message,
|
||||||
Stream, UserActivityInterval, UserProfile, models
|
Realm,
|
||||||
|
RealmAuditLog,
|
||||||
|
Stream,
|
||||||
|
UserActivityInterval,
|
||||||
|
UserProfile,
|
||||||
|
models,
|
||||||
|
)
|
||||||
|
|
||||||
## Logging setup ##
|
## Logging setup ##
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@ from typing import List
|
||||||
|
|
||||||
from analytics.lib.counts import CountStat
|
from analytics.lib.counts import CountStat
|
||||||
|
|
||||||
|
|
||||||
def generate_time_series_data(days: int=100, business_hours_base: float=10,
|
def generate_time_series_data(days: int=100, business_hours_base: float=10,
|
||||||
non_business_hours_base: float=10, growth: float=1,
|
non_business_hours_base: float=10, growth: float=1,
|
||||||
autocorrelation: float=0, spikiness: float=1,
|
autocorrelation: float=0, spikiness: float=1,
|
||||||
|
|
|
@ -4,6 +4,7 @@ from typing import List, Optional
|
||||||
from analytics.lib.counts import CountStat
|
from analytics.lib.counts import CountStat
|
||||||
from zerver.lib.timestamp import floor_to_day, floor_to_hour, verify_UTC
|
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 None, returns end_times from ceiling(start) to floor(end), inclusive.
|
||||||
# If min_length is greater than 0, pads the list to the left.
|
# 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],
|
# So informally, time_range(Sep 20, Sep 22, day, None) returns [Sep 20, Sep 21, Sep 22],
|
||||||
|
|
|
@ -8,8 +8,7 @@ from django.utils.timezone import now as timezone_now
|
||||||
|
|
||||||
from analytics.lib.counts import COUNT_STATS, CountStat
|
from analytics.lib.counts import COUNT_STATS, CountStat
|
||||||
from analytics.models import installation_epoch, last_successful_fill
|
from analytics.models import installation_epoch, last_successful_fill
|
||||||
from zerver.lib.timestamp import TimezoneNotUTCException, floor_to_day, \
|
from zerver.lib.timestamp import TimezoneNotUTCException, floor_to_day, floor_to_hour, verify_UTC
|
||||||
floor_to_hour, verify_UTC
|
|
||||||
from zerver.models import Realm
|
from zerver.models import Realm
|
||||||
|
|
||||||
states = {
|
states = {
|
||||||
|
|
|
@ -1,21 +1,25 @@
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
from typing import Any, Dict, List, Mapping, Optional, Type
|
from typing import Any, Dict, List, Mapping, Optional, Type
|
||||||
|
|
||||||
from unittest import mock
|
from unittest import mock
|
||||||
|
|
||||||
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.lib.counts import COUNT_STATS, CountStat, \
|
from analytics.lib.counts import COUNT_STATS, CountStat, do_drop_all_analytics_tables
|
||||||
do_drop_all_analytics_tables
|
|
||||||
from analytics.lib.fixtures import generate_time_series_data
|
from analytics.lib.fixtures import generate_time_series_data
|
||||||
from analytics.lib.time_utils import time_range
|
from analytics.lib.time_utils import time_range
|
||||||
from analytics.models import BaseCount, FillState, InstallationCount, \
|
from analytics.models import (
|
||||||
RealmCount, StreamCount, UserCount
|
BaseCount,
|
||||||
|
FillState,
|
||||||
|
InstallationCount,
|
||||||
|
RealmCount,
|
||||||
|
StreamCount,
|
||||||
|
UserCount,
|
||||||
|
)
|
||||||
from zerver.lib.actions import STREAM_ASSIGNMENT_COLORS, do_change_user_role
|
from zerver.lib.actions import STREAM_ASSIGNMENT_COLORS, do_change_user_role
|
||||||
from zerver.lib.create_user import create_user
|
from zerver.lib.create_user import create_user
|
||||||
from zerver.lib.timestamp import floor_to_day
|
from zerver.lib.timestamp import floor_to_day
|
||||||
from zerver.models import Client, Realm, Recipient, Stream, Subscription, \
|
from zerver.models import Client, Realm, Recipient, Stream, Subscription, UserProfile
|
||||||
UserProfile
|
|
||||||
|
|
||||||
|
|
||||||
class Command(BaseCommand):
|
class Command(BaseCommand):
|
||||||
|
|
|
@ -6,8 +6,17 @@ from django.core.management.base import BaseCommand, CommandError
|
||||||
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
|
||||||
|
|
||||||
from zerver.models import Message, Realm, Recipient, Stream, Subscription, \
|
from zerver.models import (
|
||||||
UserActivity, UserMessage, UserProfile, get_realm
|
Message,
|
||||||
|
Realm,
|
||||||
|
Recipient,
|
||||||
|
Stream,
|
||||||
|
Subscription,
|
||||||
|
UserActivity,
|
||||||
|
UserMessage,
|
||||||
|
UserProfile,
|
||||||
|
get_realm,
|
||||||
|
)
|
||||||
|
|
||||||
MOBILE_CLIENT_LIST = ["Android", "ios"]
|
MOBILE_CLIENT_LIST = ["Android", "ios"]
|
||||||
HUMAN_CLIENT_LIST = MOBILE_CLIENT_LIST + ["website"]
|
HUMAN_CLIENT_LIST = MOBILE_CLIENT_LIST + ["website"]
|
||||||
|
|
|
@ -4,8 +4,7 @@ from typing import Any
|
||||||
from django.core.management.base import BaseCommand, CommandError
|
from django.core.management.base import BaseCommand, CommandError
|
||||||
from django.db.models import Q
|
from django.db.models import Q
|
||||||
|
|
||||||
from zerver.models import Message, Realm, Recipient, Stream, Subscription, \
|
from zerver.models import Message, Realm, Recipient, Stream, Subscription, get_realm
|
||||||
get_realm
|
|
||||||
|
|
||||||
|
|
||||||
class Command(BaseCommand):
|
class Command(BaseCommand):
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import os
|
import os
|
||||||
import time
|
import time
|
||||||
from argparse import ArgumentParser
|
from argparse import ArgumentParser
|
||||||
from typing import Any, Dict
|
|
||||||
from datetime import timezone
|
from datetime import timezone
|
||||||
|
from typing import Any, Dict
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.core.management.base import BaseCommand
|
from django.core.management.base import BaseCommand
|
||||||
|
|
|
@ -3,6 +3,7 @@ from django.db.backends.postgresql.schema import DatabaseSchemaEditor
|
||||||
from django.db.migrations.state import StateApps
|
from django.db.migrations.state import StateApps
|
||||||
from django.db.models import Count, Sum
|
from django.db.models import Count, Sum
|
||||||
|
|
||||||
|
|
||||||
def clear_duplicate_counts(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None:
|
def clear_duplicate_counts(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None:
|
||||||
"""This is a preparatory migration for our Analytics tables.
|
"""This is a preparatory migration for our Analytics tables.
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@ from django.db.models import Q, UniqueConstraint
|
||||||
from zerver.lib.timestamp import floor_to_day
|
from zerver.lib.timestamp import floor_to_day
|
||||||
from zerver.models import Realm, Stream, UserProfile
|
from zerver.models import Realm, Stream, UserProfile
|
||||||
|
|
||||||
|
|
||||||
class FillState(models.Model):
|
class FillState(models.Model):
|
||||||
property: str = models.CharField(max_length=40, unique=True)
|
property: str = models.CharField(max_length=40, unique=True)
|
||||||
end_time: datetime.datetime = models.DateTimeField()
|
end_time: datetime.datetime = models.DateTimeField()
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
from datetime import datetime, timedelta, timezone
|
from datetime import datetime, timedelta, timezone
|
||||||
from typing import Any, Dict, List, Optional, Tuple, Type
|
from typing import Any, Dict, List, Optional, Tuple, Type
|
||||||
|
|
||||||
from unittest import mock
|
from unittest import mock
|
||||||
|
|
||||||
import ujson
|
import ujson
|
||||||
from django.apps import apps
|
from django.apps import apps
|
||||||
from django.db import models
|
from django.db import models
|
||||||
|
@ -10,24 +10,58 @@ from django.test import TestCase
|
||||||
from django.utils.timezone import now as timezone_now
|
from django.utils.timezone import now as timezone_now
|
||||||
from psycopg2.sql import SQL, Literal
|
from psycopg2.sql import SQL, Literal
|
||||||
|
|
||||||
from analytics.lib.counts import COUNT_STATS, CountStat, get_count_stats, \
|
from analytics.lib.counts import (
|
||||||
DependentCountStat, LoggingCountStat, do_aggregate_to_summary_table, \
|
COUNT_STATS,
|
||||||
do_drop_all_analytics_tables, do_drop_single_stat, \
|
CountStat,
|
||||||
do_fill_count_stat_at_hour, do_increment_logging_stat, \
|
DependentCountStat,
|
||||||
process_count_stat, sql_data_collector
|
LoggingCountStat,
|
||||||
from analytics.models import BaseCount, \
|
do_aggregate_to_summary_table,
|
||||||
FillState, InstallationCount, RealmCount, StreamCount, \
|
do_drop_all_analytics_tables,
|
||||||
UserCount, installation_epoch
|
do_drop_single_stat,
|
||||||
from zerver.lib.actions import do_activate_user, do_create_user, \
|
do_fill_count_stat_at_hour,
|
||||||
do_deactivate_user, do_reactivate_user, update_user_activity_interval, \
|
do_increment_logging_stat,
|
||||||
do_invite_users, do_revoke_user_invite, do_resend_user_invite_email, \
|
get_count_stats,
|
||||||
InvitationError
|
process_count_stat,
|
||||||
|
sql_data_collector,
|
||||||
|
)
|
||||||
|
from analytics.models import (
|
||||||
|
BaseCount,
|
||||||
|
FillState,
|
||||||
|
InstallationCount,
|
||||||
|
RealmCount,
|
||||||
|
StreamCount,
|
||||||
|
UserCount,
|
||||||
|
installation_epoch,
|
||||||
|
)
|
||||||
|
from zerver.lib.actions import (
|
||||||
|
InvitationError,
|
||||||
|
do_activate_user,
|
||||||
|
do_create_user,
|
||||||
|
do_deactivate_user,
|
||||||
|
do_invite_users,
|
||||||
|
do_reactivate_user,
|
||||||
|
do_resend_user_invite_email,
|
||||||
|
do_revoke_user_invite,
|
||||||
|
update_user_activity_interval,
|
||||||
|
)
|
||||||
from zerver.lib.create_user import create_user
|
from zerver.lib.create_user import create_user
|
||||||
from zerver.lib.timestamp import TimezoneNotUTCException, floor_to_day
|
from zerver.lib.timestamp import TimezoneNotUTCException, floor_to_day
|
||||||
from zerver.lib.topic import DB_TOPIC_NAME
|
from zerver.lib.topic import DB_TOPIC_NAME
|
||||||
from zerver.models import Client, Huddle, Message, Realm, \
|
from zerver.models import (
|
||||||
RealmAuditLog, Recipient, Stream, UserActivityInterval, \
|
Client,
|
||||||
UserProfile, get_client, get_user, PreregistrationUser
|
Huddle,
|
||||||
|
Message,
|
||||||
|
PreregistrationUser,
|
||||||
|
Realm,
|
||||||
|
RealmAuditLog,
|
||||||
|
Recipient,
|
||||||
|
Stream,
|
||||||
|
UserActivityInterval,
|
||||||
|
UserProfile,
|
||||||
|
get_client,
|
||||||
|
get_user,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class AnalyticsTestCase(TestCase):
|
class AnalyticsTestCase(TestCase):
|
||||||
MINUTE = timedelta(seconds = 60)
|
MINUTE = timedelta(seconds = 60)
|
||||||
|
|
|
@ -2,6 +2,7 @@ from analytics.lib.counts import CountStat
|
||||||
from analytics.lib.fixtures import generate_time_series_data
|
from analytics.lib.fixtures import generate_time_series_data
|
||||||
from zerver.lib.test_classes import ZulipTestCase
|
from zerver.lib.test_classes import ZulipTestCase
|
||||||
|
|
||||||
|
|
||||||
# A very light test suite; the code being tested is not run in production.
|
# A very light test suite; the code being tested is not run in production.
|
||||||
class TestFixtures(ZulipTestCase):
|
class TestFixtures(ZulipTestCase):
|
||||||
def test_deterministic_settings(self) -> None:
|
def test_deterministic_settings(self) -> None:
|
||||||
|
|
|
@ -1,24 +1,21 @@
|
||||||
from datetime import datetime, timedelta, timezone
|
from datetime import datetime, timedelta, timezone
|
||||||
from typing import List, Optional
|
from typing import List, Optional
|
||||||
|
|
||||||
from unittest import mock
|
from unittest import mock
|
||||||
from django.http import HttpResponse
|
|
||||||
import ujson
|
import ujson
|
||||||
|
from django.http import HttpResponse
|
||||||
from django.utils.timezone import now as timezone_now
|
from django.utils.timezone import now as timezone_now
|
||||||
|
|
||||||
from analytics.lib.counts import COUNT_STATS, CountStat
|
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 rewrite_client_arrays, sort_by_totals, sort_client_labels
|
||||||
from analytics.views import rewrite_client_arrays, \
|
from zerver.lib.actions import do_create_multiuse_invite_link, do_send_realm_reactivation_email
|
||||||
sort_by_totals, sort_client_labels
|
|
||||||
from zerver.lib.test_helpers import reset_emails_in_zulip_realm
|
|
||||||
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.test_helpers import reset_emails_in_zulip_realm
|
||||||
ceiling_to_hour, datetime_to_timestamp
|
from zerver.lib.timestamp import ceiling_to_day, ceiling_to_hour, datetime_to_timestamp
|
||||||
from zerver.lib.actions import do_create_multiuse_invite_link, \
|
from zerver.models import Client, MultiuseInvite, get_realm
|
||||||
do_send_realm_reactivation_email
|
|
||||||
from zerver.models import Client, get_realm, MultiuseInvite
|
|
||||||
|
|
||||||
class TestStatsEndpoint(ZulipTestCase):
|
class TestStatsEndpoint(ZulipTestCase):
|
||||||
def test_stats(self) -> None:
|
def test_stats(self) -> None:
|
||||||
|
|
|
@ -6,54 +6,75 @@ import urllib
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
from datetime import datetime, timedelta, timezone
|
from datetime import datetime, timedelta, timezone
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
|
from typing import Any, Callable, Dict, List, Optional, Set, Tuple, Type, Union
|
||||||
from typing import Any, Callable, Dict, List, \
|
|
||||||
Optional, Set, Tuple, Type, Union
|
|
||||||
|
|
||||||
import pytz
|
import pytz
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.urls import reverse
|
from django.core.exceptions import ValidationError
|
||||||
|
from django.core.validators import URLValidator
|
||||||
from django.db import connection
|
from django.db import connection
|
||||||
from django.db.models.query import QuerySet
|
from django.db.models.query import QuerySet
|
||||||
from django.http import HttpRequest, HttpResponse, HttpResponseNotFound
|
from django.http import HttpRequest, HttpResponse, HttpResponseNotFound
|
||||||
from django.shortcuts import render
|
from django.shortcuts import render
|
||||||
from django.template import loader
|
from django.template import loader
|
||||||
|
from django.urls import reverse
|
||||||
|
from django.utils.timesince import timesince
|
||||||
from django.utils.timezone import now as timezone_now
|
from django.utils.timezone import now as timezone_now
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import ugettext as _
|
||||||
from django.utils.timesince import timesince
|
|
||||||
from django.core.validators import URLValidator
|
|
||||||
from django.core.exceptions import ValidationError
|
|
||||||
from jinja2 import Markup as mark_safe
|
from jinja2 import Markup as mark_safe
|
||||||
from psycopg2.sql import Composable, Literal, SQL
|
from psycopg2.sql import SQL, Composable, Literal
|
||||||
|
|
||||||
from analytics.lib.counts import COUNT_STATS, CountStat
|
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 BaseCount, InstallationCount, \
|
from analytics.models import (
|
||||||
RealmCount, StreamCount, UserCount, last_successful_fill, installation_epoch
|
BaseCount,
|
||||||
from confirmation.models import Confirmation, confirmation_url, _properties
|
InstallationCount,
|
||||||
from zerver.decorator import require_server_admin, require_server_admin_api, \
|
RealmCount,
|
||||||
to_utc_datetime, zulip_login_required, require_non_guest_user
|
StreamCount,
|
||||||
|
UserCount,
|
||||||
|
installation_epoch,
|
||||||
|
last_successful_fill,
|
||||||
|
)
|
||||||
|
from confirmation.models import Confirmation, _properties, confirmation_url
|
||||||
|
from confirmation.settings import STATUS_ACTIVE
|
||||||
|
from zerver.decorator import (
|
||||||
|
require_non_guest_user,
|
||||||
|
require_server_admin,
|
||||||
|
require_server_admin_api,
|
||||||
|
to_utc_datetime,
|
||||||
|
zulip_login_required,
|
||||||
|
)
|
||||||
|
from zerver.lib.actions import (
|
||||||
|
do_change_plan_type,
|
||||||
|
do_deactivate_realm,
|
||||||
|
do_scrub_realm,
|
||||||
|
do_send_realm_reactivation_email,
|
||||||
|
)
|
||||||
from zerver.lib.exceptions import JsonableError
|
from zerver.lib.exceptions import JsonableError
|
||||||
|
from zerver.lib.realm_icon import realm_icon_url
|
||||||
from zerver.lib.request import REQ, has_request_variables
|
from zerver.lib.request import REQ, has_request_variables
|
||||||
from zerver.lib.response import json_success
|
from zerver.lib.response import json_success
|
||||||
from zerver.lib.timestamp import convert_to_UTC, timestamp_to_datetime
|
|
||||||
from zerver.lib.realm_icon import realm_icon_url
|
|
||||||
from zerver.views.invite import get_invitee_emails_set
|
|
||||||
from zerver.lib.subdomains import get_subdomain_from_hostname
|
from zerver.lib.subdomains import get_subdomain_from_hostname
|
||||||
from zerver.lib.actions import do_change_plan_type, do_deactivate_realm, \
|
from zerver.lib.timestamp import convert_to_UTC, timestamp_to_datetime
|
||||||
do_send_realm_reactivation_email, do_scrub_realm
|
|
||||||
from zerver.lib.validator import to_non_negative_int
|
from zerver.lib.validator import to_non_negative_int
|
||||||
from confirmation.settings import STATUS_ACTIVE
|
from zerver.views.invite import get_invitee_emails_set
|
||||||
|
|
||||||
if settings.BILLING_ENABLED:
|
if settings.BILLING_ENABLED:
|
||||||
from corporate.lib.stripe import attach_discount_to_realm, get_discount_for_realm
|
from corporate.lib.stripe import attach_discount_to_realm, get_discount_for_realm
|
||||||
|
|
||||||
from zerver.models import Client, get_realm, Realm, UserActivity, UserActivityInterval, \
|
from zerver.models import (
|
||||||
UserProfile, PreregistrationUser, MultiuseInvite
|
Client,
|
||||||
|
MultiuseInvite,
|
||||||
|
PreregistrationUser,
|
||||||
|
Realm,
|
||||||
|
UserActivity,
|
||||||
|
UserActivityInterval,
|
||||||
|
UserProfile,
|
||||||
|
get_realm,
|
||||||
|
)
|
||||||
|
|
||||||
if settings.ZILENCER_ENABLED:
|
if settings.ZILENCER_ENABLED:
|
||||||
from zilencer.models import RemoteInstallationCount, RemoteRealmCount, \
|
from zilencer.models import RemoteInstallationCount, RemoteRealmCount, RemoteZulipServer
|
||||||
RemoteZulipServer
|
|
||||||
else:
|
else:
|
||||||
from unittest.mock import Mock
|
from unittest.mock import Mock
|
||||||
RemoteInstallationCount = Mock() # type: ignore[misc] # https://github.com/JukkaL/mypy/issues/1188
|
RemoteInstallationCount = Mock() # type: ignore[misc] # https://github.com/JukkaL/mypy/issues/1188
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
from django.db import models, migrations
|
|
||||||
import django.db.models.deletion
|
import django.db.models.deletion
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
from django.db import models, migrations
|
|
||||||
import django.utils.timezone
|
import django.utils.timezone
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
# Generated by Django 1.11.6 on 2017-11-30 00:13
|
# Generated by Django 1.11.6 on 2017-11-30 00:13
|
||||||
|
|
||||||
from django.db import migrations, models
|
|
||||||
import django.db.models.deletion
|
import django.db.models.deletion
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
|
@ -1,24 +1,23 @@
|
||||||
# Copyright: (c) 2008, Jarek Zgoda <jarek.zgoda@gmail.com>
|
# Copyright: (c) 2008, Jarek Zgoda <jarek.zgoda@gmail.com>
|
||||||
|
|
||||||
__revision__ = '$Id: models.py 28 2009-10-22 15:03:02Z jarek.zgoda $'
|
__revision__ = '$Id: models.py 28 2009-10-22 15:03:02Z jarek.zgoda $'
|
||||||
|
|
||||||
import datetime
|
import datetime
|
||||||
|
import string
|
||||||
|
from random import SystemRandom
|
||||||
|
from typing import Dict, Optional, Union
|
||||||
|
|
||||||
|
from django.conf import settings
|
||||||
|
from django.contrib.contenttypes.fields import GenericForeignKey
|
||||||
|
from django.contrib.contenttypes.models import ContentType
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.db.models import CASCADE
|
from django.db.models import CASCADE
|
||||||
from django.urls import reverse
|
|
||||||
from django.conf import settings
|
|
||||||
from django.contrib.contenttypes.models import ContentType
|
|
||||||
from django.contrib.contenttypes.fields import GenericForeignKey
|
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
from django.shortcuts import render
|
from django.shortcuts import render
|
||||||
|
from django.urls import reverse
|
||||||
from django.utils.timezone import now as timezone_now
|
from django.utils.timezone import now as timezone_now
|
||||||
|
|
||||||
from zerver.models import PreregistrationUser, EmailChangeStatus, MultiuseInvite, \
|
from zerver.models import EmailChangeStatus, MultiuseInvite, PreregistrationUser, Realm, UserProfile
|
||||||
UserProfile, Realm
|
|
||||||
from random import SystemRandom
|
|
||||||
import string
|
|
||||||
from typing import Dict, Optional, Union
|
|
||||||
|
|
||||||
class ConfirmationKeyException(Exception):
|
class ConfirmationKeyException(Exception):
|
||||||
WRONG_LENGTH = 1
|
WRONG_LENGTH = 1
|
||||||
|
|
|
@ -1,26 +1,31 @@
|
||||||
from datetime import datetime, timedelta
|
|
||||||
from decimal import Decimal
|
|
||||||
from functools import wraps
|
|
||||||
import logging
|
import logging
|
||||||
import math
|
import math
|
||||||
import os
|
import os
|
||||||
from typing import Any, Callable, Dict, Optional, TypeVar, Tuple, cast
|
from datetime import datetime, timedelta
|
||||||
import ujson
|
from decimal import Decimal
|
||||||
|
from functools import wraps
|
||||||
|
from typing import Any, Callable, Dict, Optional, Tuple, TypeVar, cast
|
||||||
|
|
||||||
from django.conf import settings
|
|
||||||
from django.db import transaction
|
|
||||||
from django.utils.translation import ugettext as _
|
|
||||||
from django.utils.timezone import now as timezone_now
|
|
||||||
from django.core.signing import Signer
|
|
||||||
import stripe
|
import stripe
|
||||||
|
import ujson
|
||||||
|
from django.conf import settings
|
||||||
|
from django.core.signing import Signer
|
||||||
|
from django.db import transaction
|
||||||
|
from django.utils.timezone import now as timezone_now
|
||||||
|
from django.utils.translation import ugettext as _
|
||||||
|
|
||||||
|
from corporate.models import (
|
||||||
|
Customer,
|
||||||
|
CustomerPlan,
|
||||||
|
LicenseLedger,
|
||||||
|
get_current_plan_by_customer,
|
||||||
|
get_current_plan_by_realm,
|
||||||
|
get_customer_by_realm,
|
||||||
|
)
|
||||||
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
|
||||||
from zerver.models import Realm, UserProfile, RealmAuditLog
|
from zerver.models import Realm, RealmAuditLog, UserProfile
|
||||||
from corporate.models import Customer, CustomerPlan, LicenseLedger, \
|
|
||||||
get_current_plan_by_customer, get_customer_by_realm, \
|
|
||||||
get_current_plan_by_realm
|
|
||||||
from zproject.config import get_secret
|
from zproject.config import get_secret
|
||||||
|
|
||||||
STRIPE_PUBLISHABLE_KEY = get_secret('stripe_publishable_key')
|
STRIPE_PUBLISHABLE_KEY = get_secret('stripe_publishable_key')
|
||||||
|
|
|
@ -7,6 +7,7 @@ from django.db.models import CASCADE
|
||||||
|
|
||||||
from zerver.models import Realm
|
from zerver.models import Realm
|
||||||
|
|
||||||
|
|
||||||
class Customer(models.Model):
|
class Customer(models.Model):
|
||||||
realm: Realm = models.OneToOneField(Realm, on_delete=CASCADE)
|
realm: Realm = models.OneToOneField(Realm, on_delete=CASCADE)
|
||||||
stripe_customer_id: str = models.CharField(max_length=255, null=True, unique=True)
|
stripe_customer_id: str = models.CharField(max_length=255, null=True, unique=True)
|
||||||
|
|
|
@ -1,43 +1,66 @@
|
||||||
from datetime import datetime, timedelta, timezone
|
import json
|
||||||
from decimal import Decimal
|
|
||||||
from functools import wraps
|
|
||||||
from unittest.mock import Mock, patch
|
|
||||||
import operator
|
import operator
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
from typing import Any, Callable, Dict, List, Optional, TypeVar, Tuple, cast
|
from datetime import datetime, timedelta, timezone
|
||||||
import ujson
|
from decimal import Decimal
|
||||||
import json
|
from functools import wraps
|
||||||
import responses
|
from typing import Any, Callable, Dict, List, Optional, Tuple, TypeVar, cast
|
||||||
|
from unittest.mock import Mock, patch
|
||||||
|
|
||||||
from django.core import signing
|
import responses
|
||||||
from django.urls.resolvers import get_resolver
|
import stripe
|
||||||
from django.http import HttpResponse
|
import ujson
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
from django.core import signing
|
||||||
|
from django.http import HttpResponse
|
||||||
|
from django.urls.resolvers import get_resolver
|
||||||
from django.utils.timezone import now as timezone_now
|
from django.utils.timezone import now as timezone_now
|
||||||
|
|
||||||
import stripe
|
from corporate.lib.stripe import (
|
||||||
|
MAX_INVOICED_LICENSES,
|
||||||
from zerver.lib.actions import do_deactivate_user, do_create_user, \
|
MIN_INVOICED_LICENSES,
|
||||||
do_activate_user, do_reactivate_user, do_deactivate_realm, \
|
BillingError,
|
||||||
do_reactivate_realm
|
StripeCardError,
|
||||||
|
add_months,
|
||||||
|
attach_discount_to_realm,
|
||||||
|
catch_stripe_errors,
|
||||||
|
compute_plan_parameters,
|
||||||
|
get_discount_for_realm,
|
||||||
|
get_latest_seat_count,
|
||||||
|
invoice_plan,
|
||||||
|
invoice_plans_as_needed,
|
||||||
|
make_end_of_cycle_updates_if_needed,
|
||||||
|
next_month,
|
||||||
|
process_initial_upgrade,
|
||||||
|
sign_string,
|
||||||
|
stripe_get_customer,
|
||||||
|
unsign_string,
|
||||||
|
update_license_ledger_for_automanaged_plan,
|
||||||
|
update_license_ledger_if_needed,
|
||||||
|
update_or_create_stripe_customer,
|
||||||
|
)
|
||||||
|
from corporate.models import (
|
||||||
|
Customer,
|
||||||
|
CustomerPlan,
|
||||||
|
LicenseLedger,
|
||||||
|
get_current_plan_by_customer,
|
||||||
|
get_current_plan_by_realm,
|
||||||
|
get_customer_by_realm,
|
||||||
|
)
|
||||||
|
from zerver.lib.actions import (
|
||||||
|
do_activate_user,
|
||||||
|
do_create_user,
|
||||||
|
do_deactivate_realm,
|
||||||
|
do_deactivate_user,
|
||||||
|
do_reactivate_realm,
|
||||||
|
do_reactivate_user,
|
||||||
|
)
|
||||||
from zerver.lib.test_classes import ZulipTestCase
|
from zerver.lib.test_classes import ZulipTestCase
|
||||||
from zerver.lib.test_helpers import reset_emails_in_zulip_realm
|
from zerver.lib.test_helpers import reset_emails_in_zulip_realm
|
||||||
from zerver.lib.timestamp import timestamp_to_datetime, datetime_to_timestamp
|
from zerver.lib.timestamp import datetime_to_timestamp, timestamp_to_datetime
|
||||||
from zerver.models import Realm, UserProfile, get_realm, RealmAuditLog
|
from zerver.models import Realm, RealmAuditLog, UserProfile, get_realm
|
||||||
from corporate.lib.stripe import catch_stripe_errors, attach_discount_to_realm, \
|
|
||||||
get_latest_seat_count, sign_string, unsign_string, \
|
|
||||||
BillingError, StripeCardError, stripe_get_customer, \
|
|
||||||
MIN_INVOICED_LICENSES, MAX_INVOICED_LICENSES, \
|
|
||||||
add_months, next_month, \
|
|
||||||
compute_plan_parameters, update_or_create_stripe_customer, \
|
|
||||||
process_initial_upgrade, make_end_of_cycle_updates_if_needed, \
|
|
||||||
update_license_ledger_if_needed, update_license_ledger_for_automanaged_plan, \
|
|
||||||
invoice_plan, invoice_plans_as_needed, get_discount_for_realm
|
|
||||||
from corporate.models import Customer, CustomerPlan, LicenseLedger, \
|
|
||||||
get_customer_by_realm, get_current_plan_by_customer, \
|
|
||||||
get_current_plan_by_realm
|
|
||||||
|
|
||||||
CallableT = TypeVar('CallableT', bound=Callable[..., Any])
|
CallableT = TypeVar('CallableT', bound=Callable[..., Any])
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from django.views.generic import TemplateView
|
|
||||||
from django.conf.urls import include
|
from django.conf.urls import include
|
||||||
from django.urls import path
|
from django.urls import path
|
||||||
|
from django.views.generic import TemplateView
|
||||||
|
|
||||||
import corporate.views
|
import corporate.views
|
||||||
from zerver.lib.rest import rest_dispatch
|
from zerver.lib.rest import rest_dispatch
|
||||||
|
|
|
@ -1,30 +1,45 @@
|
||||||
import logging
|
import logging
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
import stripe
|
from typing import Any, Dict, Optional, Union, cast
|
||||||
from typing import Any, Dict, cast, Optional, Union
|
|
||||||
|
|
||||||
|
import stripe
|
||||||
|
from django.conf import settings
|
||||||
from django.core import signing
|
from django.core import signing
|
||||||
from django.http import HttpRequest, HttpResponse, HttpResponseRedirect
|
from django.http import HttpRequest, HttpResponse, HttpResponseRedirect
|
||||||
from django.utils.timezone import now as timezone_now
|
|
||||||
from django.utils.translation import ugettext as _
|
|
||||||
from django.shortcuts import render
|
from django.shortcuts import render
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
from django.conf import settings
|
from django.utils.timezone import now as timezone_now
|
||||||
|
from django.utils.translation import ugettext as _
|
||||||
|
|
||||||
from zerver.decorator import zulip_login_required, require_billing_access
|
from corporate.lib.stripe import (
|
||||||
|
DEFAULT_INVOICE_DAYS_UNTIL_DUE,
|
||||||
|
MAX_INVOICED_LICENSES,
|
||||||
|
MIN_INVOICED_LICENSES,
|
||||||
|
STRIPE_PUBLISHABLE_KEY,
|
||||||
|
BillingError,
|
||||||
|
do_change_plan_status,
|
||||||
|
do_replace_payment_source,
|
||||||
|
downgrade_now,
|
||||||
|
get_latest_seat_count,
|
||||||
|
make_end_of_cycle_updates_if_needed,
|
||||||
|
process_initial_upgrade,
|
||||||
|
renewal_amount,
|
||||||
|
sign_string,
|
||||||
|
start_of_next_billing_cycle,
|
||||||
|
stripe_get_customer,
|
||||||
|
unsign_string,
|
||||||
|
)
|
||||||
|
from corporate.models import (
|
||||||
|
CustomerPlan,
|
||||||
|
get_current_plan_by_customer,
|
||||||
|
get_current_plan_by_realm,
|
||||||
|
get_customer_by_realm,
|
||||||
|
)
|
||||||
|
from zerver.decorator import require_billing_access, zulip_login_required
|
||||||
from zerver.lib.request import REQ, has_request_variables
|
from zerver.lib.request import REQ, has_request_variables
|
||||||
from zerver.lib.response import json_error, json_success
|
from zerver.lib.response import json_error, json_success
|
||||||
from zerver.lib.validator import check_string, check_int
|
from zerver.lib.validator import check_int, check_string
|
||||||
from zerver.models import UserProfile
|
from zerver.models import UserProfile
|
||||||
from corporate.lib.stripe import STRIPE_PUBLISHABLE_KEY, \
|
|
||||||
stripe_get_customer, get_latest_seat_count, \
|
|
||||||
process_initial_upgrade, sign_string, \
|
|
||||||
unsign_string, BillingError, do_change_plan_status, do_replace_payment_source, \
|
|
||||||
MIN_INVOICED_LICENSES, MAX_INVOICED_LICENSES, DEFAULT_INVOICE_DAYS_UNTIL_DUE, \
|
|
||||||
start_of_next_billing_cycle, renewal_amount, \
|
|
||||||
make_end_of_cycle_updates_if_needed, downgrade_now
|
|
||||||
from corporate.models import CustomerPlan, get_current_plan_by_customer, \
|
|
||||||
get_customer_by_realm, get_current_plan_by_realm
|
|
||||||
|
|
||||||
billing_logger = logging.getLogger('corporate.stripe')
|
billing_logger = logging.getLogger('corporate.stripe')
|
||||||
|
|
||||||
|
|
|
@ -10,10 +10,8 @@
|
||||||
#
|
#
|
||||||
# All configuration values have a default; values that are commented out
|
# All configuration values have a default; values that are commented out
|
||||||
# serve to show the default.
|
# serve to show the default.
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from typing import Any, Dict, List, Optional
|
from typing import Any, Dict, List, Optional
|
||||||
|
|
||||||
# If extensions (or modules to document with autodoc) are in another directory,
|
# If extensions (or modules to document with autodoc) are in another directory,
|
||||||
|
@ -310,6 +308,7 @@ source_suffix = {
|
||||||
# See https://github.com/zulip/zulip/issues/13263 for details.
|
# See https://github.com/zulip/zulip/issues/13263 for details.
|
||||||
from recommonmark.parser import CommonMarkParser
|
from recommonmark.parser import CommonMarkParser
|
||||||
|
|
||||||
|
|
||||||
class CustomCommonMarkParser(CommonMarkParser):
|
class CustomCommonMarkParser(CommonMarkParser):
|
||||||
def visit_document(self, node):
|
def visit_document(self, node):
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
import argparse
|
import argparse
|
||||||
|
import glob
|
||||||
|
import os
|
||||||
|
import shlex
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
import os
|
|
||||||
import glob
|
|
||||||
import shlex
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# In order to use remote casperjs debugging, pass the --remote-debug flag
|
# In order to use remote casperjs debugging, pass the --remote-debug flag
|
||||||
|
@ -64,13 +64,14 @@ sys.path.insert(0, ZULIP_PATH)
|
||||||
|
|
||||||
# check for the venv
|
# check for the venv
|
||||||
from tools.lib import sanity_check
|
from tools.lib import sanity_check
|
||||||
|
|
||||||
sanity_check.check_venv(__file__)
|
sanity_check.check_venv(__file__)
|
||||||
|
|
||||||
|
from typing import Iterable, List
|
||||||
|
|
||||||
from tools.lib.test_script import assert_provisioning_status_ok, find_js_test_files
|
from tools.lib.test_script import assert_provisioning_status_ok, find_js_test_files
|
||||||
from tools.lib.test_server import test_server_running
|
from tools.lib.test_server import test_server_running
|
||||||
|
|
||||||
from typing import Iterable, List
|
|
||||||
|
|
||||||
assert_provisioning_status_ok(options.force)
|
assert_provisioning_status_ok(options.force)
|
||||||
|
|
||||||
os.chdir(ZULIP_PATH)
|
os.chdir(ZULIP_PATH)
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
import configparser
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import configparser
|
|
||||||
if sys.version_info <= (3, 0):
|
if sys.version_info <= (3, 0):
|
||||||
print("Error: Zulip is a Python 3 project, and cannot be run with Python 2.")
|
print("Error: Zulip is a Python 3 project, and cannot be run with Python 2.")
|
||||||
print("Use e.g. `/path/to/manage.py` not `python /path/to/manage.py`.")
|
print("Use e.g. `/path/to/manage.py` not `python /path/to/manage.py`.")
|
||||||
|
@ -37,6 +38,7 @@ if __name__ == "__main__":
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.core.management import execute_from_command_line
|
from django.core.management import execute_from_command_line
|
||||||
from django.core.management.base import CommandError
|
from django.core.management.base import CommandError
|
||||||
|
|
||||||
from scripts.lib.zulip_tools import log_management_command
|
from scripts.lib.zulip_tools import log_management_command
|
||||||
|
|
||||||
log_management_command(" ".join(sys.argv), settings.MANAGEMENT_LOG_PATH)
|
log_management_command(" ".join(sys.argv), settings.MANAGEMENT_LOG_PATH)
|
||||||
|
|
|
@ -6,6 +6,7 @@ import sys
|
||||||
import time
|
import time
|
||||||
from typing import Tuple
|
from typing import Tuple
|
||||||
|
|
||||||
|
|
||||||
def nagios_from_file(results_file: str, max_time_diff: int=60 * 2) -> 'Tuple[int, str]':
|
def nagios_from_file(results_file: str, max_time_diff: int=60 * 2) -> 'Tuple[int, str]':
|
||||||
"""Returns a nagios-appropriate string and return code obtained by
|
"""Returns a nagios-appropriate string and return code obtained by
|
||||||
parsing the desired file on disk. The file on disk should be of format
|
parsing the desired file on disk. The file on disk should be of format
|
||||||
|
|
|
@ -8,12 +8,12 @@ It supports both munin and nagios outputs
|
||||||
It must be run on a machine that is using the live database for the
|
It must be run on a machine that is using the live database for the
|
||||||
Django ORM.
|
Django ORM.
|
||||||
"""
|
"""
|
||||||
import sys
|
|
||||||
import argparse
|
import argparse
|
||||||
|
import os
|
||||||
import random
|
import random
|
||||||
|
import sys
|
||||||
import time
|
import time
|
||||||
import traceback
|
import traceback
|
||||||
import os
|
|
||||||
|
|
||||||
sys.path.append('.')
|
sys.path.append('.')
|
||||||
sys.path.append('/home/zulip/deployments/current')
|
sys.path.append('/home/zulip/deployments/current')
|
||||||
|
@ -21,10 +21,10 @@ from scripts.lib.setup_path import setup_path
|
||||||
|
|
||||||
setup_path()
|
setup_path()
|
||||||
|
|
||||||
import django
|
|
||||||
|
|
||||||
from typing import Any, Dict, List, Optional
|
from typing import Any, Dict, List, Optional
|
||||||
|
|
||||||
|
import django
|
||||||
|
|
||||||
usage = """Usage: send-receive.py [options] [config]
|
usage = """Usage: send-receive.py [options] [config]
|
||||||
|
|
||||||
'config' is optional, if present will return config info.
|
'config' is optional, if present will return config info.
|
||||||
|
@ -75,9 +75,10 @@ os.environ['DJANGO_SETTINGS_MODULE'] = "zproject.settings"
|
||||||
|
|
||||||
django.setup()
|
django.setup()
|
||||||
|
|
||||||
from zerver.models import get_system_bot
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
|
||||||
|
from zerver.models import get_system_bot
|
||||||
|
|
||||||
states = {
|
states = {
|
||||||
"OK": 0,
|
"OK": 0,
|
||||||
"WARNING": 1,
|
"WARNING": 1,
|
||||||
|
|
|
@ -4,10 +4,9 @@
|
||||||
Nagios plugin to check the difference between the primary and
|
Nagios plugin to check the difference between the primary and
|
||||||
secondary Postgres servers' xlog location.
|
secondary Postgres servers' xlog location.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import configparser
|
import configparser
|
||||||
import subprocess
|
|
||||||
import re
|
import re
|
||||||
|
import subprocess
|
||||||
from typing import NoReturn
|
from typing import NoReturn
|
||||||
|
|
||||||
states = {
|
states = {
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
Nagios plugin to check the length of the FTS update log.
|
Nagios plugin to check the length of the FTS update log.
|
||||||
"""
|
"""
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
sys.path.append('/home/zulip/deployments/current')
|
sys.path.append('/home/zulip/deployments/current')
|
||||||
try:
|
try:
|
||||||
from scripts.lib.setup_path import setup_path
|
from scripts.lib.setup_path import setup_path
|
||||||
|
|
|
@ -1,16 +1,16 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
import os
|
|
||||||
import sys
|
|
||||||
import glob
|
import glob
|
||||||
|
import logging
|
||||||
|
import os
|
||||||
import shlex
|
import shlex
|
||||||
import subprocess
|
import subprocess
|
||||||
import logging
|
import sys
|
||||||
import dateutil.parser
|
|
||||||
import time
|
import time
|
||||||
from datetime import datetime, timedelta, timezone
|
from datetime import datetime, timedelta, timezone
|
||||||
from typing import Dict, List
|
from typing import Dict, List
|
||||||
|
|
||||||
|
import dateutil.parser
|
||||||
|
|
||||||
logging.Formatter.converter = time.gmtime
|
logging.Formatter.converter = time.gmtime
|
||||||
logging.basicConfig(format="%(asctime)s %(levelname)s: %(message)s")
|
logging.basicConfig(format="%(asctime)s %(levelname)s: %(message)s")
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
|
@ -23,14 +23,15 @@ except ImportError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
|
import configparser
|
||||||
|
import logging
|
||||||
|
import os
|
||||||
|
import select
|
||||||
|
import sys
|
||||||
|
import time
|
||||||
|
|
||||||
import psycopg2
|
import psycopg2
|
||||||
import psycopg2.extensions
|
import psycopg2.extensions
|
||||||
import select
|
|
||||||
import time
|
|
||||||
import logging
|
|
||||||
import configparser
|
|
||||||
import sys
|
|
||||||
import os
|
|
||||||
|
|
||||||
BATCH_SIZE = 1000
|
BATCH_SIZE = 1000
|
||||||
|
|
||||||
|
|
|
@ -8,9 +8,9 @@ This script works by just monitoring the files under
|
||||||
mirrors when they receive the messages sent every minute by
|
mirrors when they receive the messages sent every minute by
|
||||||
/etc/cron.d/test_zephyr_personal_mirrors
|
/etc/cron.d/test_zephyr_personal_mirrors
|
||||||
"""
|
"""
|
||||||
from typing import Dict
|
|
||||||
import os
|
import os
|
||||||
import time
|
import time
|
||||||
|
from typing import Dict
|
||||||
|
|
||||||
RESULTS_DIR: str = "/home/zulip/mirror_status"
|
RESULTS_DIR: str = "/home/zulip/mirror_status"
|
||||||
|
|
||||||
|
|
|
@ -24,9 +24,9 @@ sys.path.append('/home/zulip/deployments/current/zerver')
|
||||||
|
|
||||||
django.setup()
|
django.setup()
|
||||||
|
|
||||||
from zerver.models import UserActivity
|
from typing import Any, Dict, Optional, Set
|
||||||
|
|
||||||
from typing import Any, Dict, Set, Optional
|
from zerver.models import UserActivity
|
||||||
|
|
||||||
states: Dict[str, int] = {
|
states: Dict[str, int] = {
|
||||||
"OK": 0,
|
"OK": 0,
|
||||||
|
|
|
@ -9,9 +9,9 @@ run out of cron.
|
||||||
|
|
||||||
See puppet/zulip_ops/files/cron.d/zephyr-mirror for the crontab details.
|
See puppet/zulip_ops/files/cron.d/zephyr-mirror for the crontab details.
|
||||||
"""
|
"""
|
||||||
from typing import Dict
|
|
||||||
import os
|
import os
|
||||||
import time
|
import time
|
||||||
|
from typing import Dict
|
||||||
|
|
||||||
RESULTS_FILE = "/var/lib/nagios_state/check-mirroring-results"
|
RESULTS_FILE = "/var/lib/nagios_state/check-mirroring-results"
|
||||||
|
|
||||||
|
|
|
@ -40,16 +40,15 @@ Note that it currently does not handle the deconfiguration of
|
||||||
interfaces.
|
interfaces.
|
||||||
|
|
||||||
'''
|
'''
|
||||||
|
|
||||||
import sys
|
|
||||||
import logging
|
import logging
|
||||||
import logging.handlers
|
import logging.handlers
|
||||||
import subprocess
|
import subprocess
|
||||||
|
import sys
|
||||||
|
from typing import Optional
|
||||||
|
|
||||||
import boto.utils
|
import boto.utils
|
||||||
import netifaces
|
import netifaces
|
||||||
|
|
||||||
from typing import Optional
|
|
||||||
|
|
||||||
def address_of(device_id: int) -> Optional[str]:
|
def address_of(device_id: int) -> Optional[str]:
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
|
import json
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import time
|
|
||||||
import subprocess
|
import subprocess
|
||||||
import json
|
import time
|
||||||
|
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
from typing import Any, DefaultDict, Dict, List
|
from typing import Any, DefaultDict, Dict, List
|
||||||
|
|
||||||
|
|
|
@ -4,8 +4,9 @@ import sys
|
||||||
|
|
||||||
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)
|
||||||
|
from scripts.lib import clean_emoji_cache, clean_node_cache, clean_venv_cache
|
||||||
from scripts.lib.zulip_tools import parse_cache_script_args
|
from scripts.lib.zulip_tools import parse_cache_script_args
|
||||||
from scripts.lib import clean_venv_cache, clean_node_cache, clean_emoji_cache
|
|
||||||
|
|
||||||
def main() -> None:
|
def main() -> None:
|
||||||
args = parse_cache_script_args("This script cleans unused zulip caches.")
|
args = parse_cache_script_args("This script cleans unused zulip caches.")
|
||||||
|
|
|
@ -2,14 +2,16 @@
|
||||||
import argparse
|
import argparse
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from typing import Set
|
from typing import Set
|
||||||
|
|
||||||
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)
|
||||||
from scripts.lib.zulip_tools import \
|
from scripts.lib.zulip_tools import (
|
||||||
get_environment, get_recent_deployments, \
|
get_environment,
|
||||||
parse_cache_script_args, purge_unused_caches
|
get_recent_deployments,
|
||||||
|
parse_cache_script_args,
|
||||||
|
purge_unused_caches,
|
||||||
|
)
|
||||||
|
|
||||||
ENV = get_environment()
|
ENV = get_environment()
|
||||||
EMOJI_CACHE_PATH = "/srv/zulip-emoji-cache"
|
EMOJI_CACHE_PATH = "/srv/zulip-emoji-cache"
|
||||||
|
|
|
@ -2,14 +2,16 @@
|
||||||
import argparse
|
import argparse
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from typing import Set
|
from typing import Set
|
||||||
|
|
||||||
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)
|
||||||
from scripts.lib.zulip_tools import \
|
from scripts.lib.zulip_tools import (
|
||||||
get_environment, get_recent_deployments, parse_cache_script_args, \
|
get_environment,
|
||||||
purge_unused_caches
|
get_recent_deployments,
|
||||||
|
parse_cache_script_args,
|
||||||
|
purge_unused_caches,
|
||||||
|
)
|
||||||
|
|
||||||
ENV = get_environment()
|
ENV = get_environment()
|
||||||
NODE_MODULES_CACHE_PATH = "/srv/zulip-npm-cache"
|
NODE_MODULES_CACHE_PATH = "/srv/zulip-npm-cache"
|
||||||
|
|
|
@ -3,15 +3,17 @@ import argparse
|
||||||
import glob
|
import glob
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from typing import Set
|
from typing import Set
|
||||||
|
|
||||||
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)
|
||||||
from scripts.lib.hash_reqs import expand_reqs, hash_deps
|
from scripts.lib.hash_reqs import expand_reqs, hash_deps
|
||||||
from scripts.lib.zulip_tools import \
|
from scripts.lib.zulip_tools import (
|
||||||
get_environment, get_recent_deployments, parse_cache_script_args, \
|
get_environment,
|
||||||
purge_unused_caches
|
get_recent_deployments,
|
||||||
|
parse_cache_script_args,
|
||||||
|
purge_unused_caches,
|
||||||
|
)
|
||||||
|
|
||||||
ENV = get_environment()
|
ENV = get_environment()
|
||||||
VENV_CACHE_DIR = '/srv/zulip-venv-cache'
|
VENV_CACHE_DIR = '/srv/zulip-venv-cache'
|
||||||
|
|
|
@ -1,17 +1,14 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
import os
|
|
||||||
import argparse
|
import argparse
|
||||||
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
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__))))
|
||||||
if ZULIP_PATH not in sys.path:
|
if ZULIP_PATH not in sys.path:
|
||||||
sys.path.append(ZULIP_PATH)
|
sys.path.append(ZULIP_PATH)
|
||||||
|
|
||||||
from scripts.lib.zulip_tools import os_families, overwrite_symlink, run, parse_os_release
|
from scripts.lib.setup_venv import get_venv_dependencies, setup_virtualenv
|
||||||
from scripts.lib.setup_venv import (
|
from scripts.lib.zulip_tools import os_families, overwrite_symlink, parse_os_release, run
|
||||||
setup_virtualenv, get_venv_dependencies,
|
|
||||||
)
|
|
||||||
|
|
||||||
parser = argparse.ArgumentParser(description="Create a production virtualenv with caching")
|
parser = argparse.ArgumentParser(description="Create a production virtualenv with caching")
|
||||||
parser.add_argument("deploy_path")
|
parser.add_argument("deploy_path")
|
||||||
|
|
|
@ -1,17 +1,18 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
import os
|
|
||||||
import argparse
|
import argparse
|
||||||
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
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__))))
|
||||||
if ZULIP_PATH not in sys.path:
|
if ZULIP_PATH not in sys.path:
|
||||||
sys.path.append(ZULIP_PATH)
|
sys.path.append(ZULIP_PATH)
|
||||||
|
|
||||||
from scripts.lib.zulip_tools import os_families, run, parse_os_release
|
|
||||||
from scripts.lib.setup_venv import (
|
from scripts.lib.setup_venv import (
|
||||||
setup_virtualenv, THUMBOR_VENV_DEPENDENCIES, YUM_THUMBOR_VENV_DEPENDENCIES,
|
THUMBOR_VENV_DEPENDENCIES,
|
||||||
|
YUM_THUMBOR_VENV_DEPENDENCIES,
|
||||||
|
setup_virtualenv,
|
||||||
)
|
)
|
||||||
|
from scripts.lib.zulip_tools import os_families, parse_os_release, run
|
||||||
|
|
||||||
parser = argparse.ArgumentParser(description="Create a thumbor virtualenv with caching")
|
parser = argparse.ArgumentParser(description="Create a thumbor virtualenv with caching")
|
||||||
parser.add_argument("deploy_path")
|
parser.add_argument("deploy_path")
|
||||||
|
|
|
@ -40,21 +40,16 @@ Also you can use optional keys to configure the script and change default values
|
||||||
-t Disable sending request to the Zulip server. Default value: False.
|
-t Disable sending request to the Zulip server. Default value: False.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
import argparse
|
||||||
|
import json
|
||||||
import os
|
import os
|
||||||
|
import posix
|
||||||
import ssl
|
import ssl
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
import argparse
|
|
||||||
|
|
||||||
import posix
|
|
||||||
import json
|
|
||||||
|
|
||||||
from urllib.parse import urljoin, urlencode
|
|
||||||
from urllib.request import Request, urlopen
|
|
||||||
from urllib.error import HTTPError
|
|
||||||
from configparser import RawConfigParser
|
from configparser import RawConfigParser
|
||||||
|
from urllib.error import HTTPError
|
||||||
|
from urllib.parse import urlencode, urljoin
|
||||||
|
from urllib.request import Request, urlopen
|
||||||
|
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
import os
|
|
||||||
import sys
|
|
||||||
import argparse
|
import argparse
|
||||||
import hashlib
|
import hashlib
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
from typing import Iterable, List, MutableSet
|
from typing import Iterable, List, MutableSet
|
||||||
|
|
||||||
|
|
||||||
def expand_reqs_helper(fpath: str, visited: MutableSet[str]) -> List[str]:
|
def expand_reqs_helper(fpath: str, visited: MutableSet[str]) -> List[str]:
|
||||||
if fpath in visited:
|
if fpath in visited:
|
||||||
return []
|
return []
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
import os
|
|
||||||
import hashlib
|
import hashlib
|
||||||
import json
|
import json
|
||||||
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
|
from typing import List, Optional
|
||||||
|
|
||||||
from typing import Optional, List
|
from scripts.lib.zulip_tools import run, subprocess_text_output
|
||||||
from scripts.lib.zulip_tools import subprocess_text_output, run
|
|
||||||
|
|
||||||
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__))))
|
||||||
ZULIP_SRV_PATH = "/srv"
|
ZULIP_SRV_PATH = "/srv"
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
try:
|
try:
|
||||||
from django.conf import settings # noqa: F401
|
from django.conf import settings # noqa: F401
|
||||||
from zerver.models import * # noqa: F401, F403
|
|
||||||
from zerver.lib.actions import * # noqa: F401, F403
|
|
||||||
from analytics.models import * # noqa: F401, F403
|
from analytics.models import * # noqa: F401, F403
|
||||||
|
from zerver.lib.actions import * # noqa: F401, F403
|
||||||
|
from zerver.models import * # noqa: F401, F403
|
||||||
except Exception:
|
except Exception:
|
||||||
import traceback
|
import traceback
|
||||||
print("\nException importing Zulip core modules on startup!")
|
print("\nException importing Zulip core modules on startup!")
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
@ -13,6 +12,7 @@ setup_path()
|
||||||
os.environ['DJANGO_SETTINGS_MODULE'] = 'zproject.settings'
|
os.environ['DJANGO_SETTINGS_MODULE'] = 'zproject.settings'
|
||||||
|
|
||||||
import django
|
import django
|
||||||
|
|
||||||
django.setup()
|
django.setup()
|
||||||
from zerver.worker.queue_processors import get_active_worker_queues
|
from zerver.worker.queue_processors import get_active_worker_queues
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
"""
|
"""
|
||||||
Use libraries from a virtualenv (by modifying sys.path) in production.
|
Use libraries from a virtualenv (by modifying sys.path) in production.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
|
||||||
def setup_path() -> None:
|
def setup_path() -> None:
|
||||||
if os.path.basename(sys.prefix) != "zulip-py3-venv":
|
if os.path.basename(sys.prefix) != "zulip-py3-venv":
|
||||||
BASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
BASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||||
|
|
|
@ -2,10 +2,10 @@ import logging
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
import subprocess
|
import subprocess
|
||||||
from scripts.lib.zulip_tools import run, run_as_root, ENDC, WARNING, os_families
|
from typing import List, Optional, Set, Tuple
|
||||||
from scripts.lib.hash_reqs import expand_reqs
|
|
||||||
|
|
||||||
from typing import List, Optional, Tuple, Set
|
from scripts.lib.hash_reqs import expand_reqs
|
||||||
|
from scripts.lib.zulip_tools import ENDC, WARNING, os_families, run, run_as_root
|
||||||
|
|
||||||
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__))))
|
||||||
VENV_CACHE_PATH = "/srv/zulip-venv-cache"
|
VENV_CACHE_PATH = "/srv/zulip-venv-cache"
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
|
@ -14,6 +13,7 @@ setup_path()
|
||||||
|
|
||||||
from scripts.lib.zulip_tools import get_config_file
|
from scripts.lib.zulip_tools import get_config_file
|
||||||
|
|
||||||
|
|
||||||
def write_realm_nginx_config_line(f: Any, host: str, port: str) -> None:
|
def write_realm_nginx_config_line(f: Any, host: str, port: str) -> None:
|
||||||
f.write("""if ($host = '{}') {{
|
f.write("""if ($host = '{}') {{
|
||||||
set $tornado_server http://tornado{};
|
set $tornado_server http://tornado{};
|
||||||
|
|
|
@ -1,17 +1,24 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
import glob
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
import sys
|
|
||||||
import subprocess
|
import subprocess
|
||||||
|
import sys
|
||||||
import tempfile
|
import tempfile
|
||||||
import glob
|
|
||||||
|
|
||||||
os.environ["PYTHONUNBUFFERED"] = "y"
|
os.environ["PYTHONUNBUFFERED"] = "y"
|
||||||
|
|
||||||
sys.path.append(os.path.join(os.path.dirname(__file__), '..', ".."))
|
sys.path.append(os.path.join(os.path.dirname(__file__), '..', ".."))
|
||||||
from scripts.lib.zulip_tools import DEPLOYMENTS_DIR, FAIL, ENDC, make_deploy_path, \
|
|
||||||
get_deployment_version, is_invalid_upgrade, overwrite_symlink
|
|
||||||
import version
|
import version
|
||||||
|
from scripts.lib.zulip_tools import (
|
||||||
|
DEPLOYMENTS_DIR,
|
||||||
|
ENDC,
|
||||||
|
FAIL,
|
||||||
|
get_deployment_version,
|
||||||
|
is_invalid_upgrade,
|
||||||
|
make_deploy_path,
|
||||||
|
overwrite_symlink,
|
||||||
|
)
|
||||||
|
|
||||||
if len(sys.argv) != 2:
|
if len(sys.argv) != 2:
|
||||||
print(FAIL + f"Usage: {sys.argv[0]} <tarball>" + ENDC)
|
print(FAIL + f"Usage: {sys.argv[0]} <tarball>" + ENDC)
|
||||||
|
|
|
@ -1,19 +1,27 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
import configparser
|
||||||
|
import logging
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
import sys
|
|
||||||
import subprocess
|
import subprocess
|
||||||
import logging
|
import sys
|
||||||
import time
|
import time
|
||||||
import configparser
|
|
||||||
|
|
||||||
TARBALL_ARCHIVE_PATH = "/home/zulip/archives"
|
TARBALL_ARCHIVE_PATH = "/home/zulip/archives"
|
||||||
os.environ["PYTHONUNBUFFERED"] = "y"
|
os.environ["PYTHONUNBUFFERED"] = "y"
|
||||||
|
|
||||||
sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..'))
|
sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..'))
|
||||||
from scripts.lib.zulip_tools import DEPLOYMENTS_DIR, FAIL, ENDC, \
|
from scripts.lib.zulip_tools import (
|
||||||
su_to_zulip, get_deployment_lock, release_deployment_lock, assert_running_as_root, \
|
DEPLOYMENTS_DIR,
|
||||||
get_config_file, get_deploy_options
|
ENDC,
|
||||||
|
FAIL,
|
||||||
|
assert_running_as_root,
|
||||||
|
get_config_file,
|
||||||
|
get_deploy_options,
|
||||||
|
get_deployment_lock,
|
||||||
|
release_deployment_lock,
|
||||||
|
su_to_zulip,
|
||||||
|
)
|
||||||
|
|
||||||
config_file: configparser.RawConfigParser = get_config_file()
|
config_file: configparser.RawConfigParser = get_config_file()
|
||||||
deploy_options = get_deploy_options(config_file)
|
deploy_options = get_deploy_options(config_file)
|
||||||
|
|
|
@ -1,18 +1,27 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
import os
|
|
||||||
import sys
|
|
||||||
import subprocess
|
|
||||||
import logging
|
|
||||||
import time
|
|
||||||
import argparse
|
import argparse
|
||||||
|
import logging
|
||||||
|
import os
|
||||||
|
import subprocess
|
||||||
|
import sys
|
||||||
|
import time
|
||||||
|
|
||||||
LOCAL_GIT_CACHE_DIR = '/srv/zulip.git'
|
LOCAL_GIT_CACHE_DIR = '/srv/zulip.git'
|
||||||
os.environ["PYTHONUNBUFFERED"] = "y"
|
os.environ["PYTHONUNBUFFERED"] = "y"
|
||||||
|
|
||||||
sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..'))
|
sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..'))
|
||||||
from scripts.lib.zulip_tools import DEPLOYMENTS_DIR, make_deploy_path, \
|
from scripts.lib.zulip_tools import (
|
||||||
get_deployment_lock, overwrite_symlink, release_deployment_lock, su_to_zulip, assert_running_as_root, \
|
DEPLOYMENTS_DIR,
|
||||||
get_config_file, get_deploy_options, get_config
|
assert_running_as_root,
|
||||||
|
get_config,
|
||||||
|
get_config_file,
|
||||||
|
get_deploy_options,
|
||||||
|
get_deployment_lock,
|
||||||
|
make_deploy_path,
|
||||||
|
overwrite_symlink,
|
||||||
|
release_deployment_lock,
|
||||||
|
su_to_zulip,
|
||||||
|
)
|
||||||
|
|
||||||
config_file = get_config_file()
|
config_file = get_config_file()
|
||||||
deploy_options = get_deploy_options(config_file)
|
deploy_options = get_deploy_options(config_file)
|
||||||
|
|
|
@ -8,10 +8,10 @@ import argparse
|
||||||
import configparser
|
import configparser
|
||||||
import glob
|
import glob
|
||||||
import hashlib
|
import hashlib
|
||||||
import subprocess
|
|
||||||
import os
|
|
||||||
import sys
|
|
||||||
import logging
|
import logging
|
||||||
|
import os
|
||||||
|
import subprocess
|
||||||
|
import sys
|
||||||
import time
|
import time
|
||||||
|
|
||||||
os.environ["PYTHONUNBUFFERED"] = "y"
|
os.environ["PYTHONUNBUFFERED"] = "y"
|
||||||
|
@ -22,8 +22,12 @@ os.environ["LANG"] = "en_US.UTF-8"
|
||||||
os.environ["LANGUAGE"] = "en_US.UTF-8"
|
os.environ["LANGUAGE"] = "en_US.UTF-8"
|
||||||
|
|
||||||
sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..'))
|
sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..'))
|
||||||
from scripts.lib.zulip_tools import DEPLOYMENTS_DIR, su_to_zulip, \
|
from scripts.lib.zulip_tools import (
|
||||||
assert_running_as_root, parse_os_release
|
DEPLOYMENTS_DIR,
|
||||||
|
assert_running_as_root,
|
||||||
|
parse_os_release,
|
||||||
|
su_to_zulip,
|
||||||
|
)
|
||||||
|
|
||||||
assert_running_as_root()
|
assert_running_as_root()
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
import argparse
|
import argparse
|
||||||
|
import configparser
|
||||||
import datetime
|
import datetime
|
||||||
import functools
|
import functools
|
||||||
import hashlib
|
import hashlib
|
||||||
|
import json
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import pwd
|
import pwd
|
||||||
|
@ -13,11 +15,8 @@ import subprocess
|
||||||
import sys
|
import sys
|
||||||
import tempfile
|
import tempfile
|
||||||
import time
|
import time
|
||||||
import json
|
|
||||||
import uuid
|
import uuid
|
||||||
import configparser
|
from typing import Any, Dict, List, Sequence, Set
|
||||||
|
|
||||||
from typing import Sequence, Set, Any, Dict, List
|
|
||||||
|
|
||||||
DEPLOYMENTS_DIR = "/home/zulip/deployments"
|
DEPLOYMENTS_DIR = "/home/zulip/deployments"
|
||||||
LOCK_DIR = os.path.join(DEPLOYMENTS_DIR, "lock")
|
LOCK_DIR = os.path.join(DEPLOYMENTS_DIR, "lock")
|
||||||
|
|
|
@ -1,12 +1,11 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
import sys
|
|
||||||
import time
|
|
||||||
import argparse
|
import argparse
|
||||||
import configparser
|
import configparser
|
||||||
from collections import defaultdict
|
|
||||||
import os
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
|
import sys
|
||||||
|
import time
|
||||||
|
from collections import defaultdict
|
||||||
from typing import Dict
|
from typing import Dict
|
||||||
|
|
||||||
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__))))
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import time
|
import time
|
||||||
|
|
||||||
from typing import Tuple
|
from typing import Tuple
|
||||||
|
|
||||||
|
|
||||||
def nagios_from_file(results_file: str) -> Tuple[int, str]:
|
def nagios_from_file(results_file: str) -> Tuple[int, str]:
|
||||||
"""Returns a nagios-appropriate string and return code obtained by
|
"""Returns a nagios-appropriate string and return code obtained by
|
||||||
parsing the desired file on disk. The file on disk should be of format
|
parsing the desired file on disk. The file on disk should be of format
|
||||||
|
|
|
@ -3,13 +3,12 @@ import argparse
|
||||||
import os
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from typing import Set
|
from typing import Set
|
||||||
|
|
||||||
ZULIP_PATH = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
ZULIP_PATH = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||||
sys.path.append(ZULIP_PATH)
|
sys.path.append(ZULIP_PATH)
|
||||||
from scripts.lib.zulip_tools import DEPLOYMENTS_DIR, get_recent_deployments, \
|
from scripts.lib.zulip_tools import DEPLOYMENTS_DIR, get_recent_deployments, may_be_perform_purging
|
||||||
may_be_perform_purging
|
|
||||||
|
|
||||||
def parse_args() -> argparse.Namespace:
|
def parse_args() -> argparse.Namespace:
|
||||||
parser = argparse.ArgumentParser(
|
parser = argparse.ArgumentParser(
|
||||||
|
|
|
@ -1,16 +1,16 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
import argparse
|
import argparse
|
||||||
import configparser
|
import configparser
|
||||||
import os
|
|
||||||
import sys
|
|
||||||
import pwd
|
|
||||||
import subprocess
|
|
||||||
import logging
|
import logging
|
||||||
import time
|
import os
|
||||||
|
import pwd
|
||||||
import shlex
|
import shlex
|
||||||
|
import subprocess
|
||||||
|
import sys
|
||||||
|
import time
|
||||||
|
|
||||||
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
|
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
|
||||||
from scripts.lib.zulip_tools import ENDC, OKGREEN, WARNING, DEPLOYMENTS_DIR, overwrite_symlink
|
from scripts.lib.zulip_tools import DEPLOYMENTS_DIR, ENDC, OKGREEN, WARNING, overwrite_symlink
|
||||||
|
|
||||||
logging.Formatter.converter = time.gmtime
|
logging.Formatter.converter = time.gmtime
|
||||||
logging.basicConfig(format="%(asctime)s restart-server: %(message)s",
|
logging.basicConfig(format="%(asctime)s restart-server: %(message)s",
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
@ -10,9 +9,10 @@ from scripts.lib.setup_path import setup_path
|
||||||
|
|
||||||
setup_path()
|
setup_path()
|
||||||
|
|
||||||
from zproject import settings
|
|
||||||
import pylibmc
|
import pylibmc
|
||||||
|
|
||||||
|
from zproject import settings
|
||||||
|
|
||||||
pylibmc.Client(
|
pylibmc.Client(
|
||||||
[settings.MEMCACHED_LOCATION],
|
[settings.MEMCACHED_LOCATION],
|
||||||
binary=True,
|
binary=True,
|
||||||
|
|
|
@ -1,9 +1,7 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
# This tools generates /etc/zulip/zulip-secrets.conf
|
# This tools generates /etc/zulip/zulip-secrets.conf
|
||||||
|
|
||||||
import sys
|
|
||||||
import os
|
import os
|
||||||
|
import sys
|
||||||
from typing import Dict, List
|
from typing import Dict, List
|
||||||
|
|
||||||
BASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
BASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||||
|
@ -15,8 +13,8 @@ setup_path()
|
||||||
os.environ['DJANGO_SETTINGS_MODULE'] = 'zproject.settings'
|
os.environ['DJANGO_SETTINGS_MODULE'] = 'zproject.settings'
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
import uuid
|
|
||||||
import configparser
|
import configparser
|
||||||
|
import uuid
|
||||||
|
|
||||||
os.chdir(os.path.join(os.path.dirname(__file__), '..', '..'))
|
os.chdir(os.path.join(os.path.dirname(__file__), '..', '..'))
|
||||||
|
|
||||||
|
@ -140,6 +138,7 @@ def generate_secrets(development: bool = False) -> None:
|
||||||
# file directly.
|
# file directly.
|
||||||
|
|
||||||
import redis
|
import redis
|
||||||
|
|
||||||
from zerver.lib.redis_utils import get_redis_client
|
from zerver.lib.redis_utils import get_redis_client
|
||||||
|
|
||||||
redis_password = random_token()
|
redis_password = random_token()
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from premailer import Premailer
|
|
||||||
from cssutils import profile
|
|
||||||
from cssutils.profiles import Profiles, properties, macros
|
|
||||||
from typing import Set
|
from typing import Set
|
||||||
|
|
||||||
|
from cssutils import profile
|
||||||
|
from cssutils.profiles import Profiles, macros, properties
|
||||||
|
from premailer import Premailer
|
||||||
|
|
||||||
ZULIP_PATH = os.path.join(os.path.dirname(os.path.abspath(__file__)), '../../')
|
ZULIP_PATH = os.path.join(os.path.dirname(os.path.abspath(__file__)), '../../')
|
||||||
EMAIL_TEMPLATES_PATH = os.path.join(ZULIP_PATH, 'templates', 'zerver', 'emails')
|
EMAIL_TEMPLATES_PATH = os.path.join(ZULIP_PATH, 'templates', 'zerver', 'emails')
|
||||||
COMPILED_EMAIL_TEMPLATES_PATH = os.path.join(EMAIL_TEMPLATES_PATH, 'compiled')
|
COMPILED_EMAIL_TEMPLATES_PATH = os.path.join(EMAIL_TEMPLATES_PATH, 'compiled')
|
||||||
|
|
|
@ -1,17 +1,15 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
import tempfile
|
import tempfile
|
||||||
|
|
||||||
from typing import IO
|
from typing import IO
|
||||||
|
|
||||||
BASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
BASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||||
sys.path.append(BASE_DIR)
|
sys.path.append(BASE_DIR)
|
||||||
from scripts.lib.zulip_tools import su_to_zulip, run
|
from scripts.lib.zulip_tools import run, su_to_zulip
|
||||||
|
|
||||||
POSTGRES_USER = "postgres"
|
POSTGRES_USER = "postgres"
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
import os
|
|
||||||
import sys
|
|
||||||
import subprocess
|
|
||||||
import configparser
|
import configparser
|
||||||
|
import os
|
||||||
import re
|
import re
|
||||||
from lib.zulip_tools import parse_os_release, assert_running_as_root
|
import subprocess
|
||||||
|
import sys
|
||||||
|
|
||||||
|
from lib.zulip_tools import assert_running_as_root, parse_os_release
|
||||||
|
|
||||||
assert_running_as_root()
|
assert_running_as_root()
|
||||||
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
import xml.etree.ElementTree as ET
|
|
||||||
import subprocess
|
import subprocess
|
||||||
|
from xml.etree import ElementTree as ET
|
||||||
|
|
||||||
# Generates the favicon images containing unread message counts.
|
# Generates the favicon images containing unread message counts.
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
# check for the venv
|
# check for the venv
|
||||||
from lib import sanity_check
|
from lib import sanity_check
|
||||||
|
|
||||||
sanity_check.check_venv(__file__)
|
sanity_check.check_venv(__file__)
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
|
@ -12,8 +13,7 @@ import subprocess
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
|
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
|
||||||
from scripts.lib.zulip_tools import WARNING, FAIL, ENDC
|
from scripts.lib.zulip_tools import ENDC, FAIL, WARNING
|
||||||
|
|
||||||
from tools.lib.capitalization import check_capitalization
|
from tools.lib.capitalization import check_capitalization
|
||||||
|
|
||||||
DJANGO_PO_REGEX = re.compile('msgid "(.*?)"')
|
DJANGO_PO_REGEX = re.compile('msgid "(.*?)"')
|
||||||
|
|
|
@ -1,18 +1,20 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
from typing import List
|
from typing import List
|
||||||
|
|
||||||
# check for the venv
|
# check for the venv
|
||||||
from lib import sanity_check
|
from lib import sanity_check
|
||||||
|
|
||||||
sanity_check.check_venv(__file__)
|
sanity_check.check_venv(__file__)
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import sys
|
|
||||||
import subprocess
|
import subprocess
|
||||||
|
import sys
|
||||||
|
|
||||||
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
|
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
|
||||||
from scripts.lib.zulip_tools import WARNING, FAIL, ENDC
|
from scripts.lib.zulip_tools import ENDC, FAIL, WARNING
|
||||||
|
|
||||||
|
|
||||||
def find_handlebars(translatable_strings: List[str]) -> List[str]:
|
def find_handlebars(translatable_strings: List[str]) -> List[str]:
|
||||||
errored = []
|
errored = []
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
import argparse
|
||||||
|
import os
|
||||||
|
import re
|
||||||
|
import sys
|
||||||
|
from typing import Any, Dict, Optional
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
import re
|
|
||||||
import argparse
|
|
||||||
import sys
|
|
||||||
import os
|
|
||||||
|
|
||||||
import ConfigParser
|
import ConfigParser
|
||||||
from typing import Any, Dict, Optional
|
|
||||||
|
|
||||||
# Scans zulip repositary for issues that don't have any `area` labels.
|
# Scans zulip repositary for issues that don't have any `area` labels.
|
||||||
# GitHub API token is required as GitHub limits unauthenticated
|
# GitHub API token is required as GitHub limits unauthenticated
|
||||||
|
|
|
@ -1,16 +1,14 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
import os
|
|
||||||
import argparse
|
import argparse
|
||||||
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
tools_dir = os.path.dirname(os.path.abspath(__file__))
|
tools_dir = os.path.dirname(os.path.abspath(__file__))
|
||||||
root_dir = os.path.dirname(tools_dir)
|
root_dir = os.path.dirname(tools_dir)
|
||||||
sys.path.insert(0, root_dir)
|
sys.path.insert(0, root_dir)
|
||||||
|
|
||||||
from tools.lib.test_script import (
|
from tools.lib.test_script import assert_provisioning_status_ok
|
||||||
assert_provisioning_status_ok,
|
|
||||||
)
|
|
||||||
|
|
||||||
def run() -> None:
|
def run() -> None:
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
|
|
|
@ -1,18 +1,20 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
from lib.template_parser import validate
|
|
||||||
from lib.html_branches import build_id_dict
|
|
||||||
from lib.pretty_print import validate_indent_html
|
|
||||||
import argparse
|
import argparse
|
||||||
import sys
|
|
||||||
import logging
|
import logging
|
||||||
|
import sys
|
||||||
|
|
||||||
# check for the venv
|
# check for the venv
|
||||||
from lib import sanity_check
|
from lib import sanity_check
|
||||||
|
from lib.html_branches import build_id_dict
|
||||||
|
from lib.pretty_print import validate_indent_html
|
||||||
|
from lib.template_parser import validate
|
||||||
|
|
||||||
sanity_check.check_venv(__file__)
|
sanity_check.check_venv(__file__)
|
||||||
|
|
||||||
from zulint import lister
|
|
||||||
from typing import Dict, Iterable, List
|
from typing import Dict, Iterable, List
|
||||||
|
|
||||||
|
from zulint import lister
|
||||||
|
|
||||||
EXCLUDED_FILES = [
|
EXCLUDED_FILES = [
|
||||||
## Test data Files for testing modules in tests
|
## Test data Files for testing modules in tests
|
||||||
"tools/tests/test_template_data",
|
"tools/tests/test_template_data",
|
||||||
|
|
|
@ -7,12 +7,12 @@ Disclaimer: This script is not a lawyer. It cannot validate that the
|
||||||
claimed licenses are correct. It can only check for basic syntactic
|
claimed licenses are correct. It can only check for basic syntactic
|
||||||
issues.
|
issues.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import difflib
|
import difflib
|
||||||
import io
|
import io
|
||||||
import os
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from debian import copyright
|
from debian import copyright
|
||||||
|
|
||||||
COPYRIGHT_FILENAME = "docs/THIRDPARTY"
|
COPYRIGHT_FILENAME = "docs/THIRDPARTY"
|
||||||
|
|
|
@ -2,14 +2,15 @@
|
||||||
|
|
||||||
# check for the venv
|
# check for the venv
|
||||||
from lib import sanity_check
|
from lib import sanity_check
|
||||||
sanity_check.check_venv(__file__)
|
|
||||||
|
|
||||||
from collections import defaultdict
|
sanity_check.check_venv(__file__)
|
||||||
from typing import Any, Dict, List, Set
|
|
||||||
|
|
||||||
import html
|
import html
|
||||||
import os
|
import os
|
||||||
import pprint
|
import pprint
|
||||||
|
from collections import defaultdict
|
||||||
|
from typing import Any, Dict, List, Set
|
||||||
|
|
||||||
import ujson
|
import ujson
|
||||||
|
|
||||||
Call = Dict[str, Any]
|
Call = Dict[str, Any]
|
||||||
|
|
|
@ -1,17 +1,16 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import platform
|
import platform
|
||||||
import shlex
|
import shlex
|
||||||
import sys
|
|
||||||
import subprocess
|
import subprocess
|
||||||
|
import sys
|
||||||
from typing import Callable, List
|
from typing import Callable, List
|
||||||
|
|
||||||
TOOLS_DIR = os.path.dirname(__file__)
|
TOOLS_DIR = os.path.dirname(__file__)
|
||||||
ROOT_DIR = os.path.dirname(TOOLS_DIR)
|
ROOT_DIR = os.path.dirname(TOOLS_DIR)
|
||||||
sys.path.insert(0, ROOT_DIR)
|
sys.path.insert(0, ROOT_DIR)
|
||||||
from scripts.lib.zulip_tools import get_dev_uuid_var_path
|
from scripts.lib.zulip_tools import get_dev_uuid_var_path
|
||||||
|
|
||||||
UUID_VAR_PATH = get_dev_uuid_var_path()
|
UUID_VAR_PATH = get_dev_uuid_var_path()
|
||||||
|
|
||||||
def run(check_func: Callable[[], bool]) -> None:
|
def run(check_func: Callable[[], bool]) -> None:
|
||||||
|
@ -88,7 +87,7 @@ def test_models() -> bool:
|
||||||
os.environ['DJANGO_SETTINGS_MODULE'] = settings_module
|
os.environ['DJANGO_SETTINGS_MODULE'] = settings_module
|
||||||
import django
|
import django
|
||||||
django.setup()
|
django.setup()
|
||||||
from zerver.models import UserProfile, Realm
|
from zerver.models import Realm, UserProfile
|
||||||
print('Num realms: ', Realm.objects.count())
|
print('Num realms: ', Realm.objects.count())
|
||||||
print('Num users: ', UserProfile.objects.count())
|
print('Num users: ', UserProfile.objects.count())
|
||||||
return True
|
return True
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
import optparse
|
import optparse
|
||||||
from scrapy.crawler import Crawler
|
|
||||||
from scrapy.commands import crawl
|
|
||||||
from typing import List, Union
|
from typing import List, Union
|
||||||
|
|
||||||
|
from scrapy.commands import crawl
|
||||||
|
from scrapy.crawler import Crawler
|
||||||
|
|
||||||
|
|
||||||
class Command(crawl.Command):
|
class Command(crawl.Command):
|
||||||
def run(self, args: List[str], opts: optparse.Values) -> None:
|
def run(self, args: List[str], opts: optparse.Values) -> None:
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
import os
|
import os
|
||||||
import pathlib
|
import pathlib
|
||||||
|
|
||||||
from typing import List
|
from typing import List
|
||||||
|
|
||||||
from .common.spiders import BaseDocumentationSpider
|
from .common.spiders import BaseDocumentationSpider
|
||||||
|
|
|
@ -1,12 +1,10 @@
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from posixpath import basename
|
from posixpath import basename
|
||||||
|
from typing import Any, List, Set
|
||||||
from urllib.parse import urlparse
|
from urllib.parse import urlparse
|
||||||
|
|
||||||
from .common.spiders import BaseDocumentationSpider
|
from .common.spiders import BaseDocumentationSpider
|
||||||
|
|
||||||
from typing import Any, List, Set
|
|
||||||
|
|
||||||
|
|
||||||
def get_images_dir(images_path: str) -> str:
|
def get_images_dir(images_path: str) -> str:
|
||||||
# Get index html file as start url and convert it to file uri
|
# Get index html file as start url and convert it to file uri
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
import json
|
import json
|
||||||
import re
|
import re
|
||||||
import scrapy
|
from typing import Callable, Iterable, List, Optional, Union
|
||||||
|
|
||||||
|
import scrapy
|
||||||
from scrapy.http import Request, Response
|
from scrapy.http import Request, Response
|
||||||
from scrapy.linkextractors import IGNORED_EXTENSIONS
|
from scrapy.linkextractors import IGNORED_EXTENSIONS
|
||||||
from scrapy.linkextractors.lxmlhtml import LxmlLinkExtractor
|
from scrapy.linkextractors.lxmlhtml import LxmlLinkExtractor
|
||||||
|
@ -9,8 +10,6 @@ from scrapy.spidermiddlewares.httperror import HttpError
|
||||||
from scrapy.utils.url import url_has_any_extension
|
from scrapy.utils.url import url_has_any_extension
|
||||||
from twisted.python.failure import Failure
|
from twisted.python.failure import Failure
|
||||||
|
|
||||||
from typing import Callable, Iterable, List, Optional, Union
|
|
||||||
|
|
||||||
EXCLUDED_URLS = [
|
EXCLUDED_URLS = [
|
||||||
# Google calendar returns 404s on HEAD requests unconditionally
|
# Google calendar returns 404s on HEAD requests unconditionally
|
||||||
'https://calendar.google.com/calendar/embed?src=ktiduof4eoh47lmgcl2qunnc0o@group.calendar.google.com',
|
'https://calendar.google.com/calendar/embed?src=ktiduof4eoh47lmgcl2qunnc0o@group.calendar.google.com',
|
||||||
|
|
|
@ -9,13 +9,12 @@
|
||||||
# machine:
|
# machine:
|
||||||
#
|
#
|
||||||
# $ python3 add_mentor.py --remove <mentor's username>
|
# $ python3 add_mentor.py --remove <mentor's username>
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
import re
|
||||||
|
import socket
|
||||||
import sys
|
import sys
|
||||||
from argparse import ArgumentParser
|
from argparse import ArgumentParser
|
||||||
from typing import List
|
from typing import List
|
||||||
import socket
|
|
||||||
import re
|
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
|
|
|
@ -14,19 +14,18 @@
|
||||||
# Copy conf.ini-template to conf.ini and populate with your api token.
|
# Copy conf.ini-template to conf.ini and populate with your api token.
|
||||||
#
|
#
|
||||||
# usage: python3 create.py <username>
|
# usage: python3 create.py <username>
|
||||||
|
import argparse
|
||||||
import sys
|
|
||||||
import configparser
|
import configparser
|
||||||
|
import json
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
import time
|
||||||
import urllib.error
|
import urllib.error
|
||||||
import urllib.request
|
import urllib.request
|
||||||
import json
|
|
||||||
import digitalocean
|
|
||||||
import time
|
|
||||||
import argparse
|
|
||||||
import os
|
|
||||||
|
|
||||||
from typing import Any, Dict, List
|
from typing import Any, Dict, List
|
||||||
|
|
||||||
|
import digitalocean
|
||||||
|
|
||||||
# initiation argument parser
|
# initiation argument parser
|
||||||
parser = argparse.ArgumentParser(description='Create a Zulip devopment VM Digital Ocean droplet.')
|
parser = argparse.ArgumentParser(description='Create a Zulip devopment VM Digital Ocean droplet.')
|
||||||
parser.add_argument("username", help="Github username for whom you want to create a Zulip dev droplet")
|
parser.add_argument("username", help="Github username for whom you want to create a Zulip dev droplet")
|
||||||
|
|
|
@ -3,31 +3,32 @@
|
||||||
Fetch contributors data from Github using their API, convert it to structured
|
Fetch contributors data from Github using their API, convert it to structured
|
||||||
JSON data for the /team page contributors section.
|
JSON data for the /team page contributors section.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
|
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
|
||||||
from scripts.lib.setup_path import setup_path
|
from scripts.lib.setup_path import setup_path
|
||||||
|
|
||||||
setup_path()
|
setup_path()
|
||||||
|
|
||||||
from typing import Any, Dict, List, Optional, Union
|
|
||||||
from typing_extensions import TypedDict
|
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
from time import sleep
|
import logging
|
||||||
from datetime import date
|
from datetime import date
|
||||||
from random import randrange
|
from random import randrange
|
||||||
import logging
|
from time import sleep
|
||||||
|
from typing import Any, Dict, List, Optional, Union
|
||||||
|
|
||||||
|
from typing_extensions import TypedDict
|
||||||
|
|
||||||
os.environ['DJANGO_SETTINGS_MODULE'] = 'zproject.settings'
|
os.environ['DJANGO_SETTINGS_MODULE'] = 'zproject.settings'
|
||||||
import django
|
import django
|
||||||
|
|
||||||
django.setup()
|
django.setup()
|
||||||
|
|
||||||
from django.conf import settings
|
import json
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
import json
|
from django.conf import settings
|
||||||
|
|
||||||
duplicate_commits_file = os.path.join(os.path.dirname(__file__), 'duplicate_commits.json')
|
duplicate_commits_file = os.path.join(os.path.dirname(__file__), 'duplicate_commits.json')
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
from lib import sanity_check
|
from lib import sanity_check
|
||||||
|
|
||||||
sanity_check.check_venv(__file__)
|
sanity_check.check_venv(__file__)
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
@ -26,23 +25,33 @@ import argparse
|
||||||
import base64
|
import base64
|
||||||
import subprocess
|
import subprocess
|
||||||
from typing import Any, Dict, Optional
|
from typing import Any, Dict, Optional
|
||||||
from urllib.parse import urlencode, parse_qsl
|
from urllib.parse import parse_qsl, urlencode
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
import ujson
|
import ujson
|
||||||
|
|
||||||
from scripts.lib.zulip_tools import BOLDRED, ENDC
|
from scripts.lib.zulip_tools import BOLDRED, ENDC
|
||||||
from tools.lib.test_script import prepare_puppeteer_run
|
from tools.lib.test_script import prepare_puppeteer_run
|
||||||
from zerver.models import UserProfile, Message, get_user_by_delivery_email, get_realm
|
|
||||||
from zerver.lib.actions import (
|
from zerver.lib.actions import (
|
||||||
do_create_user, notify_created_bot, bulk_add_subscriptions, do_change_avatar_fields)
|
bulk_add_subscriptions,
|
||||||
|
do_change_avatar_fields,
|
||||||
|
do_create_user,
|
||||||
|
notify_created_bot,
|
||||||
|
)
|
||||||
|
from zerver.lib.integrations import (
|
||||||
|
DOC_SCREENSHOT_CONFIG,
|
||||||
|
INTEGRATIONS,
|
||||||
|
ScreenshotConfig,
|
||||||
|
WebhookIntegration,
|
||||||
|
get_fixture_and_image_paths,
|
||||||
|
split_fixture_path,
|
||||||
|
)
|
||||||
|
from zerver.lib.storage import static_path
|
||||||
from zerver.lib.streams import create_stream_if_needed
|
from zerver.lib.streams import create_stream_if_needed
|
||||||
from zerver.lib.upload import upload_avatar_image
|
from zerver.lib.upload import upload_avatar_image
|
||||||
from zerver.lib.integrations import (
|
|
||||||
WebhookIntegration, INTEGRATIONS, split_fixture_path, ScreenshotConfig, get_fixture_and_image_paths,
|
|
||||||
DOC_SCREENSHOT_CONFIG)
|
|
||||||
from zerver.lib.webhooks.common import get_fixture_http_headers
|
from zerver.lib.webhooks.common import get_fixture_http_headers
|
||||||
from zerver.lib.storage import static_path
|
from zerver.models import Message, UserProfile, get_realm, get_user_by_delivery_email
|
||||||
|
|
||||||
|
|
||||||
def create_integration_bot(integration: WebhookIntegration, bot_name: Optional[str]=None) -> UserProfile:
|
def create_integration_bot(integration: WebhookIntegration, bot_name: Optional[str]=None) -> UserProfile:
|
||||||
realm = get_realm('zulip')
|
realm = get_realm('zulip')
|
||||||
|
|
|
@ -5,6 +5,7 @@ import re
|
||||||
from subprocess import check_output
|
from subprocess import check_output
|
||||||
from typing import Dict, List
|
from typing import Dict, List
|
||||||
|
|
||||||
|
|
||||||
def get_json_filename(locale: str) -> str:
|
def get_json_filename(locale: str) -> str:
|
||||||
return f"locale/{locale}/mobile.json"
|
return f"locale/{locale}/mobile.json"
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
import configparser
|
import configparser
|
||||||
from hashlib import md5
|
|
||||||
import os
|
import os
|
||||||
|
from hashlib import md5
|
||||||
|
|
||||||
import polib
|
import polib
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
from typing import List, Tuple, Match
|
|
||||||
import re
|
import re
|
||||||
|
from typing import List, Match, Tuple
|
||||||
|
|
||||||
from bs4 import BeautifulSoup
|
from bs4 import BeautifulSoup
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
from typing import Text, List
|
import re
|
||||||
|
from typing import List, Text
|
||||||
|
|
||||||
from gitlint.git import GitCommit
|
from gitlint.git import GitCommit
|
||||||
from gitlint.rules import LineRule, RuleViolation, CommitMessageTitle
|
|
||||||
from gitlint.options import StrOption
|
from gitlint.options import StrOption
|
||||||
import re
|
from gitlint.rules import CommitMessageTitle, LineRule, RuleViolation
|
||||||
|
|
||||||
# Word list from https://github.com/m1foley/fit-commit
|
# Word list from https://github.com/m1foley/fit-commit
|
||||||
# Copyright (c) 2015 Mike Foley
|
# Copyright (c) 2015 Mike Foley
|
||||||
|
|
|
@ -1,13 +1,8 @@
|
||||||
from typing import Dict, List, Optional, Set
|
|
||||||
|
|
||||||
import re
|
import re
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
|
from typing import Dict, List, Optional, Set
|
||||||
|
|
||||||
from .template_parser import (
|
from .template_parser import FormattedException, Token, tokenize
|
||||||
tokenize,
|
|
||||||
FormattedException,
|
|
||||||
Token,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class HtmlBranchesException(Exception):
|
class HtmlBranchesException(Exception):
|
||||||
|
|
|
@ -1,13 +1,10 @@
|
||||||
|
import subprocess
|
||||||
from typing import Any, Dict, List
|
from typing import Any, Dict, List
|
||||||
|
|
||||||
from .template_parser import (
|
from zulint.printer import ENDC, GREEN
|
||||||
tokenize,
|
|
||||||
is_django_block_tag,
|
|
||||||
)
|
|
||||||
|
|
||||||
from zulint.printer import GREEN, ENDC
|
from .template_parser import is_django_block_tag, tokenize
|
||||||
|
|
||||||
import subprocess
|
|
||||||
|
|
||||||
def pretty_print_html(html: str, num_spaces: int = 4) -> str:
|
def pretty_print_html(html: str, num_spaces: int = 4) -> str:
|
||||||
# We use 1-based indexing for both rows and columns.
|
# We use 1-based indexing for both rows and columns.
|
||||||
|
|
|
@ -1,28 +1,37 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
import os
|
|
||||||
import sys
|
|
||||||
import logging
|
|
||||||
import argparse
|
import argparse
|
||||||
|
import hashlib
|
||||||
|
import logging
|
||||||
|
import os
|
||||||
import platform
|
import platform
|
||||||
import subprocess
|
import subprocess
|
||||||
import hashlib
|
import sys
|
||||||
|
|
||||||
os.environ["PYTHONUNBUFFERED"] = "y"
|
os.environ["PYTHONUNBUFFERED"] = "y"
|
||||||
|
|
||||||
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)
|
||||||
from scripts.lib.zulip_tools import run_as_root, ENDC, WARNING, \
|
from typing import TYPE_CHECKING, List
|
||||||
get_dev_uuid_var_path, FAIL, os_families, parse_os_release, \
|
|
||||||
overwrite_symlink
|
from scripts.lib.node_cache import NODE_MODULES_CACHE_PATH, setup_node_modules
|
||||||
from scripts.lib.setup_venv import (
|
from scripts.lib.setup_venv import (
|
||||||
get_venv_dependencies, THUMBOR_VENV_DEPENDENCIES,
|
THUMBOR_VENV_DEPENDENCIES,
|
||||||
YUM_THUMBOR_VENV_DEPENDENCIES,
|
YUM_THUMBOR_VENV_DEPENDENCIES,
|
||||||
|
get_venv_dependencies,
|
||||||
|
)
|
||||||
|
from scripts.lib.zulip_tools import (
|
||||||
|
ENDC,
|
||||||
|
FAIL,
|
||||||
|
WARNING,
|
||||||
|
get_dev_uuid_var_path,
|
||||||
|
os_families,
|
||||||
|
overwrite_symlink,
|
||||||
|
parse_os_release,
|
||||||
|
run_as_root,
|
||||||
)
|
)
|
||||||
from scripts.lib.node_cache import setup_node_modules, NODE_MODULES_CACHE_PATH
|
|
||||||
from tools.setup import setup_venvs
|
from tools.setup import setup_venvs
|
||||||
|
|
||||||
from typing import List, TYPE_CHECKING
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from typing import NoReturn
|
from typing import NoReturn
|
||||||
|
|
||||||
|
|
|
@ -1,22 +1,26 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
import os
|
|
||||||
import sys
|
|
||||||
import argparse
|
import argparse
|
||||||
import glob
|
import glob
|
||||||
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
|
import sys
|
||||||
from typing import List
|
from typing import List
|
||||||
|
|
||||||
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)
|
||||||
from scripts.lib.zulip_tools import run, OKBLUE, ENDC, \
|
|
||||||
get_dev_uuid_var_path, is_digest_obsolete, write_new_digest
|
|
||||||
|
|
||||||
from version import PROVISION_VERSION
|
|
||||||
from pygments import __version__ as pygments_version
|
from pygments import __version__ as pygments_version
|
||||||
|
|
||||||
|
from scripts.lib.zulip_tools import (
|
||||||
|
ENDC,
|
||||||
|
OKBLUE,
|
||||||
|
get_dev_uuid_var_path,
|
||||||
|
is_digest_obsolete,
|
||||||
|
run,
|
||||||
|
write_new_digest,
|
||||||
|
)
|
||||||
from tools.setup.generate_zulip_bots_static_files import generate_zulip_bots_static_files
|
from tools.setup.generate_zulip_bots_static_files import generate_zulip_bots_static_files
|
||||||
|
from version import PROVISION_VERSION
|
||||||
|
|
||||||
VENV_PATH = "/srv/zulip-py3-venv"
|
VENV_PATH = "/srv/zulip-py3-venv"
|
||||||
UUID_VAR_PATH = get_dev_uuid_var_path()
|
UUID_VAR_PATH = get_dev_uuid_var_path()
|
||||||
|
@ -177,7 +181,7 @@ def clean_unused_caches() -> None:
|
||||||
verbose=False,
|
verbose=False,
|
||||||
no_headings=True,
|
no_headings=True,
|
||||||
)
|
)
|
||||||
from scripts.lib import clean_venv_cache, clean_node_cache, clean_emoji_cache
|
from scripts.lib import clean_emoji_cache, clean_node_cache, clean_venv_cache
|
||||||
clean_venv_cache.main(args)
|
clean_venv_cache.main(args)
|
||||||
clean_node_cache.main(args)
|
clean_node_cache.main(args)
|
||||||
clean_emoji_cache.main(args)
|
clean_emoji_cache.main(args)
|
||||||
|
@ -227,12 +231,13 @@ def main(options: argparse.Namespace) -> int:
|
||||||
import django
|
import django
|
||||||
django.setup()
|
django.setup()
|
||||||
|
|
||||||
|
from django.conf import settings
|
||||||
|
|
||||||
from zerver.lib.test_fixtures import (
|
from zerver.lib.test_fixtures import (
|
||||||
DEV_DATABASE,
|
DEV_DATABASE,
|
||||||
TEST_DATABASE,
|
TEST_DATABASE,
|
||||||
destroy_leaked_test_databases,
|
destroy_leaked_test_databases,
|
||||||
)
|
)
|
||||||
from django.conf import settings
|
|
||||||
|
|
||||||
if options.is_force or need_to_run_configure_rabbitmq(
|
if options.is_force or need_to_run_configure_rabbitmq(
|
||||||
[settings.RABBITMQ_PASSWORD]):
|
[settings.RABBITMQ_PASSWORD]):
|
||||||
|
|
|
@ -2,6 +2,7 @@ import os
|
||||||
import pwd
|
import pwd
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
|
||||||
def check_venv(filename: str) -> None:
|
def check_venv(filename: str) -> None:
|
||||||
try:
|
try:
|
||||||
import django
|
import django
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
from typing import Callable, List, Optional, Text
|
from typing import Callable, List, Optional, Text
|
||||||
|
|
||||||
|
|
||||||
class FormattedException(Exception):
|
class FormattedException(Exception):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
from typing import Optional, Tuple, Iterable, List
|
import glob
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
from distutils.version import LooseVersion
|
from distutils.version import LooseVersion
|
||||||
from version import PROVISION_VERSION
|
from typing import Iterable, List, Optional, Tuple
|
||||||
|
|
||||||
from scripts.lib.zulip_tools import get_dev_uuid_var_path
|
from scripts.lib.zulip_tools import get_dev_uuid_var_path
|
||||||
import glob
|
from version import PROVISION_VERSION
|
||||||
|
|
||||||
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__))))
|
||||||
|
|
||||||
|
|
|
@ -2,13 +2,12 @@ import os
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
|
|
||||||
from contextlib import contextmanager
|
from contextlib import contextmanager
|
||||||
|
|
||||||
from typing import Iterator, Optional
|
from typing import Iterator, Optional
|
||||||
|
|
||||||
# Verify the Zulip venv is available.
|
# Verify the Zulip venv is available.
|
||||||
from tools.lib import sanity_check
|
from tools.lib import sanity_check
|
||||||
|
|
||||||
sanity_check.check_venv(__file__)
|
sanity_check.check_venv(__file__)
|
||||||
|
|
||||||
import django
|
import django
|
||||||
|
@ -20,8 +19,9 @@ TOOLS_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||||
if TOOLS_DIR not in sys.path:
|
if TOOLS_DIR not in sys.path:
|
||||||
sys.path.insert(0, os.path.dirname(TOOLS_DIR))
|
sys.path.insert(0, os.path.dirname(TOOLS_DIR))
|
||||||
|
|
||||||
from zerver.lib.test_fixtures import update_test_databases_if_required
|
|
||||||
from scripts.lib.zulip_tools import get_or_create_dev_uuid_var_path
|
from scripts.lib.zulip_tools import get_or_create_dev_uuid_var_path
|
||||||
|
from zerver.lib.test_fixtures import update_test_databases_if_required
|
||||||
|
|
||||||
|
|
||||||
def set_up_django(external_host: str) -> None:
|
def set_up_django(external_host: str) -> None:
|
||||||
os.environ['EXTERNAL_HOST'] = external_host
|
os.environ['EXTERNAL_HOST'] = external_host
|
||||||
|
|
17
tools/lint
17
tools/lint
|
@ -1,16 +1,20 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
import argparse
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import argparse
|
|
||||||
|
|
||||||
# check for the venv
|
# check for the venv
|
||||||
from lib import sanity_check
|
from lib import sanity_check
|
||||||
|
|
||||||
sanity_check.check_venv(__file__)
|
sanity_check.check_venv(__file__)
|
||||||
|
|
||||||
from linter_lib.custom_check import python_rules, non_py_rules
|
|
||||||
from zulint.command import add_default_linter_arguments, LinterConfig
|
|
||||||
import random
|
import random
|
||||||
|
|
||||||
|
from zulint.command import LinterConfig, add_default_linter_arguments
|
||||||
|
|
||||||
|
from linter_lib.custom_check import non_py_rules, python_rules
|
||||||
|
|
||||||
|
|
||||||
def run() -> None:
|
def run() -> None:
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
parser.add_argument('--force', default=False,
|
parser.add_argument('--force', default=False,
|
||||||
|
@ -26,13 +30,10 @@ def run() -> None:
|
||||||
root_dir = os.path.dirname(tools_dir)
|
root_dir = os.path.dirname(tools_dir)
|
||||||
sys.path.insert(0, root_dir)
|
sys.path.insert(0, root_dir)
|
||||||
|
|
||||||
|
from tools.lib.test_script import assert_provisioning_status_ok
|
||||||
from tools.linter_lib.exclude import EXCLUDED_FILES, PUPPET_CHECK_RULES_TO_EXCLUDE
|
from tools.linter_lib.exclude import EXCLUDED_FILES, PUPPET_CHECK_RULES_TO_EXCLUDE
|
||||||
from tools.linter_lib.pyflakes import check_pyflakes
|
|
||||||
from tools.linter_lib.pep8 import check_pep8
|
from tools.linter_lib.pep8 import check_pep8
|
||||||
|
from tools.linter_lib.pyflakes import check_pyflakes
|
||||||
from tools.lib.test_script import (
|
|
||||||
assert_provisioning_status_ok,
|
|
||||||
)
|
|
||||||
|
|
||||||
os.chdir(root_dir)
|
os.chdir(root_dir)
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
|
from typing import List
|
||||||
|
|
||||||
from zulint.linters import run_pycodestyle
|
from zulint.linters import run_pycodestyle
|
||||||
|
|
||||||
from typing import List
|
|
||||||
|
|
||||||
def check_pep8(files: List[str]) -> bool:
|
def check_pep8(files: List[str]) -> bool:
|
||||||
ignored_rules = [
|
ignored_rules = [
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import argparse
|
import argparse
|
||||||
|
|
||||||
from typing import List
|
from typing import List
|
||||||
|
|
||||||
from zulint.linters import run_pyflakes
|
from zulint.linters import run_pyflakes
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
from typing import List
|
|
||||||
from lib.pretty_print import pretty_print_html
|
|
||||||
import sys
|
import sys
|
||||||
|
from typing import List
|
||||||
|
|
||||||
|
from lib.pretty_print import pretty_print_html
|
||||||
|
|
||||||
|
|
||||||
def clean_html(filenames: List[str]) -> None:
|
def clean_html(filenames: List[str]) -> None:
|
||||||
for fn in filenames:
|
for fn in filenames:
|
||||||
|
|
|
@ -1,13 +1,12 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
import fileinput
|
||||||
import glob
|
import glob
|
||||||
import os
|
import os
|
||||||
import sys
|
|
||||||
import fileinput
|
|
||||||
import re
|
import re
|
||||||
|
import sys
|
||||||
from typing import List
|
from typing import List
|
||||||
|
|
||||||
|
|
||||||
def validate_order(order: List[int], length: int) -> None:
|
def validate_order(order: List[int], length: int) -> None:
|
||||||
if len(order) != length:
|
if len(order) != length:
|
||||||
print("Please enter the sequence of all the conflicting files at once")
|
print("Please enter the sequence of all the conflicting files at once")
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
import shlex
|
import shlex
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
from typing import List
|
from typing import List
|
||||||
|
|
||||||
|
|
||||||
def exit(message: str) -> None:
|
def exit(message: str) -> None:
|
||||||
print('PROBLEM!')
|
print('PROBLEM!')
|
||||||
print(message)
|
print(message)
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue