From d8f500b73b59025a5da16c05e6fdd7d91f46f779 Mon Sep 17 00:00:00 2001 From: Dnomd343 Date: Thu, 15 Dec 2022 18:40:43 +0800 Subject: [PATCH] update: run check as function --- src/punctuation/check.py | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/src/punctuation/check.py b/src/punctuation/check.py index 2b239e9..5627c96 100755 --- a/src/punctuation/check.py +++ b/src/punctuation/check.py @@ -104,24 +104,17 @@ def existCheck(sentence: str) -> bool: def contentCheck(content: list) -> None: - flag = True - for row in content: # pairs check - flag &= pairsCheck(row) - if not flag: - print('-' * 128) # split line - - flag = True - for row in content: # ending check - flag &= endingCheck(row) - if not flag: - print('-' * 128) # split line - - flag = True - for row in content: # exist check - flag &= existCheck(row) - if not flag: - print('-' * 128) # split line + def runCheck(checkFunc) -> None: + flag = True + for row in content: + flag &= checkFunc(row) # run check function + if not flag: # with output + print('-' * 128) # show split line + + runCheck(pairsCheck) + runCheck(endingCheck) + runCheck(existCheck) contentCheck(loadContent(sys.argv[1]))