Exemple #1
0
    def parse_file(self, type_name, file_name):
        stage = None
        match = re.search("\d{3}", file_name)
        if match is not None:
            span = match.span()
            stage = file_name[span[0]:span[1]]
            stage = str(int(stage))

        GSI_INTE = None
        match = re.search("K\d\+\d{3}[-~](K\d\+)?\d{3}", file_name)
        if match is not None:
            span = match.span()
            GSI_INTE = file_name[span[0]:span[1]]
            if "-" in GSI_INTE:
                GSI_INTE = GSI_INTE.split("-")
                pre = GSI_INTE[0][:3]
                GSI_INTE[1] = pre + GSI_INTE[1]
                GSI_INTE = "~".join(GSI_INTE)
        else:
            match = re.search("LS1 \d\+\d{3}[-~](LS1 \d\+)?\d{3}", file_name)
            if match is not None:
                span = match.span()
                GSI_INTE = file_name[span[0]:span[1]]
                if "-" in GSI_INTE:
                    GSI_INTE = GSI_INTE.split("-")
                    pre = GSI_INTE[0][:3]
                    GSI_INTE[1] = pre + GSI_INTE[1]
                    GSI_INTE = "~".join(GSI_INTE)
            else:
                GSI_INTE = ""

        prefix = util.map_prefix(util.parse_prefix(file_name))

        return type_name + prefix + stage + "期" + GSI_INTE
Exemple #2
0
    def parse_file(self, type_name, file_name):
        stage = None
        match = re.search("\d{3}", file_name)
        if match is not None:
            span = match.span()
            stage = file_name[span[0]: span[1]]
            stage = str(int(stage))

        SKTH_INTE = None
        match = re.search("K\d\+\d{3}[-~](K\d\+)?\d{3}", file_name)
        if match is not None:
            span = match.span()
            SKTH_INTE = file_name[span[0]: span[1]]
            if "-" in SKTH_INTE:
                SKTH_INTE = SKTH_INTE.split("-")
                pre = SKTH_INTE[0][: 3]
                SKTH_INTE[1] = pre + SKTH_INTE[1]
                SKTH_INTE = "~".join(SKTH_INTE)

        prefix = util.map_prefix(util.parse_prefix(file_name))
        
        return type_name + prefix + stage + "期" + SKTH_INTE