def test_with_question_mark_wildcard_matching(self): f1 = 'source_code.py' f2 = 's.py' includes = ['?.py'] t1 = included(f1, includes) t2 = included(f2, includes) self.assertEqual((t1, t2), (False, True))
def traverse_files(in_out, includes): """ Traverse the source directory, and send each file to convert. Without lost of the directory structure. """ s_root = in_out[0] o_root = in_out[1] ignores = get_ignores() # Apply the ignore list for dir_name, sub_dir_name, file_list in os.walk(s_root): # Ignore some sub directories, e.g. source code control for ig in ignores: match = re.search(ig, dir_name, re.IGNORECASE) if match: break else: subdir = get_subdir_name(s_root, dir_name) if subdir: # Create sub directories to preserve the original structure create_subdir(o_root, subdir) for f in file_list: if not included(f, includes): continue # Only do convert on included files if subdir: convert(dir_name, f, os.path.join(o_root, subdir)) else: convert(dir_name, f, os.path.join(o_root)) clean_vimrc(vimrc_file)
def test_with_star_wildcard_matching(self): f = 'source_code.py' includes = ['*.py'] self.assertTrue(included(f, includes))