From 4ff530aa60407fe84deb9322bf3df2a0938f79df Mon Sep 17 00:00:00 2001 From: Dazed Date: Thu, 27 Apr 2023 13:17:13 -0500 Subject: [PATCH] fix: Fix an issue with estimates being off --- src/rpgmakermvmz.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/rpgmakermvmz.py b/src/rpgmakermvmz.py index 26bbfbb..9e257bc 100644 --- a/src/rpgmakermvmz.py +++ b/src/rpgmakermvmz.py @@ -44,7 +44,7 @@ CODE122 = False CODE101 = False CODE355655 = False CODE357 = False -CODE356 = True +CODE356 = False # Regex subVarRegex = r'(\\+[a-zA-Z]+)\[([a-zA-Z0-9一-龠ぁ-ゔァ-ヴー\s]+)\]' @@ -61,9 +61,10 @@ def handleMVMZ(filename, estimate): # Print Result end = time.time() tqdm.write(getResultString(['', TOKENS, None], end - start, filename)) - TOTALCOST += TOKENS * .001 * APICOST - TOTALTOKENS += TOKENS - TOKENS = 0 + with LOCK: + TOTALCOST += TOKENS * .001 * APICOST + TOTALTOKENS += TOKENS + TOKENS = 0 return getResultString(['', TOTALTOKENS, None], end - start, 'TOTAL') @@ -76,8 +77,9 @@ def handleMVMZ(filename, estimate): end = time.time() json.dump(translatedData[0], outFile, ensure_ascii=False) tqdm.write(getResultString(translatedData, end - start, filename)) - TOTALCOST += translatedData[1] * .001 * APICOST - TOTALTOKENS += translatedData[1] + with LOCK: + TOTALCOST += translatedData[1] * .001 * APICOST + TOTALTOKENS += translatedData[1] return getResultString(['', TOTALTOKENS, None], end - start, 'TOTAL')