Skip to content

Commit f36dc28

Browse files
committed
Fix erraneous changes to target
1 parent 40fb8be commit f36dc28

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

dissect/target/target.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ def name(self) -> str:
269269
return target_name
270270

271271
@classmethod
272-
def open(cls, path: str | Path) -> Self:
272+
def open(cls, path: str | Path, *, apply: bool = True) -> Self:
273273
"""Try to find a suitable loader for the given path and load a ``Target`` from it.
274274
275275
Args:
@@ -307,7 +307,7 @@ def open(cls, path: str | Path) -> Self:
307307
except Exception as e:
308308
raise TargetError(f"Failed to initiate {loader_cls.__name__} for target {spec}: {e}") from e
309309

310-
return cls._load(spec, loader_instance)
310+
return cls._load(spec, loader_instance, apply=apply)
311311

312312
@classmethod
313313
def open_raw(cls, path: str | Path, *, apply: bool = True) -> Self:
@@ -320,7 +320,9 @@ def open_raw(cls, path: str | Path, *, apply: bool = True) -> Self:
320320
return cls._load(path, loader.RawLoader(adjusted_path), apply=apply)
321321

322322
@classmethod
323-
def open_all(cls, paths: str | Path | list[str | Path], include_children: bool = False) -> Iterator[Self]:
323+
def open_all(
324+
cls, paths: str | Path | list[str | Path], include_children: bool = False, *, apply: bool = True
325+
) -> Iterator[Self]:
324326
"""Yield all targets from one or more paths or directories.
325327
326328
If the path is a directory, iterate files one directory deep.
@@ -415,7 +417,7 @@ def _open_all(spec: str | Path, include_children: bool = False, *, apply: bool =
415417
for spec in paths:
416418
loaded = False
417419

418-
for target in _open_all(spec, include_children=include_children):
420+
for target in _open_all(spec, include_children=include_children, apply=apply):
419421
loaded = True
420422
at_least_one_loaded = True
421423
yield target
@@ -436,7 +438,7 @@ def _open_all(spec: str | Path, include_children: bool = False, *, apply: bool =
436438

437439
if path.is_dir():
438440
for entry in path.iterdir():
439-
for target in _open_all(entry, include_children=include_children):
441+
for target in _open_all(entry, include_children=include_children, apply=apply):
440442
at_least_one_loaded = True
441443
yield target
442444

0 commit comments

Comments
 (0)