예제 #1
0
  def assert_contains_pdfs(self, directory):
    """Helper function that asserts a directory contains pdf files."""

    self.assertNotEmpty([
        fname for fname in file_util.list_files(directory)
        if fname.endswith('.pdf')
    ])
예제 #2
0
def split_shop(basedir, fn, action_type):
    shop_fp = dict()
    if len(file_util.list_files(basedir)) != 0:
        return

    with open(fn) as fp:
        for line in fp:
            st, shop_id, day = parse_user_action(line)
            if st:
                write_shop(basedir, shop_fp, shop_id, day, action_type)

    for _,fp in shop_fp.items():
        fp.close()
예제 #3
0
def split_shop(basedir, fn, action_type):
    shop_fp = dict()
    if len(file_util.list_files(basedir)) != 0:
        return

    with open(fn) as fp:
        for line in fp:
            st, shop_id, day = parse_user_action(line)
            if st:
                write_shop(basedir, shop_fp, shop_id, day, action_type)

    for _, fp in shop_fp.items():
        fp.close()
예제 #4
0
def handle_stat(split_dir, stat_dir):
    if len(file_util.list_files(stat_dir)) != 0:
        return
    file_list = file_util.list_files(split_dir)
    for fn in file_list:
        stat(fn, stat_dir)
예제 #5
0
def handle_stat(split_dir, stat_dir):
    if len(file_util.list_files(stat_dir)) != 0:
        return
    file_list = file_util.list_files(split_dir)
    for fn in file_list:
        stat(fn, stat_dir)