change '{}' to 'dict()' for readability

This commit is contained in:
Jylpah committed 2021-03-08 21:06:15 +02:00
1 parent 9601177ff6
commit 7a1272c4eb
1 file changed
+10 -10
+10 -10
View File
@@ -1787,7 +1787,7 @@ async def process_player_stats(players, N_workers: int, args : argparse.Namespac
try: try:
statsQ = asyncio.Queue() statsQ = asyncio.Queue()
bu.debug('Create player stats queue: ' + str(len(players)) + ' players') bu.debug('Create player stats queue: ' + str(len(players)) + ' players')
stat_id_map = {} stat_id_map = dict()
stat_ids = set() stat_ids = set()
stat_id_map_func = globals()[StatFunc.get_stat_id_func()] stat_id_map_func = globals()[StatFunc.get_stat_id_func()]
@@ -1813,8 +1813,8 @@ async def process_player_stats(players, N_workers: int, args : argparse.Namespac
bu.debug('Cancelling stats workers') bu.debug('Cancelling stats workers')
for task in stats_tasks: for task in stats_tasks:
task.cancel() task.cancel()
player_stats = {} player_stats = dict()
stat_id_remap = {} stat_id_remap = dict()
bu.debug('Gathering stats worker outputs') bu.debug('Gathering stats worker outputs')
for (stats, id_remap) in await asyncio.gather(*stats_tasks): for (stats, id_remap) in await asyncio.gather(*stats_tasks):
@@ -1921,8 +1921,8 @@ def calc_team_stats(results: list, player_stats : dict, stat_id_map : dict, arg
async def stat_worker(queue : asyncio.Queue, workerID: int, args : argparse.Namespace, db : motor.motor_asyncio.AsyncIOMotorDatabase) -> list: async def stat_worker(queue : asyncio.Queue, workerID: int, args : argparse.Namespace, db : motor.motor_asyncio.AsyncIOMotorDatabase) -> list:
"""Worker thread to find stats for player / tank pairs""" """Worker thread to find stats for player / tank pairs"""
# global wg # global wg
stats = {} stats = dict()
stat_id_remap = {} stat_id_remap = dict()
stat_db_func = globals()[StatFunc.get_db_func()] stat_db_func = globals()[StatFunc.get_db_func()]
stat_wg_func = globals()[StatFunc.get_wg_func()] stat_wg_func = globals()[StatFunc.get_wg_func()]
@@ -2198,7 +2198,7 @@ async def tank_stats_helper(stat_list: list):
try: try:
if stat_list == None: if stat_list == None:
return None return None
stats = {} stats = dict()
hist_fields = histogram_fields.keys() hist_fields = histogram_fields.keys()
if 'battles' not in hist_fields: if 'battles' not in hist_fields:
bu.error('\'battles\' must be defined in \'histogram_fields\'') bu.error('\'battles\' must be defined in \'histogram_fields\'')
@@ -2230,7 +2230,7 @@ async def player_stats_helper(player_stats: dict):
try: try:
if player_stats == None: if player_stats == None:
return None return None
stats = {} stats = dict()
hist_fields = histogram_fields.keys() hist_fields = histogram_fields.keys()
if 'battles' not in hist_fields: if 'battles' not in hist_fields:
bu.error('\'battles\' must be defined in \'histogram_fields\'') bu.error('\'battles\' must be defined in \'histogram_fields\'')
@@ -2271,7 +2271,7 @@ async def mk_replayQ(queue : asyncio.Queue, args : argparse.Namespace, db : moto
cursor = dbc.find(filters) cursor = dbc.find(filters)
else: else:
# select all # select all
cursor = dbc.find({}) cursor = dbc.find(dict())
bu.debug('Reading replays...') bu.debug('Reading replays...')
async for replay_json in cursor: async for replay_json in cursor:
_id = replay_json['_id'] _id = replay_json['_id']
@@ -2392,7 +2392,7 @@ async def read_replay_JSON(replay_json: dict, args : argparse.Namespace) -> dict
account_id = args.account_id account_id = args.account_id
url = args.url url = args.url
#db = args.db #db = args.db
result = {} result = dict()
try: try:
# bu.debug(str(replay_json)) # bu.debug(str(replay_json))
if not wi.chk_JSON_replay(replay_json): if not wi.chk_JSON_replay(replay_json):
@@ -2454,7 +2454,7 @@ async def read_replay_JSON(replay_json: dict, args : argparse.Namespace) -> dict
if player['dbid'] == account_id: if player['dbid'] == account_id:
# player itself is not put in results['allies'] # player itself is not put in results['allies']
tmp = {} tmp = dict()
tmp['account_id'] = account_id tmp['account_id'] = account_id
tmp['tank_id'] = player['vehicle_descr'] tmp['tank_id'] = player['vehicle_descr']
tmp['tank_tier'] = player_tank_tier tmp['tank_tier'] = player_tank_tier