zerver/lib/bugdown/testing_mocks.py: Fix types.

Also fix clashing annotations in zerver/lib/bugdown/__init__.py.
This commit is contained in:
Eklavya Sharma 2016-06-16 17:01:40 +05:30 committed by Tim Abbott
parent 7db0765a18
commit 04f44b12ad
2 changed files with 4 additions and 2 deletions

View File

@ -111,7 +111,7 @@ def add_a(root, url, link, height="", title=None, desc=None,
@cache_with_key(lambda tweet_id: tweet_id, cache_name="database", with_statsd_key="tweet_data") @cache_with_key(lambda tweet_id: tweet_id, cache_name="database", with_statsd_key="tweet_data")
def fetch_tweet_data(tweet_id): def fetch_tweet_data(tweet_id):
# type: (str) -> Optional[Dict[str, Any]] # type: (text_type) -> Optional[Dict[text_type, Any]]
if settings.TEST_SUITE: if settings.TEST_SUITE:
from . import testing_mocks from . import testing_mocks
res = testing_mocks.twitter(tweet_id) res = testing_mocks.twitter(tweet_id)

View File

@ -1,5 +1,7 @@
from __future__ import absolute_import from __future__ import absolute_import
from __future__ import unicode_literals
from six import text_type
from typing import Any, Dict, Optional from typing import Any, Dict, Optional
import ujson import ujson
@ -237,7 +239,7 @@ MEDIA_TWEET = """{
def twitter(tweet_id): def twitter(tweet_id):
# type: (str) -> Optional[Dict[str, Any]] # type: (text_type) -> Optional[Dict[text_type, Any]]
if tweet_id in ["112652479837110273", "287977969287315456", "287977969287315457"]: if tweet_id in ["112652479837110273", "287977969287315456", "287977969287315457"]:
return ujson.loads(NORMAL_TWEET) return ujson.loads(NORMAL_TWEET)
elif tweet_id == "287977969287315458": elif tweet_id == "287977969287315458":