Skip to content

Commit

Permalink
Minor refactor of Fs.defaultShouldIgnore
Browse files Browse the repository at this point in the history
  • Loading branch information
arjun-menon committed Aug 3, 2024
1 parent 6901e21 commit 9f57dfa
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions alteza/fs.py
Original file line number Diff line number Diff line change
Expand Up @@ -441,8 +441,7 @@ def isHidden(name: str) -> bool:
return name.startswith(".")

@staticmethod
def defaultShouldIgnore(name: str, parentPath: str, isDir: bool) -> bool:
# pylint: disable=unused-argument
def shouldIgnoreStandard(name: str) -> bool:
if Fs.isHidden(name):
return True
if name in {"__pycache__"}:
Expand All @@ -452,10 +451,19 @@ def defaultShouldIgnore(name: str, parentPath: str, isDir: bool) -> bool:
return True
if name != Fs.configFileName and fileExt == ".py":
return True
return False

@staticmethod
def defaultShouldIgnore(name: str, parentPath: str, isDir: bool) -> bool:
# pylint: disable=unused-argument
if Fs.shouldIgnoreStandard(name):
return True

fullPath = os.path.abspath(os.path.join(parentPath, name))
for ignoreAbsPath in Fs.ignoreAbsPaths:
if ignoreAbsPath in fullPath:
return True

return False

@staticmethod
Expand Down

0 comments on commit 9f57dfa

Please sign in to comment.