diff options
author | Florent Xicluna <florent.xicluna@gmail.com> | 2012-06-13 18:13:06 +0200 |
---|---|---|
committer | Florent Xicluna <florent.xicluna@gmail.com> | 2012-06-13 18:13:06 +0200 |
commit | 845b5196981660b9290b5b249ccead4dbe2782db (patch) | |
tree | 462e25a4201399c27262252f6f429690227a8398 | |
parent | 0811d09b12650e39735d44f56c0387df897a7a5b (diff) | |
download | pep8-845b5196981660b9290b5b249ccead4dbe2782db.tar.gz |
Reuse the helper filename_match.
-rwxr-xr-x | pep8.py | 9 |
1 files changed, 3 insertions, 6 deletions
@@ -1196,13 +1196,13 @@ def find_checks(argument_name): yield name, codes, function, args -def filename_match(filename, patterns): +def filename_match(filename, patterns, default=True): """ Check if patterns contains a pattern that matches filename. If patterns is unspecified, this always returns True. """ if not patterns: - return True + return default for pattern in patterns: if fnmatch(filename, pattern): return True @@ -1658,10 +1658,7 @@ class StyleGuide(object): Check if options.exclude contains a pattern that matches filename. """ basename = os.path.basename(filename) - for pattern in self.options.exclude: - if fnmatch(basename, pattern): - # print basename, 'excluded because it matches', pattern - return True + return filename_match(basename, self.options.exclude, default=False) def ignore_code(self, code): """ |