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') ])
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()
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()
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)