feat: rework default entries
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user