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()
_sentences=[]
# try:
sentence_files=[]
if os.environ.get("SENTENCES_FILE") and os.path.isfile(os.environ["SENTENCES_FILE"]):
sentence_files.append(os.environ["SENTENCE_FILES"])
try:
sentence_files=[]
if os.environ.get("SENTENCES_FILE") and os.path.isfile(os.environ["SENTENCES_FILE"]):
sentence_files.append(os.environ["SENTENCE_FILES"])
if os.environ.get("SENTENCES_DIRECTORY") and os.path.isdir(os.environ["SENTENCES_DIRECTORY"]):
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)
if os.environ.get("SENTENCES_DIRECTORY") and os.path.isdir(os.environ["SENTENCES_DIRECTORY"]):
sentence_files.extend(glob(f'{os.environ["SENTENCES_DIRECTORY"]}*.txt'))
print(sentence_files)
for sentence_file in sentence_files:
with open(sentence_file, "r") as f:
_sentences.extend(f.readlines())
# except:
# e = sys.exc_info()[1]
# _sentences = [f"에러발생(진짜임): {e}"]
for sentence_file in sentence_files:
with open(sentence_file, "r") as f:
_sentences.extend(f.readlines())
except:
e = sys.exc_info()[1]
_sentences = [f"에러발생(진짜임): {e}"]
# choose random sentence in google spread sheet
def chooseSentence() -> str: