reduced unnecessary import when being used as lib

This commit is contained in:
Tony Yang 2020-10-03 17:19:05 +08:00 committed by GitHub
parent 5f9ca1e79e
commit 50befcc2fa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,9 +1,5 @@
import argparse
import zipfile
import opencc
import glob
import time
from io import BytesIO
from pathlib import Path
# only initailize OpenCC once, or it would be very slow
@ -45,6 +41,11 @@ def s2t(text):
return converter.convert(text)
if __name__ == "__main__":
import argparse
import glob
import time
from io import BytesIO
parser = argparse.ArgumentParser(description="Convert simplified chinese to traditional chinese in epub.")
parser.add_argument('file', nargs='+', help="epub files")
args = parser.parse_args()