コード例 #1
0
def parse_one_file(relative_file_path):

    with open(".files_list.txt", "a") as files_list:
        abs_file_path = "{}{}".format(tools.data_dir(), relative_file_path)
        if tools.is_exist(abs_file_path):
            files_list.write("{}\n".format(abs_file_path))
        else:
            print("{} DOES NOT EXIST!".format(abs_file_path))
コード例 #2
0
def parse_one_BSM(BSM_relative_path):

    with open(".files_list.txt", "a") as files_list:
        BSM_abs_path = "{}{}/".format(tools.data_dir(), BSM_relative_path)
        if tools.is_exist(BSM_abs_path):
            list_of_files = tools.directory_objects_parser(
                BSM_abs_path, tools.RAW_FILE_REGULAR_PATTERN).split()
            for file_relative_path in list_of_files:
                files_list.write("{}{}\n".format(BSM_abs_path,
                                                 file_relative_path))
        else:
            print("{} DOES NOT EXIST!".format(BSM_abs_path))
コード例 #3
0
def parse_all_data():

    with open(".files_list.txt", "a") as files_list:

        list_of_days = tools.directory_objects_parser(
            "{}".format(tools.data_dir()), tools.DAY_REGULAR_PATTERN).split()
        for day_relative_path in list_of_days:
            day_abs_path = "{}/{}/".format(tools.data_dir(), day_relative_path)
            list_of_BSM = tools.directory_objects_parser(
                day_abs_path, tools.BSM_REGULAR_PATTERN).split()
            for BSM_relative_path in list_of_BSM:
                BSM_abs_path = "{}{}/".format(day_abs_path, BSM_relative_path)
                list_of_files = tools.directory_objects_parser(
                    BSM_abs_path, tools.RAW_FILE_REGULAR_PATTERN).split()
                for file_relative_path in list_of_files:
                    files_list.write("{}{}\n".format(BSM_abs_path,
                                                     file_relative_path))


# =============================================================================
#
# =============================================================================
コード例 #4
0
def parse_one_tail(tail_relative_path):

    with open(".files_list.txt", "a") as files_list:
        day_and_tail_name = tail_relative_path.split('.')
        day_abs_path = "{}{}".format(tools.data_dir(), day_and_tail_name[0])
        list_of_BSM = tools.directory_objects_parser(
            day_abs_path, tools.BSM_REGULAR_PATTERN).split()
        for BSM_relative_path in list_of_BSM:
            BSM_abs_path = "{}{}/".format(day_abs_path, BSM_relative_path)
            list_of_files = tools.directory_objects_parser(
                BSM_abs_path, "{}{}$".format(tools.TAIL_FILE_REGULAR_PATTERN,
                                             day_and_tail_name[1])).split()
            for file_relative_path in list_of_files:
                files_list.write("{}{}\n".format(BSM_abs_path,
                                                 file_relative_path))