Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Use TYPE_CHECKING instead of magic MYPY variable. #8770

Merged
merged 1 commit into from
Nov 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/8770.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Use `TYPE_CHECKING` instead of magic `MYPY` variable.
5 changes: 2 additions & 3 deletions synapse/events/spamcheck.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,12 @@
# limitations under the License.

import inspect
from typing import Any, Dict, List, Optional, Tuple
from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple

from synapse.spam_checker_api import RegistrationBehaviour
from synapse.types import Collection

MYPY = False
if MYPY:
if TYPE_CHECKING:
import synapse.events
import synapse.server

Expand Down
5 changes: 2 additions & 3 deletions synapse/handlers/presence.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import abc
import logging
from contextlib import contextmanager
from typing import Dict, Iterable, List, Set, Tuple
from typing import TYPE_CHECKING, Dict, Iterable, List, Set, Tuple

from prometheus_client import Counter
from typing_extensions import ContextManager
Expand All @@ -46,8 +46,7 @@
from synapse.util.metrics import Measure
from synapse.util.wheel_timer import WheelTimer

MYPY = False
if MYPY:
if TYPE_CHECKING:
from synapse.server import HomeServer

logger = logging.getLogger(__name__)
Expand Down
5 changes: 2 additions & 3 deletions synapse/rest/client/v1/room.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

import logging
import re
from typing import List, Optional
from typing import TYPE_CHECKING, List, Optional
from urllib import parse as urlparse

from synapse.api.constants import EventTypes, Membership
Expand Down Expand Up @@ -48,8 +48,7 @@
from synapse.util import json_decoder
from synapse.util.stringutils import random_string

MYPY = False
if MYPY:
if TYPE_CHECKING:
import synapse.server

logger = logging.getLogger(__name__)
Expand Down