feat: rework default entries

This commit is contained in:
2023-03-15 10:26:33 +03:00
parent 9345b27aef
commit 23ca8c0cac
14 changed files with 101 additions and 116 deletions
+6 -3
View File
@@ -1,5 +1,5 @@
from pathlib import Path
from typing import Iterable, Optional, Type
from typing import Iterable, List, Optional, Type
from .entry import Entry
@@ -21,11 +21,14 @@ class EntryDetector:
class EntryResolver:
def __init__(self, detector: EntryDetector):
def __init__(self, detector: EntryDetector, ignore: List[str]):
self._detector = detector
self._ignore = ignore
def resolve(self, basepath: Path, depth: int = 2) -> Iterable[Entry]:
def resolve(self, basepath: Path, depth: int = 128) -> Iterable[Entry]:
if basepath.is_dir():
if basepath.name in self._ignore:
return
entry = self._detector.detect(basepath)
if entry:
yield entry