typing: Use TYPE_CHECKING when dealing with cyclic dependencies.

This commit is contained in:
Wyatt Hoodes
2019-07-30 08:58:48 -10:00
committed by Tim Abbott
parent 97c10b35c2
commit 4beec5c6b9
4 changed files with 9 additions and 6 deletions

View File

@@ -9,7 +9,8 @@ from django.db.models import Q
from django.core.cache.backends.base import BaseCache
from django.http import HttpRequest
from typing import Any, Callable, Dict, Iterable, List, Optional, TypeVar, Tuple
from typing import Any, Callable, Dict, Iterable, List, \
Optional, TypeVar, Tuple, TYPE_CHECKING
from zerver.lib.utils import statsd, statsd_key, make_safe_digest
import time
@@ -19,7 +20,7 @@ import sys
import os
import hashlib
if False:
if TYPE_CHECKING:
# These modules have to be imported for type annotations but
# they cannot be imported at runtime due to cyclic dependency.
from zerver.models import UserProfile, Realm, Message