python: Rewrite dict() as {}.

Suggested by the flake8-comprehensions plugin.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg
2020-09-01 23:14:51 -07:00
committed by Tim Abbott
parent a610bd19a1
commit a276eefcfe
46 changed files with 79 additions and 79 deletions

View File

@@ -33,7 +33,7 @@ def get_status_dicts_for_rows(all_rows: List[Dict[str, Any]],
get_user_key = lambda row: row['user_profile__email']
get_user_info = get_legacy_user_info
user_statuses: Dict[str, Dict[str, Any]] = dict()
user_statuses: Dict[str, Dict[str, Any]] = {}
for user_key, presence_rows in itertools.groupby(all_rows, get_user_key):
info = get_user_info(
@@ -64,7 +64,7 @@ def get_modern_user_info(presence_rows: List[Dict[str, Any]],
# Be stingy about bandwidth, and don't even include
# keys for entities that have None values. JS
# code should just do a falsy check here.
result = dict()
result = {}
if active_timestamp is not None:
result['active_timestamp'] = active_timestamp
@@ -100,7 +100,7 @@ def get_legacy_user_info(presence_rows: List[Dict[str, Any]],
most_recent_info = info_rows[-1]
result = dict()
result = {}
# The word "aggegrated" here is possibly misleading.
# It's really just the most recent client's info.