Example #1
0
 def __init__(self, **kwargs):
     self.company_code = kwargs["company_code"]
     self.company_name = kwargs["company_name"]
     self.start_date = Formatter.change_date_string_format(kwargs["청약공고일"])
     self.payment_date = Formatter.change_date_string_format(kwargs["납입기일"])
     self.security_company_set = [
         SecurityCompany(**security_company)
         for security_company in kwargs["security_company_data"]
     ]
     self.max_price_band = kwargs["max_price_band"]
     self.min_price_band = kwargs["min_price_band"]
     self.price = kwargs.get("price", 0)
     self.receipt_num = kwargs["receipt_num"]
Example #2
0
    def spider_closed(self, spider) -> None:
        self.logger.info("Spider closed. Starting formatter")

        f = Formatter()
        f(self.lang, "npc")

        self.logger.info("Formatting done!")
Example #3
0
    def spider_closed(self, spider):
        self.logger.info("Spider closed. Starting formatter...")

        f = Formatter()
        f(self.lang, "xp")

        self.logger.info("Formatting done!")
Example #4
0
    def spider_closed(self, spider):
        self.logger.info("Spider closed.")

        f = Formatter()
        f(self.lang, "quest")

        m = Merger(self.lang, "Quests")
        m()
        self.logger.info("New lookup file at '{}'".format(m.lang_dir))
Example #5
0
    def spider_closed(self, spider):
        self.logger.info("Spider closed. Starting formatter...")

        f = Formatter()
        f(self.lang, "npc")
        f(self.lang, "quest")

        self.logger.info("Formatting done!")
        m = Merger(self.lang)
        m()
        self.logger.info("Merging done. New lookup file at '{}'".format(m.lang_dir))
Example #6
0
    def __init__(self, logger_name='framework'):
        self.BASE_PATH = os.path.split(os.path.dirname(os.path.abspath(__file__)))[0]
        self.LOG_PATH = os.path.join(self.BASE_PATH, 'log/log')
        self.logger = logging.getLogger(logger_name)
        logging.root.setLevel(logging.NOTSET)
        self.log_file_name = 'test.log'
        self.backup_count = 5
        # 日志输出级别
        self.console_output_level = 'WARNING'
        self.file_output_level = 'DEBUG'

        # 日志输出格式
        self.formatter = Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s", "%Y-%m-%dT%H:%M:%S%z")
Example #7
0
    def main(self, file, argvs):
        path = sys.path[0]

        print("****************************")
        print(file)
        res = jsbeautifier.beautify_file(file)
        preFile = "preformat_" + file
        op = open(preFile, "w+")
        op.write(res)
        op.close()

        oFileContent = getContent(preFile)
        formatFile = Formatter()
        formatFile.formatter(file, oFileContent)

        fFile = "formatted_" + file
        fFileContent = getContent(fFile)

        isAbnormal = False
        isHighRisk = False
        mergeFile = Merge()
        isAbnormal, isHighRisk = mergeFile.mergeReduce(file, fFileContent,
                                                       argvs)
        print(isAbnormal, isHighRisk)

        srcProcessedPath = path + "/" + file
        if not isAbnormal and not isHighRisk:
            #classify processible contract
            classify = Classifier()
            mFile = "merged_" + file
            mFileContent = getContent(mFile)
            isProcessible = classify.classifier(mFileContent)
            print(isProcessible)
            srcProcessiblePath = path + "/" + mFile
            if isProcessible:
                dstProcessiblePath = path + "/Processible/" + mFile
                shutil.copy(srcProcessiblePath, dstProcessiblePath)
                print(
                    mFile,
                    " is processible and has been put in the Processible directory."
                )
                os.remove(srcProcessiblePath)
            else:
                os.remove(srcProcessiblePath)
            desProcessedPath = path + "/ProcessedContracts/" + file
            noteStr = "ProcessedContracts"
        elif not isAbnormal and isHighRisk:
            desProcessedPath = path + "/varRepeatContracts/" + file
            noteStr = "varRepeatContracts"
        elif isAbnormal and not isHighRisk:
            desProcessedPath = path + "/abnormalContracts/" + file
            noteStr = "abnormalContracts"

        shutil.copy(srcProcessedPath, desProcessedPath)
        print(file, " has been moved to the " + noteStr + " directory.")

        #remove formatted contract
        formattedFile = path + "/" + fFile
        os.remove(formattedFile)
        os.remove(preFile)
        os.remove(srcProcessedPath)
Example #8
0
from utils.formatter import Formatter

if __name__ == '__main__':
    formatter = Formatter()
    formatter("ko", "quest")
def test_parse(program_file: str, debug: bool = False):
    program = read_file(program_file)
    ast = parse(program, debug)
    formater = Formatter()
    print(formater.visit(ast, 0))    
Example #10
0
    def spider_closed(self, spider):
        self.logger.info("Spider closed.")

        f = Formatter()
        f(self.lang, "quest")