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

Commit

Permalink
Stop using special MYPY variable.
Browse files Browse the repository at this point in the history
  • Loading branch information
clokep committed Nov 17, 2020
1 parent f737368 commit 8902505
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 9 deletions.
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

0 comments on commit 8902505

Please sign in to comment.