コード例 #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
ファイル: common.py プロジェクト: jiaorenyu/learning
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
ファイル: common.py プロジェクト: jiaorenyu/learning
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)