Skip to content

Commit 48993d4

Browse files
committed
removed patching
1 parent e460773 commit 48993d4

File tree

3 files changed

+20
-64
lines changed

3 files changed

+20
-64
lines changed

datumaro/components/environment.py

-5
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212

1313
from datumaro.components.cli_plugin import CliPlugin, plugin_types
1414
from datumaro.components.format_detection import RejectionReason, detect_dataset_format
15-
from datumaro.components.wrappers import wrap_importer
1615
from datumaro.util.os_util import import_foreign_module, split_path
1716

1817
T = TypeVar("T")
@@ -227,10 +226,6 @@ def _register_plugins(self, plugins):
227226
self.transforms.batch_register(plugins)
228227
self.validators.batch_register(plugins)
229228

230-
for key in self.importers:
231-
importer = self.importers.get(key)
232-
wrap_importer(importer)
233-
234229
def make_extractor(self, name, *args, **kwargs):
235230
return self.extractors.get(name)(*args, **kwargs)
236231

datumaro/components/extractor.py

+20-5
Original file line numberDiff line numberDiff line change
@@ -415,6 +415,17 @@ def get(self, id, subset=None):
415415

416416

417417
class Importer(CliPlugin):
418+
def __init__(self):
419+
self.__not_found_error_data = {"ext": "", "filename": ""}
420+
421+
@property
422+
def _not_found_error_data(self):
423+
return self.__not_found_error_data
424+
425+
@_not_found_error_data.setter
426+
def _not_found_error_data_setter(self, val):
427+
self.__not_found_error_data = val
428+
418429
@classmethod
419430
def detect(
420431
cls,
@@ -433,17 +444,17 @@ def find_sources(cls, path) -> List[Dict]:
433444
def find_sources_with_params(cls, path, **extra_params) -> List[Dict]:
434445
return cls.find_sources(path)
435446

436-
@classmethod
437-
def _generate_not_found_error(self, path):
438-
return DatasetNotFoundError(path)
439-
440447
def __call__(self, path, **extra_params):
441448
if not path or not osp.exists(path):
442449
raise DatasetNotFoundError(path)
443450

444451
found_sources = self.find_sources_with_params(osp.normpath(path), **extra_params)
445452
if not found_sources:
446-
raise self._generate_not_found_error(path)
453+
raise DatasetNotFoundError(
454+
path,
455+
self._not_found_error_data.get("ext", ""),
456+
self._not_found_error_data.get("filename", ""),
457+
)
447458

448459
sources = []
449460
for desc in found_sources:
@@ -508,6 +519,10 @@ def _find_sources_recursive(
508519
)
509520
if sources:
510521
break
522+
523+
if not sources:
524+
cls._not_found_error_data = {"ext": ext, "filename": filename}
525+
511526
return sources
512527

513528

datumaro/components/wrappers.py

-54
This file was deleted.

0 commit comments

Comments
 (0)