mirror of https://github.com/zulip/zulip.git
ruff: Fix UP035 Import from `collections.abc`, `typing` instead.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
parent
531b34cb4c
commit
0fa5e7f629
|
@ -1,13 +1,14 @@
|
||||||
import logging
|
import logging
|
||||||
import time
|
import time
|
||||||
from collections import OrderedDict, defaultdict
|
from collections import OrderedDict, defaultdict
|
||||||
|
from collections.abc import Callable, Sequence
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
from typing import Callable, Sequence, Union
|
from typing import TypeAlias, Union
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.db import connection, models
|
from django.db import connection, models
|
||||||
from psycopg2.sql import SQL, Composable, Identifier, Literal
|
from psycopg2.sql import SQL, Composable, Identifier, Literal
|
||||||
from typing_extensions import TypeAlias, override
|
from typing_extensions import override
|
||||||
|
|
||||||
from analytics.models import (
|
from analytics.models import (
|
||||||
BaseCount,
|
BaseCount,
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
|
from collections.abc import Mapping
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
from typing import Any, Mapping
|
from typing import Any, TypeAlias
|
||||||
|
|
||||||
from django.core.files.uploadedfile import UploadedFile
|
from django.core.files.uploadedfile import UploadedFile
|
||||||
from django.utils.timezone import now as timezone_now
|
from django.utils.timezone import now as timezone_now
|
||||||
from typing_extensions import TypeAlias, override
|
from typing_extensions import override
|
||||||
|
|
||||||
from analytics.lib.counts import COUNT_STATS, CountStat, do_drop_all_analytics_tables
|
from analytics.lib.counts import COUNT_STATS, CountStat, do_drop_all_analytics_tables
|
||||||
from analytics.lib.fixtures import generate_time_series_data
|
from analytics.lib.fixtures import generate_time_series_data
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
|
from collections.abc import Iterator
|
||||||
from contextlib import AbstractContextManager, ExitStack, contextmanager
|
from contextlib import AbstractContextManager, ExitStack, contextmanager
|
||||||
from datetime import datetime, timedelta, timezone
|
from datetime import datetime, timedelta, timezone
|
||||||
from typing import Any, Iterator
|
from typing import Any
|
||||||
from unittest import mock
|
from unittest import mock
|
||||||
|
|
||||||
import time_machine
|
import time_machine
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import logging
|
import logging
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
from datetime import datetime, timedelta, timezone
|
from datetime import datetime, timedelta, timezone
|
||||||
from typing import Any, Optional, TypeVar, cast
|
from typing import Any, Optional, TypeAlias, TypeVar, cast
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.db.models import QuerySet
|
from django.db.models import QuerySet
|
||||||
|
@ -10,7 +10,6 @@ from django.shortcuts import render
|
||||||
from django.utils import translation
|
from django.utils import translation
|
||||||
from django.utils.timezone import now as timezone_now
|
from django.utils.timezone import now as timezone_now
|
||||||
from django.utils.translation import gettext as _
|
from django.utils.translation import gettext as _
|
||||||
from typing_extensions import TypeAlias
|
|
||||||
|
|
||||||
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
|
||||||
|
|
|
@ -3,8 +3,9 @@
|
||||||
__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 secrets
|
import secrets
|
||||||
from base64 import b32encode
|
from base64 import b32encode
|
||||||
|
from collections.abc import Mapping
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
from typing import Mapping, Optional, Union, cast
|
from typing import Optional, TypeAlias, Union, cast
|
||||||
from urllib.parse import urljoin
|
from urllib.parse import urljoin
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
@ -16,7 +17,7 @@ from django.http import HttpRequest, HttpResponse
|
||||||
from django.template.response import TemplateResponse
|
from django.template.response import TemplateResponse
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
from django.utils.timezone import now as timezone_now
|
from django.utils.timezone import now as timezone_now
|
||||||
from typing_extensions import TypeAlias, override
|
from typing_extensions import override
|
||||||
|
|
||||||
from confirmation import settings as confirmation_settings
|
from confirmation import settings as confirmation_settings
|
||||||
from zerver.lib.types import UnspecifiedValue
|
from zerver.lib.types import UnspecifiedValue
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
|
from collections.abc import Callable, Sequence
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
from typing import Any, Callable, Sequence
|
from typing import Any
|
||||||
from urllib.parse import urlencode
|
from urllib.parse import urlencode
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
|
|
@ -1,12 +1,13 @@
|
||||||
|
from collections.abc import Callable
|
||||||
from functools import wraps
|
from functools import wraps
|
||||||
from typing import Callable
|
from typing import Concatenate
|
||||||
from urllib.parse import urlencode, urljoin
|
from urllib.parse import urlencode, urljoin
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.http import HttpRequest, HttpResponse, HttpResponseRedirect, JsonResponse
|
from django.http import HttpRequest, HttpResponse, HttpResponseRedirect, JsonResponse
|
||||||
from django.shortcuts import render
|
from django.shortcuts import render
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
from typing_extensions import Concatenate, ParamSpec
|
from typing_extensions import ParamSpec
|
||||||
|
|
||||||
from corporate.lib.remote_billing_util import (
|
from corporate.lib.remote_billing_util import (
|
||||||
RemoteBillingIdentityExpiredError,
|
RemoteBillingIdentityExpiredError,
|
||||||
|
|
|
@ -3,12 +3,13 @@ import math
|
||||||
import os
|
import os
|
||||||
import secrets
|
import secrets
|
||||||
from abc import ABC, abstractmethod
|
from abc import ABC, abstractmethod
|
||||||
|
from collections.abc import Callable, Generator
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from datetime import datetime, timedelta, timezone
|
from datetime import datetime, timedelta, timezone
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
from functools import wraps
|
from functools import wraps
|
||||||
from typing import Any, Callable, Generator, Literal, TypedDict, TypeVar
|
from typing import Any, Literal, TypedDict, TypeVar
|
||||||
from urllib.parse import urlencode, urljoin
|
from urllib.parse import urlencode, urljoin
|
||||||
|
|
||||||
import stripe
|
import stripe
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import logging
|
import logging
|
||||||
from typing import Any, Callable
|
from collections.abc import Callable
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
import stripe
|
import stripe
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
|
|
@ -6,11 +6,12 @@ import re
|
||||||
import sys
|
import sys
|
||||||
import typing
|
import typing
|
||||||
import uuid
|
import uuid
|
||||||
|
from collections.abc import Callable, Mapping, Sequence
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from datetime import datetime, timedelta, timezone
|
from datetime import datetime, timedelta, timezone
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
from functools import wraps
|
from functools import wraps
|
||||||
from typing import TYPE_CHECKING, Any, Callable, Literal, Mapping, Optional, Sequence, TypeVar, cast
|
from typing import TYPE_CHECKING, Any, Literal, Optional, TypeVar, cast
|
||||||
from unittest import mock
|
from unittest import mock
|
||||||
from unittest.mock import MagicMock, Mock, patch
|
from unittest.mock import MagicMock, Mock, patch
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,11 @@
|
||||||
import logging
|
import logging
|
||||||
from typing import Any, Literal
|
from typing import Annotated, Any, Literal
|
||||||
|
|
||||||
from django.http import HttpRequest, HttpResponse, HttpResponseNotAllowed, HttpResponseRedirect
|
from django.http import HttpRequest, HttpResponse, HttpResponseNotAllowed, HttpResponseRedirect
|
||||||
from django.shortcuts import render
|
from django.shortcuts import render
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
from django.utils.translation import gettext as _
|
from django.utils.translation import gettext as _
|
||||||
from pydantic import AfterValidator, Json
|
from pydantic import AfterValidator, Json
|
||||||
from typing_extensions import Annotated
|
|
||||||
|
|
||||||
from corporate.lib.decorator import (
|
from corporate.lib.decorator import (
|
||||||
authenticated_remote_realm_management_endpoint,
|
authenticated_remote_realm_management_endpoint,
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
import itertools
|
import itertools
|
||||||
import re
|
import re
|
||||||
|
from collections.abc import Collection
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from typing import Any, Collection
|
from typing import Any
|
||||||
|
|
||||||
from django.db.models import QuerySet
|
from django.db.models import QuerySet
|
||||||
from django.http import HttpRequest, HttpResponse, HttpResponseNotFound
|
from django.http import HttpRequest, HttpResponse, HttpResponseNotFound
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import logging
|
import logging
|
||||||
from typing import Any, Literal, cast
|
from typing import Any, Literal, TypeAlias, cast
|
||||||
from urllib.parse import urlsplit, urlunsplit
|
from urllib.parse import urlsplit, urlunsplit
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
@ -15,7 +15,6 @@ from django.utils.translation import get_language
|
||||||
from django.utils.translation import gettext as _
|
from django.utils.translation import gettext as _
|
||||||
from django.views.decorators.csrf import csrf_exempt
|
from django.views.decorators.csrf import csrf_exempt
|
||||||
from pydantic import Json
|
from pydantic import Json
|
||||||
from typing_extensions import TypeAlias
|
|
||||||
|
|
||||||
from confirmation.models import (
|
from confirmation.models import (
|
||||||
Confirmation,
|
Confirmation,
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
import uuid
|
import uuid
|
||||||
|
from collections.abc import Iterable
|
||||||
from contextlib import suppress
|
from contextlib import suppress
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
from operator import attrgetter
|
from operator import attrgetter
|
||||||
from typing import Any, Iterable
|
from typing import Annotated, Any, Literal
|
||||||
from urllib.parse import urlencode, urlsplit
|
from urllib.parse import urlencode, urlsplit
|
||||||
|
|
||||||
from django import forms
|
from django import forms
|
||||||
|
@ -18,7 +19,6 @@ 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 gettext as _
|
from django.utils.translation import gettext as _
|
||||||
from pydantic import AfterValidator, Json, NonNegativeInt
|
from pydantic import AfterValidator, Json, NonNegativeInt
|
||||||
from typing_extensions import Annotated, Literal
|
|
||||||
|
|
||||||
from confirmation.models import Confirmation, confirmation_url
|
from confirmation.models import Confirmation, confirmation_url
|
||||||
from confirmation.settings import STATUS_USED
|
from confirmation.settings import STATUS_USED
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
import logging
|
import logging
|
||||||
|
from typing import Annotated
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.http import HttpRequest, HttpResponse, HttpResponseRedirect
|
from django.http import HttpRequest, HttpResponse, HttpResponseRedirect
|
||||||
from django.shortcuts import render
|
from django.shortcuts import render
|
||||||
from pydantic import AfterValidator, Json
|
from pydantic import AfterValidator, Json
|
||||||
from typing_extensions import Annotated
|
|
||||||
|
|
||||||
from corporate.lib.decorator import (
|
from corporate.lib.decorator import (
|
||||||
authenticated_remote_realm_management_endpoint,
|
authenticated_remote_realm_management_endpoint,
|
||||||
|
|
|
@ -3,7 +3,8 @@
|
||||||
import contextlib
|
import contextlib
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
from typing import Any, Iterable, Sequence
|
from collections.abc import Iterable, Sequence
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
sys.path.append("/home/zulip/deployments/current")
|
sys.path.append("/home/zulip/deployments/current")
|
||||||
from scripts.lib.setup_path import setup_path
|
from scripts.lib.setup_path import setup_path
|
||||||
|
|
|
@ -7,9 +7,10 @@ import os
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
|
from collections.abc import Mapping
|
||||||
from datetime import datetime, timedelta, timezone
|
from datetime import datetime, timedelta, timezone
|
||||||
from http.server import BaseHTTPRequestHandler, HTTPServer
|
from http.server import BaseHTTPRequestHandler, HTTPServer
|
||||||
from typing import Mapping, Protocol
|
from typing import Protocol
|
||||||
from urllib.parse import parse_qs, urlsplit
|
from urllib.parse import parse_qs, urlsplit
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ import hashlib
|
||||||
import os
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
from typing import Iterable
|
from collections.abc import Iterable
|
||||||
|
|
||||||
|
|
||||||
def expand_reqs_helper(fpath: str) -> list[str]:
|
def expand_reqs_helper(fpath: str) -> list[str]:
|
||||||
|
|
|
@ -15,8 +15,9 @@ import subprocess
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
import uuid
|
import uuid
|
||||||
|
from collections.abc import Sequence
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
from typing import IO, Any, Literal, Sequence, overload
|
from typing import IO, Any, Literal, overload
|
||||||
from urllib.parse import SplitResult
|
from urllib.parse import SplitResult
|
||||||
|
|
||||||
import zoneinfo
|
import zoneinfo
|
||||||
|
|
|
@ -10,7 +10,8 @@ import signal
|
||||||
import sys
|
import sys
|
||||||
from datetime import date, datetime, timedelta, timezone
|
from datetime import date, datetime, timedelta, timezone
|
||||||
from enum import Enum, auto
|
from enum import Enum, auto
|
||||||
from typing import Match, TextIO
|
from re import Match
|
||||||
|
from typing import TextIO
|
||||||
|
|
||||||
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)
|
||||||
|
|
|
@ -14,7 +14,8 @@ import difflib
|
||||||
import os
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
from typing import Any, Callable
|
from collections.abc import Callable
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
import orjson
|
import orjson
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ from tools.lib import sanity_check
|
||||||
|
|
||||||
sanity_check.check_venv(__file__)
|
sanity_check.check_venv(__file__)
|
||||||
|
|
||||||
from typing import Iterable
|
from collections.abc import Iterable
|
||||||
|
|
||||||
from zulint import lister
|
from zulint import lister
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ import platform
|
||||||
import shlex
|
import shlex
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
from typing import Callable
|
from collections.abc import Callable
|
||||||
|
|
||||||
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)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
from typing import Callable, Iterator
|
from collections.abc import Callable, Iterator
|
||||||
from urllib.parse import urlsplit
|
from urllib.parse import urlsplit
|
||||||
|
|
||||||
import scrapy
|
import scrapy
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import re
|
import re
|
||||||
from typing import Match
|
from re import Match
|
||||||
|
|
||||||
from bs4 import BeautifulSoup
|
from bs4 import BeautifulSoup
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
from typing import Callable
|
from collections.abc import Callable
|
||||||
|
|
||||||
from typing_extensions import override
|
from typing_extensions import override
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ import os
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
from argparse import ArgumentParser
|
from argparse import ArgumentParser
|
||||||
from typing import Iterable
|
from collections.abc import Iterable
|
||||||
|
|
||||||
from scripts.lib.zulip_tools import get_dev_uuid_var_path
|
from scripts.lib.zulip_tools import get_dev_uuid_var_path
|
||||||
from version import PROVISION_VERSION
|
from version import PROVISION_VERSION
|
||||||
|
|
|
@ -2,8 +2,8 @@ import os
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
|
from collections.abc import Iterator
|
||||||
from contextlib import ExitStack, contextmanager
|
from contextlib import ExitStack, contextmanager
|
||||||
from typing import Iterator
|
|
||||||
|
|
||||||
# Verify the Zulip venv is available.
|
# Verify the Zulip venv is available.
|
||||||
from tools.lib import sanity_check
|
from tools.lib import sanity_check
|
||||||
|
|
|
@ -279,10 +279,10 @@ rules:
|
||||||
def $F(..., invalid_param: typing.Optional[<... zerver.lib.typed_endpoint.ApiParamConfig(...) ...>], ...) -> ...:
|
def $F(..., invalid_param: typing.Optional[<... zerver.lib.typed_endpoint.ApiParamConfig(...) ...>], ...) -> ...:
|
||||||
...
|
...
|
||||||
- pattern-not: |
|
- pattern-not: |
|
||||||
def $F(..., $A: typing_extensions.Annotated[<... zerver.lib.typed_endpoint.ApiParamConfig(...) ...>], ...) -> ...:
|
def $F(..., $A: typing.Annotated[<... zerver.lib.typed_endpoint.ApiParamConfig(...) ...>], ...) -> ...:
|
||||||
...
|
...
|
||||||
- pattern-not: |
|
- pattern-not: |
|
||||||
def $F(..., $A: typing_extensions.Annotated[<... zerver.lib.typed_endpoint.ApiParamConfig(...) ...>] = ..., ...) -> ...:
|
def $F(..., $A: typing.Annotated[<... zerver.lib.typed_endpoint.ApiParamConfig(...) ...>] = ..., ...) -> ...:
|
||||||
...
|
...
|
||||||
- pattern-either:
|
- pattern-either:
|
||||||
- pattern: |
|
- pattern: |
|
||||||
|
|
|
@ -5,7 +5,8 @@
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
import sys
|
import sys
|
||||||
from typing import Any, Iterator, Sequence
|
from collections.abc import Iterator, Sequence
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
import orjson
|
import orjson
|
||||||
|
|
||||||
|
|
|
@ -12,8 +12,9 @@ setup_path()
|
||||||
os.environ["DJANGO_SETTINGS_MODULE"] = "zproject.settings"
|
os.environ["DJANGO_SETTINGS_MODULE"] = "zproject.settings"
|
||||||
import argparse
|
import argparse
|
||||||
import secrets
|
import secrets
|
||||||
|
from collections.abc import Iterator
|
||||||
from contextlib import contextmanager
|
from contextlib import contextmanager
|
||||||
from typing import Iterator, TypedDict
|
from typing import TypedDict
|
||||||
|
|
||||||
import boto3.session
|
import boto3.session
|
||||||
import orjson
|
import orjson
|
||||||
|
|
|
@ -8,7 +8,8 @@ import shlex
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
import tempfile
|
import tempfile
|
||||||
from typing import TYPE_CHECKING, Iterator, cast
|
from collections.abc import Iterator
|
||||||
|
from typing import TYPE_CHECKING, cast
|
||||||
from unittest import mock
|
from unittest import mock
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
|
|
|
@ -3,7 +3,7 @@ import argparse
|
||||||
import os
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
from typing import Sequence
|
from collections.abc import Sequence
|
||||||
|
|
||||||
ZULIP_PATH = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
ZULIP_PATH = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||||
os.chdir(ZULIP_PATH)
|
os.chdir(ZULIP_PATH)
|
||||||
|
|
|
@ -4,7 +4,7 @@ import contextlib
|
||||||
import os
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
from typing import Iterator
|
from collections.abc import Iterator
|
||||||
|
|
||||||
ZULIP_PATH = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
ZULIP_PATH = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||||
os.chdir(ZULIP_PATH)
|
os.chdir(ZULIP_PATH)
|
||||||
|
|
|
@ -39,7 +39,7 @@ from tools.lib import sanity_check
|
||||||
|
|
||||||
sanity_check.check_venv(__file__)
|
sanity_check.check_venv(__file__)
|
||||||
|
|
||||||
from typing import Iterable
|
from collections.abc import Iterable
|
||||||
|
|
||||||
from tools.lib.test_script import (
|
from tools.lib.test_script import (
|
||||||
add_provision_check_override_param,
|
add_provision_check_override_param,
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
from typing import Iterable, Sequence
|
from collections.abc import Iterable, Sequence
|
||||||
|
|
||||||
from zerver.lib.alert_words import add_user_alert_words, remove_user_alert_words
|
from zerver.lib.alert_words import add_user_alert_words, remove_user_alert_words
|
||||||
from zerver.models import UserProfile
|
from zerver.models import UserProfile
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
|
from collections.abc import Iterable, Sequence
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
from typing import Any, Iterable, Sequence
|
from typing import Any
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.db import transaction
|
from django.db import transaction
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
from typing import Iterable
|
from collections.abc import Iterable
|
||||||
|
|
||||||
import orjson
|
import orjson
|
||||||
from django.db import transaction
|
from django.db import transaction
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
from typing import Any, Iterable
|
from collections.abc import Iterable
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
from django.db import transaction
|
from django.db import transaction
|
||||||
from django.utils.translation import gettext as _
|
from django.utils.translation import gettext as _
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import logging
|
import logging
|
||||||
|
from collections.abc import Collection, Sequence
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
from typing import Any, Collection, Sequence
|
from typing import Any
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.contrib.contenttypes.models import ContentType
|
from django.contrib.contenttypes.models import ContentType
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
from typing import Iterable, TypedDict
|
from collections.abc import Iterable
|
||||||
|
from typing import TypedDict
|
||||||
|
|
||||||
from zerver.lib import retention
|
from zerver.lib import retention
|
||||||
from zerver.lib.retention import move_messages_to_archive
|
from zerver.lib.retention import move_messages_to_archive
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
import itertools
|
import itertools
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
|
from collections.abc import Iterable
|
||||||
|
from collections.abc import Set as AbstractSet
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
from typing import AbstractSet, Any, Iterable
|
from typing import Any
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.db import transaction
|
from django.db import transaction
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
import logging
|
import logging
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
|
from collections.abc import Callable, Collection, Sequence
|
||||||
|
from collections.abc import Set as AbstractSet
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
from email.headerregistry import Address
|
from email.headerregistry import Address
|
||||||
from typing import AbstractSet, Any, Callable, Collection, Sequence, TypedDict
|
from typing import Any, TypedDict
|
||||||
|
|
||||||
import orjson
|
import orjson
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import logging
|
import logging
|
||||||
|
from collections.abc import Sequence
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
from typing import Sequence
|
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.db import transaction
|
from django.db import transaction
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import hashlib
|
import hashlib
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
from typing import Any, Collection, Iterable, Mapping
|
from collections.abc import Collection, Iterable, Mapping
|
||||||
|
from typing import Any, TypeAlias
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.db import transaction
|
from django.db import transaction
|
||||||
|
@ -9,7 +10,6 @@ from django.utils.timezone import now as timezone_now
|
||||||
from django.utils.translation import gettext as _
|
from django.utils.translation import gettext as _
|
||||||
from django.utils.translation import override as override_language
|
from django.utils.translation import override as override_language
|
||||||
from django_stubs_ext import ValuesQuerySet
|
from django_stubs_ext import ValuesQuerySet
|
||||||
from typing_extensions import TypeAlias
|
|
||||||
|
|
||||||
from zerver.actions.default_streams import (
|
from zerver.actions.default_streams import (
|
||||||
do_remove_default_stream,
|
do_remove_default_stream,
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
|
from collections.abc import Mapping, Sequence
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from typing import Mapping, Sequence, TypedDict
|
from typing import TypedDict
|
||||||
|
|
||||||
import django.db.utils
|
import django.db.utils
|
||||||
from django.db import transaction
|
from django.db import transaction
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
|
from collections.abc import Iterable
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
from typing import Iterable
|
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.db import transaction
|
from django.db import transaction
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
from typing import Any, Mapping
|
from collections.abc import Mapping
|
||||||
|
from typing import Any
|
||||||
from urllib.parse import urljoin
|
from urllib.parse import urljoin
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
|
|
@ -3,14 +3,15 @@ import os
|
||||||
import random
|
import random
|
||||||
import shutil
|
import shutil
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
|
from collections.abc import Callable, Iterable, Iterator, Mapping
|
||||||
|
from collections.abc import Set as AbstractSet
|
||||||
from concurrent.futures import ProcessPoolExecutor, as_completed
|
from concurrent.futures import ProcessPoolExecutor, as_completed
|
||||||
from typing import AbstractSet, Any, Callable, Iterable, Iterator, Mapping, Protocol, TypeVar
|
from typing import Any, Protocol, TypeAlias, TypeVar
|
||||||
|
|
||||||
import orjson
|
import orjson
|
||||||
import requests
|
import requests
|
||||||
from django.forms.models import model_to_dict
|
from django.forms.models import model_to_dict
|
||||||
from django.utils.timezone import now as timezone_now
|
from django.utils.timezone import now as timezone_now
|
||||||
from typing_extensions import TypeAlias
|
|
||||||
|
|
||||||
from zerver.data_import.sequencer import NEXT_ID
|
from zerver.data_import.sequencer import NEXT_ID
|
||||||
from zerver.lib.avatar_hash import user_avatar_base_path_from_ids
|
from zerver.lib.avatar_hash import user_avatar_base_path_from_ids
|
||||||
|
|
|
@ -10,7 +10,8 @@ import re
|
||||||
import secrets
|
import secrets
|
||||||
import shutil
|
import shutil
|
||||||
import subprocess
|
import subprocess
|
||||||
from typing import Any, Callable
|
from collections.abc import Callable
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
import orjson
|
import orjson
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
from typing import Any, Callable
|
from collections.abc import Callable
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
"""
|
"""
|
||||||
This module helps you set up a bunch
|
This module helps you set up a bunch
|
||||||
|
|
|
@ -7,9 +7,10 @@ import secrets
|
||||||
import shutil
|
import shutil
|
||||||
import zipfile
|
import zipfile
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
|
from collections.abc import Iterator
|
||||||
from datetime import datetime, timezone
|
from datetime import datetime, timezone
|
||||||
from email.headerregistry import Address
|
from email.headerregistry import Address
|
||||||
from typing import Any, Iterator, TypeVar
|
from typing import Any, TypeAlias, TypeVar
|
||||||
from urllib.parse import urlsplit
|
from urllib.parse import urlsplit
|
||||||
|
|
||||||
import orjson
|
import orjson
|
||||||
|
@ -17,7 +18,6 @@ import requests
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.forms.models import model_to_dict
|
from django.forms.models import model_to_dict
|
||||||
from django.utils.timezone import now as timezone_now
|
from django.utils.timezone import now as timezone_now
|
||||||
from typing_extensions import TypeAlias
|
|
||||||
|
|
||||||
from zerver.data_import.import_util import (
|
from zerver.data_import.import_util import (
|
||||||
ZerverFieldsT,
|
ZerverFieldsT,
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
import re
|
import re
|
||||||
from typing import Any
|
from typing import Any, TypeAlias
|
||||||
|
|
||||||
from typing_extensions import TypeAlias
|
|
||||||
|
|
||||||
# stubs
|
# stubs
|
||||||
ZerverFieldsT: TypeAlias = dict[str, Any]
|
ZerverFieldsT: TypeAlias = dict[str, Any]
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
import base64
|
import base64
|
||||||
import logging
|
import logging
|
||||||
|
from collections.abc import Callable, Sequence
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from functools import wraps
|
from functools import wraps
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
from typing import TYPE_CHECKING, Callable, Sequence, TypeVar, cast, overload
|
from typing import TYPE_CHECKING, Concatenate, TypeVar, cast, overload
|
||||||
from urllib.parse import urlsplit
|
from urllib.parse import urlsplit
|
||||||
|
|
||||||
import django_otp
|
import django_otp
|
||||||
|
@ -23,7 +24,7 @@ from django.utils.translation import gettext as _
|
||||||
from django.views.decorators.csrf import csrf_exempt
|
from django.views.decorators.csrf import csrf_exempt
|
||||||
from django_otp import user_has_device
|
from django_otp import user_has_device
|
||||||
from two_factor.utils import default_device
|
from two_factor.utils import default_device
|
||||||
from typing_extensions import Concatenate, ParamSpec
|
from typing_extensions import ParamSpec
|
||||||
|
|
||||||
from zerver.context_processors import get_valid_realm_from_request
|
from zerver.context_processors import get_valid_realm_from_request
|
||||||
from zerver.lib.exceptions import (
|
from zerver.lib.exceptions import (
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
from typing import Iterable, Sequence, cast
|
from collections.abc import Iterable, Sequence
|
||||||
|
from typing import cast
|
||||||
|
|
||||||
from django.utils.translation import gettext as _
|
from django.utils.translation import gettext as _
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
from typing import Iterable
|
from collections.abc import Iterable
|
||||||
|
|
||||||
import ahocorasick
|
import ahocorasick
|
||||||
from django.db import transaction
|
from django.db import transaction
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import importlib
|
import importlib
|
||||||
import json
|
import json
|
||||||
from typing import Any, Callable
|
from collections.abc import Callable
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.utils.translation import gettext as _
|
from django.utils.translation import gettext as _
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
from typing import Any, Collection, Iterable
|
from collections.abc import Collection, Iterable
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
from django.db.models import Model, QuerySet
|
from django.db.models import Model, QuerySet
|
||||||
from django.utils.timezone import now as timezone_now
|
from django.utils.timezone import now as timezone_now
|
||||||
|
|
|
@ -7,8 +7,9 @@ import secrets
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
import traceback
|
import traceback
|
||||||
|
from collections.abc import Callable, Iterable, Sequence
|
||||||
from functools import _lru_cache_wrapper, lru_cache, wraps
|
from functools import _lru_cache_wrapper, lru_cache, wraps
|
||||||
from typing import TYPE_CHECKING, Any, Callable, Generic, Iterable, Sequence, TypeVar
|
from typing import TYPE_CHECKING, Any, Generic, TypeVar
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.core.cache import caches
|
from django.core.cache import caches
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
# See https://zulip.readthedocs.io/en/latest/subsystems/caching.html for docs
|
# See https://zulip.readthedocs.io/en/latest/subsystems/caching.html for docs
|
||||||
import logging
|
import logging
|
||||||
|
from collections.abc import Callable, Iterable
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
from typing import Any, Callable, Iterable
|
from typing import Any
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.contrib.sessions.models import Session
|
from django.contrib.sessions.models import Session
|
||||||
|
|
|
@ -3,8 +3,9 @@ Context managers, i.e. things you can use with the 'with' statement.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import fcntl
|
import fcntl
|
||||||
|
from collections.abc import Iterator
|
||||||
from contextlib import contextmanager
|
from contextlib import contextmanager
|
||||||
from typing import IO, Any, Iterator
|
from typing import IO, Any
|
||||||
|
|
||||||
|
|
||||||
@contextmanager
|
@contextmanager
|
||||||
|
|
|
@ -9,9 +9,10 @@ the level of detail we desire or do comparison with OpenAPI types
|
||||||
easily with the native Python type system.
|
easily with the native Python type system.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
from collections.abc import Callable, Sequence
|
||||||
from contextlib import suppress
|
from contextlib import suppress
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from typing import Any, Callable, Sequence
|
from typing import Any
|
||||||
|
|
||||||
from django.core.exceptions import ValidationError
|
from django.core.exceptions import ValidationError
|
||||||
from django.core.validators import URLValidator
|
from django.core.validators import URLValidator
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
import time
|
import time
|
||||||
from typing import Any, Callable, Iterable, Mapping, Sequence, TypeVar
|
from collections.abc import Callable, Iterable, Mapping, Sequence
|
||||||
|
from typing import Any, TypeAlias, TypeVar
|
||||||
|
|
||||||
from psycopg2.extensions import connection, cursor
|
from psycopg2.extensions import connection, cursor
|
||||||
from psycopg2.sql import Composable
|
from psycopg2.sql import Composable
|
||||||
from typing_extensions import TypeAlias, override
|
from typing_extensions import override
|
||||||
|
|
||||||
CursorObj = TypeVar("CursorObj", bound=cursor)
|
CursorObj = TypeVar("CursorObj", bound=cursor)
|
||||||
Query: TypeAlias = str | bytes | Composable
|
Query: TypeAlias = str | bytes | Composable
|
||||||
|
|
|
@ -2,15 +2,15 @@ import functools
|
||||||
import heapq
|
import heapq
|
||||||
import logging
|
import logging
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
|
from collections.abc import Collection, Iterator
|
||||||
from datetime import datetime, timedelta, timezone
|
from datetime import datetime, timedelta, timezone
|
||||||
from typing import Any, Collection, Iterator
|
from typing import Any, TypeAlias
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.db import transaction
|
from django.db import transaction
|
||||||
from django.db.models import Exists, OuterRef, QuerySet
|
from django.db.models import Exists, OuterRef, QuerySet
|
||||||
from django.utils.timezone import now as timezone_now
|
from django.utils.timezone import now as timezone_now
|
||||||
from django.utils.translation import gettext as _
|
from django.utils.translation import gettext as _
|
||||||
from typing_extensions import TypeAlias
|
|
||||||
|
|
||||||
from confirmation.models import one_click_unsubscribe_link
|
from confirmation.models import one_click_unsubscribe_link
|
||||||
from zerver.context_processors import common_context
|
from zerver.context_processors import common_context
|
||||||
|
|
|
@ -1,12 +1,13 @@
|
||||||
import time
|
import time
|
||||||
|
from collections.abc import Callable
|
||||||
from functools import wraps
|
from functools import wraps
|
||||||
from typing import Any, Callable, Literal
|
from typing import Annotated, Any, Concatenate, Literal
|
||||||
|
|
||||||
from django.core.exceptions import ValidationError
|
from django.core.exceptions import ValidationError
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
from django.utils.translation import gettext as _
|
from django.utils.translation import gettext as _
|
||||||
from pydantic import BaseModel, ConfigDict
|
from pydantic import BaseModel, ConfigDict
|
||||||
from typing_extensions import Annotated, Concatenate, ParamSpec
|
from typing_extensions import ParamSpec
|
||||||
|
|
||||||
from zerver.lib.addressee import get_user_profiles_by_ids
|
from zerver.lib.addressee import get_user_profiles_by_ids
|
||||||
from zerver.lib.exceptions import JsonableError, ResourceNotFoundError
|
from zerver.lib.exceptions import JsonableError, ResourceNotFoundError
|
||||||
|
|
|
@ -3,7 +3,7 @@ import re
|
||||||
import secrets
|
import secrets
|
||||||
from email.headerregistry import Address, AddressHeader
|
from email.headerregistry import Address, AddressHeader
|
||||||
from email.message import EmailMessage
|
from email.message import EmailMessage
|
||||||
from typing import Match
|
from re import Match
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.utils.translation import gettext as _
|
from django.utils.translation import gettext as _
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import re
|
import re
|
||||||
from typing import Any, Callable
|
from collections.abc import Callable
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.utils.text import slugify
|
from django.utils.text import slugify
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
|
from collections.abc import Callable
|
||||||
from email.errors import HeaderParseError
|
from email.errors import HeaderParseError
|
||||||
from email.headerregistry import Address
|
from email.headerregistry import Address
|
||||||
from typing import Callable
|
|
||||||
|
|
||||||
from django.core import validators
|
from django.core import validators
|
||||||
from django.core.exceptions import ValidationError
|
from django.core.exceptions import ValidationError
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
# See check_delete_message and check_presence for examples of this
|
# See check_delete_message and check_presence for examples of this
|
||||||
# paradigm.
|
# paradigm.
|
||||||
|
|
||||||
from typing import Sequence
|
from collections.abc import Sequence
|
||||||
|
|
||||||
from zerver.lib.data_types import (
|
from zerver.lib.data_types import (
|
||||||
DictType,
|
DictType,
|
||||||
|
|
|
@ -3,7 +3,8 @@
|
||||||
import copy
|
import copy
|
||||||
import logging
|
import logging
|
||||||
import time
|
import time
|
||||||
from typing import Any, Callable, Collection, Iterable, Mapping, Sequence
|
from collections.abc import Callable, Collection, Iterable, Mapping, Sequence
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.utils.translation import gettext as _
|
from django.utils.translation import gettext as _
|
||||||
|
|
|
@ -12,10 +12,11 @@ import os
|
||||||
import shutil
|
import shutil
|
||||||
import subprocess
|
import subprocess
|
||||||
import tempfile
|
import tempfile
|
||||||
|
from collections.abc import Callable, Iterable, Mapping
|
||||||
from contextlib import suppress
|
from contextlib import suppress
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from functools import cache
|
from functools import cache
|
||||||
from typing import Any, Callable, Iterable, Mapping, Optional, TypedDict
|
from typing import Any, Optional, TypeAlias, TypedDict
|
||||||
|
|
||||||
import orjson
|
import orjson
|
||||||
from django.apps import apps
|
from django.apps import apps
|
||||||
|
@ -24,7 +25,6 @@ from django.db.models import Exists, OuterRef, Q
|
||||||
from django.forms.models import model_to_dict
|
from django.forms.models import model_to_dict
|
||||||
from django.utils.timezone import is_naive as timezone_is_naive
|
from django.utils.timezone import is_naive as timezone_is_naive
|
||||||
from mypy_boto3_s3.service_resource import Object
|
from mypy_boto3_s3.service_resource import Object
|
||||||
from typing_extensions import TypeAlias
|
|
||||||
|
|
||||||
import zerver.lib.upload
|
import zerver.lib.upload
|
||||||
from analytics.models import RealmCount, StreamCount, UserCount
|
from analytics.models import RealmCount, StreamCount, UserCount
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import logging
|
import logging
|
||||||
import time
|
import time
|
||||||
from typing import Callable, TypeVar
|
from collections.abc import Callable
|
||||||
|
from typing import TypeVar
|
||||||
|
|
||||||
from django.db import connection
|
from django.db import connection
|
||||||
from django.db.backends.utils import CursorWrapper
|
from django.db.backends.utils import CursorWrapper
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
from typing import Mapping
|
from collections.abc import Mapping
|
||||||
|
|
||||||
from bs4 import BeautifulSoup
|
from bs4 import BeautifulSoup
|
||||||
from django.utils.html import escape
|
from django.utils.html import escape
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
import os
|
import os
|
||||||
|
from collections.abc import Callable, Sequence
|
||||||
from dataclasses import dataclass, field
|
from dataclasses import dataclass, field
|
||||||
from typing import Any, Callable, Sequence
|
from typing import Any, TypeAlias
|
||||||
|
|
||||||
from django.contrib.staticfiles.storage import staticfiles_storage
|
from django.contrib.staticfiles.storage import staticfiles_storage
|
||||||
from django.urls import URLResolver, path
|
from django.urls import URLResolver, path
|
||||||
from django.utils.module_loading import import_string
|
from django.utils.module_loading import import_string
|
||||||
from django.utils.translation import gettext_lazy
|
from django.utils.translation import gettext_lazy
|
||||||
from django_stubs_ext import StrPromise
|
from django_stubs_ext import StrPromise
|
||||||
from typing_extensions import TypeAlias
|
|
||||||
|
|
||||||
from zerver.lib.storage import static_path
|
from zerver.lib.storage import static_path
|
||||||
|
|
||||||
|
|
|
@ -7,10 +7,12 @@ import mimetypes
|
||||||
import re
|
import re
|
||||||
import time
|
import time
|
||||||
from collections import deque
|
from collections import deque
|
||||||
|
from collections.abc import Callable
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from datetime import datetime, timezone
|
from datetime import datetime, timezone
|
||||||
from functools import lru_cache
|
from functools import lru_cache
|
||||||
from typing import Any, Callable, Generic, Match, Optional, Pattern, TypedDict, TypeVar, cast
|
from re import Match, Pattern
|
||||||
|
from typing import Any, Generic, Optional, TypeAlias, TypedDict, TypeVar, cast
|
||||||
from urllib.parse import parse_qs, quote, urlencode, urljoin, urlsplit, urlunsplit
|
from urllib.parse import parse_qs, quote, urlencode, urljoin, urlsplit, urlunsplit
|
||||||
from xml.etree.ElementTree import Element, SubElement
|
from xml.etree.ElementTree import Element, SubElement
|
||||||
|
|
||||||
|
@ -34,7 +36,7 @@ from django.conf import settings
|
||||||
from markdown.blockparser import BlockParser
|
from markdown.blockparser import BlockParser
|
||||||
from markdown.extensions import codehilite, nl2br, sane_lists, tables
|
from markdown.extensions import codehilite, nl2br, sane_lists, tables
|
||||||
from tlds import tld_set
|
from tlds import tld_set
|
||||||
from typing_extensions import Self, TypeAlias, override
|
from typing_extensions import Self, override
|
||||||
|
|
||||||
from zerver.lib import mention
|
from zerver.lib import mention
|
||||||
from zerver.lib.cache import cache_with_key
|
from zerver.lib.cache import cache_with_key
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import json
|
import json
|
||||||
import re
|
import re
|
||||||
from typing import Any, Mapping, Sequence
|
from collections.abc import Mapping, Sequence
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
import markdown
|
import markdown
|
||||||
from django.utils.html import escape as escape_html
|
from django.utils.html import escape as escape_html
|
||||||
|
|
|
@ -2,8 +2,9 @@ import copy
|
||||||
import json
|
import json
|
||||||
import re
|
import re
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
|
from collections.abc import Mapping
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from typing import Any, Mapping
|
from typing import Any
|
||||||
|
|
||||||
import markdown
|
import markdown
|
||||||
from markdown.extensions import Extension
|
from markdown.extensions import Extension
|
||||||
|
|
|
@ -77,7 +77,8 @@ Dependencies:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import re
|
import re
|
||||||
from typing import Any, Callable, Iterable, Mapping, MutableSequence, Sequence
|
from collections.abc import Callable, Iterable, Mapping, MutableSequence, Sequence
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
import lxml.html
|
import lxml.html
|
||||||
from django.utils.html import escape
|
from django.utils.html import escape
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import re
|
import re
|
||||||
from typing import Any, Match
|
from re import Match
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
from markdown import Markdown
|
from markdown import Markdown
|
||||||
from markdown.extensions import Extension
|
from markdown.extensions import Extension
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import re
|
import re
|
||||||
from typing import Any, Match
|
from re import Match
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
from markdown import Markdown
|
from markdown import Markdown
|
||||||
from markdown.extensions import Extension
|
from markdown.extensions import Extension
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import re
|
import re
|
||||||
from typing import Any, Match
|
from re import Match
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
from markdown import Markdown
|
from markdown import Markdown
|
||||||
from markdown.extensions import Extension
|
from markdown.extensions import Extension
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
from typing import Match
|
from re import Match
|
||||||
from xml.etree.ElementTree import Element
|
from xml.etree.ElementTree import Element
|
||||||
|
|
||||||
from markdown import Extension, Markdown
|
from markdown import Extension, Markdown
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
from typing import Any, Mapping
|
from collections.abc import Mapping
|
||||||
|
from typing import Any
|
||||||
from xml.etree.ElementTree import Element, SubElement
|
from xml.etree.ElementTree import Element, SubElement
|
||||||
|
|
||||||
import markdown
|
import markdown
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import re
|
import re
|
||||||
from typing import Any, Mapping
|
from collections.abc import Mapping
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
import markdown
|
import markdown
|
||||||
from markdown.extensions import Extension
|
from markdown.extensions import Extension
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import functools
|
import functools
|
||||||
import re
|
import re
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from typing import Match
|
from re import Match
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.db.models import Q
|
from django.db.models import Q
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
import re
|
import re
|
||||||
|
from collections.abc import Callable, Collection, Mapping, Sequence
|
||||||
from dataclasses import dataclass, field
|
from dataclasses import dataclass, field
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
from typing import Any, Callable, Collection, Mapping, Sequence, TypedDict
|
from typing import Any, TypedDict
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.db import connection
|
from django.db import connection
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
import copy
|
import copy
|
||||||
import zlib
|
import zlib
|
||||||
|
from collections.abc import Iterable
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from email.headerregistry import Address
|
from email.headerregistry import Address
|
||||||
from typing import Any, Iterable, TypedDict
|
from typing import Any, TypedDict
|
||||||
|
|
||||||
import orjson
|
import orjson
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import time
|
import time
|
||||||
from typing import Any, Callable
|
from collections.abc import Callable
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
from django.db import connection
|
from django.db import connection
|
||||||
from django.db.backends.base.schema import BaseDatabaseSchemaEditor
|
from django.db.backends.base.schema import BaseDatabaseSchemaEditor
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import re
|
import re
|
||||||
|
from collections.abc import Callable, Iterable, Sequence
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from typing import Any, Callable, Generic, Iterable, Sequence, TypeVar
|
from typing import Any, Generic, TypeAlias, TypeVar
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.contrib.auth.models import AnonymousUser
|
from django.contrib.auth.models import AnonymousUser
|
||||||
|
@ -29,7 +30,7 @@ from sqlalchemy.sql import (
|
||||||
)
|
)
|
||||||
from sqlalchemy.sql.selectable import SelectBase
|
from sqlalchemy.sql.selectable import SelectBase
|
||||||
from sqlalchemy.types import ARRAY, Boolean, Integer, Text
|
from sqlalchemy.types import ARRAY, Boolean, Integer, Text
|
||||||
from typing_extensions import TypeAlias, override
|
from typing_extensions import override
|
||||||
|
|
||||||
from zerver.lib.addressee import get_user_profiles, get_user_profiles_by_ids
|
from zerver.lib.addressee import get_user_profiles, get_user_profiles_by_ids
|
||||||
from zerver.lib.exceptions import ErrorCode, JsonableError, MissingAuthenticationError
|
from zerver.lib.exceptions import ErrorCode, JsonableError, MissingAuthenticationError
|
||||||
|
|
|
@ -19,8 +19,8 @@ from users:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
from collections.abc import Collection, Sequence
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from typing import Collection, Sequence
|
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
from typing import Any, Collection, Protocol
|
from collections.abc import Collection
|
||||||
|
from typing import Any, Protocol
|
||||||
|
|
||||||
from django.utils.translation import gettext as _
|
from django.utils.translation import gettext as _
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import weakref
|
import weakref
|
||||||
from abc import ABCMeta, abstractmethod
|
from abc import ABCMeta, abstractmethod
|
||||||
from typing import Any, ClassVar, Generic, MutableMapping, TypeVar
|
from collections.abc import MutableMapping
|
||||||
|
from typing import Any, ClassVar, Generic, TypeVar
|
||||||
|
|
||||||
from typing_extensions import override
|
from typing_extensions import override
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import math
|
import math
|
||||||
|
from collections.abc import Collection
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from typing import Any, Collection
|
from typing import Any
|
||||||
|
|
||||||
from zerver.lib.mention import MentionData
|
from zerver.lib.mention import MentionData
|
||||||
from zerver.lib.user_groups import get_user_group_member_ids
|
from zerver.lib.user_groups import get_user_group_member_ids
|
||||||
|
|
|
@ -1,10 +1,13 @@
|
||||||
# Workaround for missing functools.partial support in mypy
|
# Workaround for missing functools.partial support in mypy
|
||||||
# (https://github.com/python/mypy/issues/1484).
|
# (https://github.com/python/mypy/issues/1484).
|
||||||
|
|
||||||
from typing import TYPE_CHECKING, Callable, TypeVar, overload
|
from collections.abc import Callable
|
||||||
|
from typing import TYPE_CHECKING, TypeVar, overload
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from typing_extensions import Concatenate, ParamSpec
|
from typing import Concatenate
|
||||||
|
|
||||||
|
from typing_extensions import ParamSpec
|
||||||
|
|
||||||
P = ParamSpec("P")
|
P = ParamSpec("P")
|
||||||
T1 = TypeVar("T1")
|
T1 = TypeVar("T1")
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
from typing import Any, Callable, TypeVar
|
from collections.abc import Callable
|
||||||
|
from typing import Any, TypeVar
|
||||||
|
|
||||||
ReturnT = TypeVar("ReturnT")
|
ReturnT = TypeVar("ReturnT")
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
import time
|
import time
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
|
from collections.abc import Mapping, Sequence
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
from typing import Any, Mapping, Sequence
|
from typing import Any
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.utils.timezone import now as timezone_now
|
from django.utils.timezone import now as timezone_now
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import cProfile
|
import cProfile
|
||||||
|
from collections.abc import Callable
|
||||||
from functools import wraps
|
from functools import wraps
|
||||||
from typing import Callable, TypeVar
|
from typing import TypeVar
|
||||||
|
|
||||||
from typing_extensions import ParamSpec
|
from typing_extensions import ParamSpec
|
||||||
|
|
||||||
|
|
|
@ -5,10 +5,11 @@ import base64
|
||||||
import copy
|
import copy
|
||||||
import logging
|
import logging
|
||||||
import re
|
import re
|
||||||
|
from collections.abc import Iterable, Mapping, Sequence
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from email.headerregistry import Address
|
from email.headerregistry import Address
|
||||||
from functools import cache
|
from functools import cache
|
||||||
from typing import TYPE_CHECKING, Any, Iterable, Mapping, Optional, Sequence, Union
|
from typing import TYPE_CHECKING, Any, Optional, TypeAlias, Union
|
||||||
|
|
||||||
import lxml.html
|
import lxml.html
|
||||||
import orjson
|
import orjson
|
||||||
|
@ -24,7 +25,7 @@ from firebase_admin import exceptions as firebase_exceptions
|
||||||
from firebase_admin import initialize_app as firebase_initialize_app
|
from firebase_admin import initialize_app as firebase_initialize_app
|
||||||
from firebase_admin import messaging as firebase_messaging
|
from firebase_admin import messaging as firebase_messaging
|
||||||
from firebase_admin.messaging import UnregisteredError as FCMUnregisteredError
|
from firebase_admin.messaging import UnregisteredError as FCMUnregisteredError
|
||||||
from typing_extensions import TypeAlias, override
|
from typing_extensions import override
|
||||||
|
|
||||||
from analytics.lib.counts import COUNT_STATS, do_increment_logging_stat
|
from analytics.lib.counts import COUNT_STATS, do_increment_logging_stat
|
||||||
from zerver.actions.realm_settings import (
|
from zerver.actions.realm_settings import (
|
||||||
|
|
|
@ -5,7 +5,8 @@ import threading
|
||||||
import time
|
import time
|
||||||
from abc import ABCMeta, abstractmethod
|
from abc import ABCMeta, abstractmethod
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
from typing import Any, Callable, Generic, Mapping, TypeVar
|
from collections.abc import Callable, Mapping
|
||||||
|
from typing import Any, Generic, TypeAlias, TypeVar
|
||||||
|
|
||||||
import orjson
|
import orjson
|
||||||
import pika
|
import pika
|
||||||
|
@ -18,7 +19,7 @@ from pika.adapters.blocking_connection import BlockingChannel
|
||||||
from pika.channel import Channel
|
from pika.channel import Channel
|
||||||
from pika.spec import Basic
|
from pika.spec import Basic
|
||||||
from tornado import ioloop
|
from tornado import ioloop
|
||||||
from typing_extensions import TypeAlias, override
|
from typing_extensions import override
|
||||||
|
|
||||||
from zerver.lib.utils import assert_is_not_none
|
from zerver.lib.utils import assert_is_not_none
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
from typing import Sequence
|
from collections.abc import Sequence
|
||||||
|
|
||||||
from django.core.exceptions import ValidationError
|
from django.core.exceptions import ValidationError
|
||||||
from django.utils.translation import gettext as _
|
from django.utils.translation import gettext as _
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue