Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
martinRenou committed Jun 6, 2024
1 parent 0d5fff6 commit 7dee0e6
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions empack/file_patterns.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def match(self, path):


class FileFilter:
def __init__(self, include_patterns=None, exclude_patterns=None):
def __init__(self, exclude_patterns=None):
def patter_from_dict(**d):
if "pattern" in d:
return UnixPattern(**d)
Expand All @@ -35,11 +35,10 @@ def patter_from_dict(**d):
self.exclude_patterns = [patter_from_dict(**p) for p in exclude_patterns]

def match(self, path):
include = True
for ep in self.exclude_patterns:
if ep.match(path):
return False
return include
return True


class PkgFileFilter:
Expand All @@ -57,10 +56,8 @@ def __init__(self, packages=None, default=None):
if isinstance(v, dict):
exclude_patterns = default_exclude_patterns
if "exclude_patterns" in v:
exclude_patterns = exclude_patterns + default_exclude_patterns
exclude_patterns = exclude_patterns + v["exclude_patterns"]
self.packages[k] = FileFilter(exclude_patterns=exclude_patterns)
elif isinstance(v, list):
self.packages[k] = [FileFilter(**x) for x in v]
else:
err = f"invalid value for package {k}: {v}"
raise ValueError(err)
Expand Down

0 comments on commit 7dee0e6

Please sign in to comment.