@@ -615,7 +615,7 @@ def fix_code(source, additional_imports=None, expand_star_imports=False,
615
615
remove_duplicate_keys = remove_duplicate_keys ,
616
616
remove_unused_variables = remove_unused_variables ,
617
617
ignore_init_module_imports = ignore_init_module_imports ,
618
- ))))
618
+ ))))
619
619
620
620
if filtered_source == source :
621
621
break
@@ -647,7 +647,7 @@ def fix_file(filename, args, standard_out):
647
647
remove_duplicate_keys = args .remove_duplicate_keys ,
648
648
remove_unused_variables = args .remove_unused_variables ,
649
649
ignore_init_module_imports = ignore_init_module_imports ,
650
- )
650
+ )
651
651
652
652
if original_source != filtered_source :
653
653
if args .in_place :
@@ -745,18 +745,25 @@ def is_python_file(filename):
745
745
return True
746
746
747
747
748
- def match_file (filename , exclude ):
749
- """Return True if file is okay for modifying/recursing ."""
748
+ def is_exclude_file (filename , exclude ):
749
+ """Return True if file matches exclude pattern ."""
750
750
base_name = os .path .basename (filename )
751
751
752
752
if base_name .startswith ('.' ):
753
- return False
753
+ return True
754
754
755
755
for pattern in exclude :
756
756
if fnmatch .fnmatch (base_name , pattern ):
757
- return False
757
+ return True
758
758
if fnmatch .fnmatch (filename , pattern ):
759
- return False
759
+ return True
760
+ return False
761
+
762
+
763
+ def match_file (filename , exclude ):
764
+ """Return True if file is okay for modifying/recursing."""
765
+ if is_exclude_file (filename , exclude ):
766
+ return False
760
767
761
768
if not os .path .isdir (filename ) and not is_python_file (filename ):
762
769
return False
@@ -777,7 +784,8 @@ def find_files(filenames, recursive, exclude):
777
784
if match_file (os .path .join (root , d ),
778
785
exclude )]
779
786
else :
780
- yield name
787
+ if not is_exclude_file (name , exclude ):
788
+ yield name
781
789
782
790
783
791
def _main (argv , standard_out , standard_error ):
0 commit comments