From 9f57dfaab02513dd092d31b1e21681a7798c7ca9 Mon Sep 17 00:00:00 2001 From: "Arjun G. Menon" Date: Sat, 3 Aug 2024 03:02:46 -0400 Subject: [PATCH] Minor refactor of Fs.defaultShouldIgnore --- alteza/fs.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/alteza/fs.py b/alteza/fs.py index 67a3797..e1ef2d4 100644 --- a/alteza/fs.py +++ b/alteza/fs.py @@ -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__"}: @@ -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