mirror of
https://github.com/Jylpah/blitz-tools.git
synced 2026-10-28 12:39:52 +01:00
3 files changed
+40
-4
No files matched your search
@@ -1316,7 +1316,9 @@ def calc_team_stats(results: list, player_stats : dict, stat_id_map : dict, arg
|
|||||||
n_players = len(result['allies']) + len(result['enemies'])
|
n_players = len(result['allies']) + len(result['enemies'])
|
||||||
n_allies = collections.defaultdict(def_value_zero)
|
n_allies = collections.defaultdict(def_value_zero)
|
||||||
allies_stats = collections.defaultdict(def_value_zero)
|
allies_stats = collections.defaultdict(def_value_zero)
|
||||||
|
n_enemies = collections.defaultdict(def_value_zero)
|
||||||
|
enemies_stats = collections.defaultdict(def_value_zero)
|
||||||
|
|
||||||
#bu.debug('Processing Allies')
|
#bu.debug('Processing Allies')
|
||||||
for ally in result['allies']:
|
for ally in result['allies']:
|
||||||
# Player itself is not in 'allies': see read_replay_JSON()
|
# Player itself is not in 'allies': see read_replay_JSON()
|
||||||
@@ -1330,8 +1332,6 @@ def calc_team_stats(results: list, player_stats : dict, stat_id_map : dict, arg
|
|||||||
n_allies[stat] += 1
|
n_allies[stat] += 1
|
||||||
|
|
||||||
#bu.debug('Processing Enemies')
|
#bu.debug('Processing Enemies')
|
||||||
n_enemies = collections.defaultdict(def_value_zero)
|
|
||||||
enemies_stats = collections.defaultdict(def_value_zero)
|
|
||||||
for enemy in result['enemies']:
|
for enemy in result['enemies']:
|
||||||
enemy_mapped = stat_id_map[enemy]
|
enemy_mapped = stat_id_map[enemy]
|
||||||
if enemy_mapped not in player_stats:
|
if enemy_mapped not in player_stats:
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
motor
|
||||||
|
aiohttp
|
||||||
|
aioconsole
|
||||||
|
aiofiles
|
||||||
|
aiosqlite
|
||||||
|
beautifulsoup4
|
||||||
|
lxml
|
||||||
|
xmltodict
|
||||||
|
progress
|
||||||
|
pytest-asyncio
|
||||||
+27
-1
@@ -270,7 +270,7 @@ def getTitle_old(replayfile: str, title: str, i : int) -> str:
|
|||||||
return title
|
return title
|
||||||
|
|
||||||
|
|
||||||
def getTitle(replayfile: str, title: str, i : int) -> str:
|
def getTitle(replayfile: str, title: str = None, i : int = 0) -> str:
|
||||||
global wg
|
global wg
|
||||||
if title == None:
|
if title == None:
|
||||||
try:
|
try:
|
||||||
@@ -302,6 +302,32 @@ def getTitle(replayfile: str, title: str, i : int) -> str:
|
|||||||
bu.debug('Returning: ' + title)
|
bu.debug('Returning: ' + title)
|
||||||
return title
|
return title
|
||||||
|
|
||||||
|
### UNIT TESTS - pytest
|
||||||
|
|
||||||
|
# class TestClass:
|
||||||
|
# def test_getTitle(self):
|
||||||
|
# #player = "jylpah"
|
||||||
|
# WG_appID = '81381d3f45fa4aa75b78a7198eb216ad'
|
||||||
|
# wg = WG(WG_appID, 'tanks.json', 'maps.json')
|
||||||
|
# tank_name = "T28 Defender" # "A68_T28D"
|
||||||
|
# map_name = "Yukon" # "idle"
|
||||||
|
# replay = './test/' + '20201030_2358__jylpah_A_1157485188135816346.wotbreplay'
|
||||||
|
# res = tank_name + ' @ ' + map_name
|
||||||
|
|
||||||
|
# assert getTitle(replay) == res
|
||||||
|
|
||||||
|
# @pytest.mark.asyncio
|
||||||
|
# async def test_getTitle(self):
|
||||||
|
# #player = "jylpah"
|
||||||
|
# WG_appID = '81381d3f45fa4aa75b78a7198eb216ad'
|
||||||
|
# wg = WG(WG_appID, 'tanks.json', 'maps.json')
|
||||||
|
# tank_name = "T28 Defender" # "A68_T28D"
|
||||||
|
# map_name = "Yukon" # "idle"
|
||||||
|
# replay = './test/' + '20201030_2358__jylpah_A_1157485188135816346.wotbreplay'
|
||||||
|
# res = tank_name + ' @ ' + map_name
|
||||||
|
|
||||||
|
# assert getTitle(replay) == res
|
||||||
|
|
||||||
### main() -------------------------------------------
|
### main() -------------------------------------------
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
# To avoid 'Event loop is closed' RuntimeError due to compatibility issue with aiohttp
|
# To avoid 'Event loop is closed' RuntimeError due to compatibility issue with aiohttp
|
||||||
|
|||||||
Reference in new issue
Block a user