fix(core): Remove old directory state logic

- Remove code forcing the exclusion of `.` directories by default, the
  new default exclusion filters do this by default
- Change default state code to always return a value
Andrew Senetar 7 months ago
parent e41c91623c
commit 6d8b86b7eb
Signed by: arsenetar
GPG Key ID: C63300DCE48AB2F1

@ -84,10 +84,11 @@ class Directories:
for denied_path_re in self._exclude_list.compiled:
if denied_path_re.match(str(
return DirectoryState.EXCLUDED
# return # We still use the old logic to force state on hidden dirs
return DirectoryState.NORMAL
# Override this in subclasses to specify the state of some special folders.
return DirectoryState.EXCLUDED
return DirectoryState.NORMAL
def _get_files(self, from_path, fileclasses, j):
@ -214,7 +215,7 @@ class Directories:
# direct match? easy result.
if path in self.states:
return self.states[path]
state = self._default_state_for_path(path) or DirectoryState.NORMAL
state = self._default_state_for_path(path)
# Save non-default states in cache, necessary for _get_files()
if state != DirectoryState.NORMAL:
self.states[path] = state

@ -326,6 +326,7 @@ def test_default_path_state_override(tmpdir):
def _default_state_for_path(self, path):
if "foobar" in
return DirectoryState.EXCLUDED
return DirectoryState.NORMAL
d = MyDirectories()
p1 = Path(str(tmpdir))