From e986edb5bfa7da2c0636c018cea4adbddd9f9aec Mon Sep 17 00:00:00 2001 From: Jylpah Date: Mon, 26 Oct 2020 00:25:53 +0200 Subject: [PATCH 1/2] help_filter(): started --- analyze_wotb_replays.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/analyze_wotb_replays.py b/analyze_wotb_replays.py index 0ebc147..3f849a1 100755 --- a/analyze_wotb_replays.py +++ b/analyze_wotb_replays.py @@ -933,7 +933,7 @@ async def main(argv): # TBD if args.mode == OPT_MODE_HELP: - await help_filters(db) + await help_filters(db, parser) sys.exit(0) # rebase file arguments due to moving the working directory to the script location @@ -996,22 +996,23 @@ async def main(argv): return None -async def help_filters(db : motor.motor_asyncio.AsyncIOMotorDatabase = None): +async def help_filters(db : motor.motor_asyncio.AsyncIOMotorDatabase = None, parser: argparse.ArgumentParser = None): """Help for --filters""" - print("Syntax: --filters '{ \"replay.param\": VALUE, \"replay.param2\": { \"$MONGO_OPERATOR\" : VALUE }, ... }'") + if parser != None: + parser.print_help() + print("\nSyntax: --filters '{ \"replay.param\": VALUE, \"replay.param2\": { \"$MONGO_OPERATOR\" : VALUE }, ... }'") print("\tExample: --filters '{ \"data.summary.protagonist\": ACCOUNT_ID, \"data.summary.battle_start_timestamp\": { \"$gt\" : 1602853200 } }'") if db != None: dbc = db[DB_C_REPLAYS] try: res = await dbc.find_one() summary = res['data']['summary'] - details = summary[0] - print('data.summary.KEYS:') + details = summary['details'][0] + print('\n--filters KEYS:') for s in summary: - print("\t" + s) - print(print('data.summary.details.[].keys:')) + print("\tdata.summary." + s) for d in details: - print("\t" + d) + print("\tdata.summary.details.[]." + d) except Exception as err: bu.error(exception=err) From 788d18e1a21905aa4c6ff679876b30b84b646eb3 Mon Sep 17 00:00:00 2001 From: Jylpah Date: Wed, 28 Oct 2020 09:35:16 +0200 Subject: [PATCH 2/2] help_extended(): renaming --- analyze_wotb_replays.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/analyze_wotb_replays.py b/analyze_wotb_replays.py index 3f849a1..e702210 100755 --- a/analyze_wotb_replays.py +++ b/analyze_wotb_replays.py @@ -933,7 +933,7 @@ async def main(argv): # TBD if args.mode == OPT_MODE_HELP: - await help_filters(db, parser) + await help_extended(db, parser) sys.exit(0) # rebase file arguments due to moving the working directory to the script location @@ -996,10 +996,13 @@ async def main(argv): return None -async def help_filters(db : motor.motor_asyncio.AsyncIOMotorDatabase = None, parser: argparse.ArgumentParser = None): +async def help_extended(db : motor.motor_asyncio.AsyncIOMotorDatabase = None, parser: argparse.ArgumentParser = None): """Help for --filters""" if parser != None: parser.print_help() + # Result category options + + # Filter usage print("\nSyntax: --filters '{ \"replay.param\": VALUE, \"replay.param2\": { \"$MONGO_OPERATOR\" : VALUE }, ... }'") print("\tExample: --filters '{ \"data.summary.protagonist\": ACCOUNT_ID, \"data.summary.battle_start_timestamp\": { \"$gt\" : 1602853200 } }'") if db != None: