File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change 38
38
import sys
39
39
import tokenize
40
40
import warnings
41
+ import fnmatch
41
42
42
43
import six
43
44
@@ -105,6 +106,13 @@ def _merge_stats(stats):
105
106
merged ['by_msg' ] = by_msg
106
107
return merged
107
108
109
+ def _explore_dir (filepat , top ):
110
+ file_names = []
111
+ for (path , _ , filelist ) in os .walk (top ):
112
+ for name in fnmatch .filter (filelist , filepat ):
113
+ full_name = os .path .join (path , name )
114
+ file_names .append (full_name )
115
+ return file_names
108
116
109
117
@contextlib .contextmanager
110
118
def _patch_sysmodules ():
@@ -726,6 +734,18 @@ def check(self, files_or_modules):
726
734
"""main checking entry: check a list of files or modules from their
727
735
name.
728
736
"""
737
+ temp_files_or_modules = []
738
+
739
+ for file in files_or_modules :
740
+ #If it is a directory, then fetch all files present inside it.
741
+ if os .path .isdir (file ):
742
+ file_list = _explore_dir ("*.py" , file )
743
+ temp_files_or_modules .extend (file_list )
744
+ else :
745
+ temp_files_or_modules .append (file )
746
+
747
+ files_or_modules = temp_files_or_modules
748
+
729
749
# initialize msgs_state now that all messages have been registered into
730
750
# the store
731
751
for msg in self .msgs_store .messages :
You can’t perform that action at this time.
0 commit comments