fix(choose_sentence): 미사용된 코드주석 및 테스트 코드 제거

This commit is contained in:
kdh8219 2023-12-22 22:07:45 +09:00
parent c6de8dd789
commit 12f40fc30f
Signed by: kdh8219
GPG key ID: 9B901BE907D1862E

View file

@ -8,25 +8,20 @@ from dotenv import load_dotenv
load_dotenv() load_dotenv()
_sentences=[] _sentences=[]
# try: try:
sentence_files=[] sentence_files=[]
if os.environ.get("SENTENCES_FILE") and os.path.isfile(os.environ["SENTENCES_FILE"]): if os.environ.get("SENTENCES_FILE") and os.path.isfile(os.environ["SENTENCES_FILE"]):
sentence_files.append(os.environ["SENTENCE_FILES"]) sentence_files.append(os.environ["SENTENCE_FILES"])
if os.environ.get("SENTENCES_DIRECTORY") and os.path.isdir(os.environ["SENTENCES_DIRECTORY"]): if os.environ.get("SENTENCES_DIRECTORY") and os.path.isdir(os.environ["SENTENCES_DIRECTORY"]):
sentence_files.extend(glob(f'{os.environ["SENTENCES_DIRECTORY"]}*.txt')) sentence_files.extend(glob(f'{os.environ["SENTENCES_DIRECTORY"]}*.txt'))
# for (dirpath, dirnames, filenames) in os.walk(os.environ["SENTENCES_DIRECTORY"]):
# for filename in filenames:
# sentence_files.append(filename)
print(sentence_files)
for sentence_file in sentence_files: for sentence_file in sentence_files:
with open(sentence_file, "r") as f: with open(sentence_file, "r") as f:
_sentences.extend(f.readlines()) _sentences.extend(f.readlines())
# except: except:
# e = sys.exc_info()[1] e = sys.exc_info()[1]
# _sentences = [f"에러발생(진짜임): {e}"] _sentences = [f"에러발생(진짜임): {e}"]
# choose random sentence in google spread sheet # choose random sentence in google spread sheet
def chooseSentence() -> str: def chooseSentence() -> str: