Skip to content

Commit

Permalink
Merge pull request #2 from oratio-io/ByteCommander-patch-2
Browse files Browse the repository at this point in the history
Shortened code
  • Loading branch information
thomas-daniels committed Jun 25, 2015
2 parents b512eaf + 2c4c77a commit 316df38
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions oratioignoreparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,12 @@ def __init__(self):

def load(self, oratio_ignore_path):
with open(oratio_ignore_path, "r") as f:
for line in f:
self.ignored_paths.append(line.strip())
self.ignored_paths.extend([line.strip() for line in f])

def should_be_ignored(self, filepath):
for ig in self.ignored_paths:
compiled_regex = re.compile('^' + re.escape(ig).replace('\\*', '.*') + '$')
if compiled_regex.search(filepath):
return True
elif compiled_regex.search(filepath.split('/')[-1]):
if compiled_regex.search(filepath) or compiled_regex.search(filepath.split('/')[-1]):
return True
return False

Expand Down

0 comments on commit 316df38

Please sign in to comment.