def _process_paths(self):
for path in self.path_list:
if os.path.isfile(path):
self._process(path)
elif os.path.isdir(path):
for root, dirs, files in os.walk(path):
for filename in fnmatch.filter(files, self.extension):
self._process(os.path.join(root, filename))
else:
raise TypeError('%s should be either dir or file' % path)
if self.pretend:
logging.info('No actual changes was done, run without \'-p\' to overwrite source files')
logging.info('%d files processed' % self.files_processed)
评论列表
文章目录