ruff formatting
This commit is contained in:
parent
1ed64f2e56
commit
31c8007055
19 changed files with 174 additions and 40 deletions
|
|
@ -1,5 +1,12 @@
|
|||
# Libraries
|
||||
import json, os, re, textwrap, threading, time, traceback, tiktoken, openai
|
||||
import os
|
||||
import re
|
||||
import textwrap
|
||||
import threading
|
||||
import time
|
||||
import traceback
|
||||
import tiktoken
|
||||
import openai
|
||||
from pathlib import Path
|
||||
from colorama import Fore
|
||||
from dotenv import load_dotenv
|
||||
|
|
@ -89,7 +96,7 @@ def handleAlice(filename, estimate):
|
|||
with LOCK:
|
||||
totalTokens[0] += translatedData[1][0]
|
||||
totalTokens[1] += translatedData[1][1]
|
||||
except Exception as e:
|
||||
except Exception:
|
||||
traceback.print_exc()
|
||||
return 'Fail'
|
||||
|
||||
|
|
@ -187,7 +194,7 @@ def translateLines(linesList, pbar):
|
|||
|
||||
# Check if next line should be merged
|
||||
if insertBool is True:
|
||||
linesList[i] = re.sub(r'(s\[[0-9]+\]) = \"(.+)\"', rf'\1 = ""', linesList[i])
|
||||
linesList[i] = re.sub(r'(s\[[0-9]+\]) = \"(.+)\"', r'\1 = ""', linesList[i])
|
||||
linesList[i] = linesList[i].replace(';', '')
|
||||
start = i
|
||||
while (len(linesList) > i+1 and re.search(r's\[[0-9]+\] = \"\s+(.*)\"', linesList[i+1]) != None):
|
||||
|
|
@ -196,7 +203,7 @@ def translateLines(linesList, pbar):
|
|||
match = re.findall(r's\[[0-9]+\] = \"\s+(.*)\"', linesList[i])
|
||||
currentGroup.append(match[0])
|
||||
if insertBool is True:
|
||||
linesList[i] = re.sub(r'(s\[[0-9]+\]) = \"\s+(.+)\"', rf'\1 = ""', linesList[i])
|
||||
linesList[i] = re.sub(r'(s\[[0-9]+\]) = \"\s+(.+)\"', r'\1 = ""', linesList[i])
|
||||
linesList[i] = linesList[i].replace(';', '')
|
||||
i += 1
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,13 @@
|
|||
# Libraries
|
||||
import json, os, re, textwrap, threading, time, traceback, tiktoken, openai
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
import textwrap
|
||||
import threading
|
||||
import time
|
||||
import traceback
|
||||
import tiktoken
|
||||
import openai
|
||||
from pathlib import Path
|
||||
from colorama import Fore
|
||||
from dotenv import load_dotenv
|
||||
|
|
@ -89,7 +97,7 @@ def handleAnim(filename, estimate):
|
|||
with LOCK:
|
||||
totalTokens[0] += translatedData[1][0]
|
||||
totalTokens[1] += translatedData[1][1]
|
||||
except Exception as e:
|
||||
except Exception:
|
||||
return 'Fail'
|
||||
|
||||
return getResultString(['', totalTokens, None], end - start, 'TOTAL')
|
||||
|
|
|
|||
|
|
@ -1,6 +1,14 @@
|
|||
# Libraries
|
||||
import json, os, re, textwrap, threading, time, traceback, tiktoken, openai, csv
|
||||
from concurrent.futures import ThreadPoolExecutor, as_completed
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
import textwrap
|
||||
import threading
|
||||
import time
|
||||
import traceback
|
||||
import tiktoken
|
||||
import openai
|
||||
import csv
|
||||
from pathlib import Path
|
||||
from colorama import Fore
|
||||
from dotenv import load_dotenv
|
||||
|
|
|
|||
|
|
@ -1,5 +1,12 @@
|
|||
# Libraries
|
||||
import os, re, textwrap, threading, time, traceback, tiktoken, openai
|
||||
import os
|
||||
import re
|
||||
import textwrap
|
||||
import threading
|
||||
import time
|
||||
import traceback
|
||||
import tiktoken
|
||||
import openai
|
||||
from pathlib import Path
|
||||
from colorama import Fore
|
||||
from dotenv import load_dotenv
|
||||
|
|
@ -89,7 +96,7 @@ def handleEushully(filename, estimate):
|
|||
with LOCK:
|
||||
TOKENS[0] += translatedData[1][0]
|
||||
TOKENS[1] += translatedData[1][1]
|
||||
except Exception as e:
|
||||
except Exception:
|
||||
traceback.print_exc()
|
||||
return 'Fail'
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,13 @@
|
|||
# Libraries
|
||||
from PIL import Image, ImageDraw, ImageFont
|
||||
import json, os, re, textwrap, threading, time, traceback, tiktoken, openai
|
||||
from concurrent.futures import ThreadPoolExecutor, as_completed
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
import threading
|
||||
import time
|
||||
import traceback
|
||||
import tiktoken
|
||||
import openai
|
||||
from pathlib import Path
|
||||
from colorama import Fore
|
||||
from dotenv import load_dotenv
|
||||
|
|
|
|||
|
|
@ -1,5 +1,12 @@
|
|||
# Libraries
|
||||
import os, re, textwrap, threading, time, traceback, tiktoken, openai
|
||||
import os
|
||||
import re
|
||||
import textwrap
|
||||
import threading
|
||||
import time
|
||||
import traceback
|
||||
import tiktoken
|
||||
import openai
|
||||
from pathlib import Path
|
||||
from colorama import Fore
|
||||
from dotenv import load_dotenv
|
||||
|
|
@ -88,7 +95,7 @@ def handleIris(filename, estimate):
|
|||
with LOCK:
|
||||
TOKENS[0] += translatedData[1][0]
|
||||
TOKENS[1] += translatedData[1][1]
|
||||
except Exception as e:
|
||||
except Exception:
|
||||
traceback.print_exc()
|
||||
return 'Fail'
|
||||
|
||||
|
|
@ -261,12 +268,12 @@ def translateIris(data, pbar, filename, translatedList):
|
|||
if count != 0:
|
||||
if voice == True:
|
||||
#MSG for each item in the list
|
||||
data.insert(i, f'#MSGVOICE,\n')
|
||||
data.insert(i, '#MSGVOICE,\n')
|
||||
i += 1
|
||||
data.insert(i, f'{voiceVar}')
|
||||
i += 1
|
||||
else:
|
||||
data.insert(i, f'#MSG,\n')
|
||||
data.insert(i, '#MSG,\n')
|
||||
i += 1
|
||||
if speaker:
|
||||
data[i] = f'\u3000{speaker}\n'
|
||||
|
|
|
|||
|
|
@ -1,5 +1,12 @@
|
|||
# Libraries
|
||||
import os, re, textwrap, threading, time, traceback, tiktoken, openai
|
||||
import os
|
||||
import re
|
||||
import textwrap
|
||||
import threading
|
||||
import time
|
||||
import traceback
|
||||
import tiktoken
|
||||
import openai
|
||||
from pathlib import Path
|
||||
from colorama import Fore
|
||||
from dotenv import load_dotenv
|
||||
|
|
@ -88,7 +95,7 @@ def handleJavascript(filename, estimate):
|
|||
with LOCK:
|
||||
TOKENS[0] += translatedData[1][0]
|
||||
TOKENS[1] += translatedData[1][1]
|
||||
except Exception as e:
|
||||
except Exception:
|
||||
traceback.print_exc()
|
||||
return 'Fail'
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,13 @@
|
|||
# Libraries
|
||||
import json, os, re, textwrap, threading, time, traceback, tiktoken, openai
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
import textwrap
|
||||
import threading
|
||||
import time
|
||||
import traceback
|
||||
import tiktoken
|
||||
import openai
|
||||
from pathlib import Path
|
||||
from colorama import Fore
|
||||
from dotenv import load_dotenv
|
||||
|
|
@ -81,7 +89,7 @@ def handleJSON(filename, estimate):
|
|||
with LOCK:
|
||||
TOKENS[0] += translatedData[1][0]
|
||||
TOKENS[1] += translatedData[1][1]
|
||||
except Exception as e:
|
||||
except Exception:
|
||||
return 'Fail'
|
||||
|
||||
return getResultString(['', TOKENS, None], end - start, 'TOTAL')
|
||||
|
|
|
|||
|
|
@ -1,5 +1,12 @@
|
|||
# Libraries
|
||||
import json, os, re, textwrap, threading, time, traceback, tiktoken, openai
|
||||
import os
|
||||
import re
|
||||
import textwrap
|
||||
import threading
|
||||
import time
|
||||
import traceback
|
||||
import tiktoken
|
||||
import openai
|
||||
from pathlib import Path
|
||||
from colorama import Fore
|
||||
from dotenv import load_dotenv
|
||||
|
|
@ -88,7 +95,7 @@ def handleKansen(filename, estimate):
|
|||
with LOCK:
|
||||
TOKENS[0] += translatedData[1][0]
|
||||
TOKENS[1] += translatedData[1][1]
|
||||
except Exception as e:
|
||||
except Exception:
|
||||
traceback.print_exc()
|
||||
return 'Fail'
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,13 @@
|
|||
# Libraries
|
||||
import json, os, re, textwrap, threading, time, traceback, tiktoken, openai
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
import textwrap
|
||||
import threading
|
||||
import time
|
||||
import traceback
|
||||
import tiktoken
|
||||
import openai
|
||||
from pathlib import Path
|
||||
from colorama import Fore
|
||||
from dotenv import load_dotenv
|
||||
|
|
@ -81,7 +89,7 @@ def handleLune(filename, estimate):
|
|||
with LOCK:
|
||||
TOKENS[0] += translatedData[1][0]
|
||||
TOKENS[1] += translatedData[1][1]
|
||||
except Exception as e:
|
||||
except Exception:
|
||||
return 'Fail'
|
||||
|
||||
return getResultString(['', TOKENS, None], end - start, 'TOTAL')
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
import sys, os, traceback
|
||||
import sys
|
||||
import os
|
||||
import traceback
|
||||
from concurrent.futures import ThreadPoolExecutor, as_completed
|
||||
from colorama import Fore
|
||||
from tqdm import tqdm
|
||||
|
|
@ -13,7 +15,7 @@ for env in ['api','key','organization','model','language','timeout','fileThreads
|
|||
tqdm.write(Fore.RED + f'Environment variable {env} is not set!')
|
||||
envMissing = True
|
||||
if envMissing:
|
||||
tqdm.write(Fore.RED + f'Some of the required environment values may not be set correctly. You can set \
|
||||
tqdm.write(Fore.RED + 'Some of the required environment values may not be set correctly. You can set \
|
||||
these values using an .env file, for an example see .env.example')
|
||||
|
||||
from modules.rpgmakermvmz import handleMVMZ
|
||||
|
|
|
|||
|
|
@ -1,6 +1,13 @@
|
|||
# Libraries
|
||||
import json
|
||||
import os, re, textwrap, threading, time, traceback, tiktoken, openai
|
||||
import os
|
||||
import re
|
||||
import textwrap
|
||||
import threading
|
||||
import time
|
||||
import traceback
|
||||
import tiktoken
|
||||
import openai
|
||||
from pathlib import Path
|
||||
from colorama import Fore
|
||||
from dotenv import load_dotenv
|
||||
|
|
@ -98,7 +105,7 @@ def handleOnscripter(filename, estimate):
|
|||
with LOCK:
|
||||
TOKENS[0] += translatedData[1][0]
|
||||
TOKENS[1] += translatedData[1][1]
|
||||
except Exception as e:
|
||||
except Exception:
|
||||
traceback.print_exc()
|
||||
return 'Fail'
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,12 @@
|
|||
# Libraries
|
||||
import os, re, textwrap, threading, time, traceback, tiktoken, openai
|
||||
import os
|
||||
import re
|
||||
import textwrap
|
||||
import threading
|
||||
import time
|
||||
import traceback
|
||||
import tiktoken
|
||||
import openai
|
||||
from pathlib import Path
|
||||
from colorama import Fore
|
||||
from dotenv import load_dotenv
|
||||
|
|
@ -88,7 +95,7 @@ def handleRegex(filename, estimate):
|
|||
with LOCK:
|
||||
TOKENS[0] += translatedData[1][0]
|
||||
TOKENS[1] += translatedData[1][1]
|
||||
except Exception as e:
|
||||
except Exception:
|
||||
traceback.print_exc()
|
||||
return 'Fail'
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,13 @@
|
|||
# Libraries
|
||||
import json, os, re, textwrap, threading, time, traceback, tiktoken, openai
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
import textwrap
|
||||
import threading
|
||||
import time
|
||||
import traceback
|
||||
import tiktoken
|
||||
import openai
|
||||
from concurrent.futures import ThreadPoolExecutor, as_completed
|
||||
from pathlib import Path
|
||||
from colorama import Fore
|
||||
|
|
|
|||
|
|
@ -1,5 +1,13 @@
|
|||
# Libraries
|
||||
import json, os, re, textwrap, threading, time, traceback, tiktoken, openai
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
import textwrap
|
||||
import threading
|
||||
import time
|
||||
import traceback
|
||||
import tiktoken
|
||||
import openai
|
||||
from concurrent.futures import ThreadPoolExecutor, as_completed
|
||||
from pathlib import Path
|
||||
from colorama import Fore
|
||||
|
|
@ -650,7 +658,7 @@ def searchNames(data, pbar, context):
|
|||
if len(nameList) == len(translatedNameBatch):
|
||||
j = k
|
||||
with open('translations.txt', 'a', encoding='utf-8') as file:
|
||||
file.write(f'# Items\n')
|
||||
file.write('# Items\n')
|
||||
while j < i:
|
||||
# Empty Data
|
||||
if data[j] is None or data[j]['name'] == "":
|
||||
|
|
|
|||
|
|
@ -1,6 +1,13 @@
|
|||
# Libraries
|
||||
import json
|
||||
import os, re, textwrap, threading, time, traceback, tiktoken, openai
|
||||
import os
|
||||
import re
|
||||
import textwrap
|
||||
import threading
|
||||
import time
|
||||
import traceback
|
||||
import tiktoken
|
||||
import openai
|
||||
from pathlib import Path
|
||||
from colorama import Fore
|
||||
from dotenv import load_dotenv
|
||||
|
|
@ -90,7 +97,7 @@ def handlePlugin(filename, estimate):
|
|||
with LOCK:
|
||||
TOKENS[0] += translatedData[1][0]
|
||||
TOKENS[1] += translatedData[1][1]
|
||||
except Exception as e:
|
||||
except Exception:
|
||||
traceback.print_exc()
|
||||
return 'Fail'
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,12 @@
|
|||
# Libraries
|
||||
import os, re, textwrap, threading, time, traceback, tiktoken, openai
|
||||
import os
|
||||
import re
|
||||
import textwrap
|
||||
import threading
|
||||
import time
|
||||
import traceback
|
||||
import tiktoken
|
||||
import openai
|
||||
from pathlib import Path
|
||||
from colorama import Fore
|
||||
from dotenv import load_dotenv
|
||||
|
|
@ -93,7 +100,7 @@ def handleTyrano(filename, estimate):
|
|||
with LOCK:
|
||||
TOKENS[0] += translatedData[1][0]
|
||||
TOKENS[1] += translatedData[1][1]
|
||||
except Exception as e:
|
||||
except Exception:
|
||||
traceback.print_exc()
|
||||
return 'Fail'
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,13 @@
|
|||
# Libraries
|
||||
import json, os, re, textwrap, threading, time, traceback, tiktoken, openai
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
import textwrap
|
||||
import threading
|
||||
import time
|
||||
import traceback
|
||||
import tiktoken
|
||||
import openai
|
||||
from concurrent.futures import ThreadPoolExecutor, as_completed
|
||||
from pathlib import Path
|
||||
from colorama import Fore
|
||||
|
|
|
|||
|
|
@ -1,6 +1,13 @@
|
|||
# Libraries
|
||||
import json
|
||||
import os, re, textwrap, threading, time, traceback, tiktoken, openai
|
||||
import os
|
||||
import re
|
||||
import textwrap
|
||||
import threading
|
||||
import time
|
||||
import traceback
|
||||
import tiktoken
|
||||
import openai
|
||||
from pathlib import Path
|
||||
from colorama import Fore
|
||||
from dotenv import load_dotenv
|
||||
|
|
@ -89,7 +96,7 @@ def handleWOLF2(filename, estimate):
|
|||
with LOCK:
|
||||
TOKENS[0] += translatedData[1][0]
|
||||
TOKENS[1] += translatedData[1][1]
|
||||
except Exception as e:
|
||||
except Exception:
|
||||
traceback.print_exc()
|
||||
return 'Fail'
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue