Skip to content

Commit 5a58280

Browse files
committed
refactor: not to raise exceptions or warnings
Signed-off-by: ktro2828 <kotaro.uetake@tier4.jp>
1 parent 89e4469 commit 5a58280

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

t4_devkit/tier4.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,14 +86,9 @@ def load_metadata(db_root: str, revision: str | None = None) -> DBMetadata:
8686
version = None
8787
data_root = db_root_path.as_posix()
8888
else:
89-
if int(revision) not in version_candidates:
90-
raise ValueError(f"The version: {revision} is not included in {dataset_id}")
9189
version = revision
9290
data_root = db_root_path.joinpath(version).as_posix()
9391

94-
if version is None:
95-
warnings.warn(f"{dataset_id} does't contain any versions.", DeprecationWarning)
96-
9792
return DBMetadata(data_root=data_root, dataset_id=dataset_id, version=version)
9893

9994

@@ -149,6 +144,11 @@ def __init__(
149144
if not osp.exists(self.data_root):
150145
raise FileNotFoundError(f"Database directory is not found: {self.data_root}")
151146

147+
if self.version is None:
148+
warnings.warn(
149+
f"DatasetID: {self.dataset_id} does't contain any versions.", DeprecationWarning
150+
)
151+
152152
start_time = time.time()
153153
if verbose:
154154
print(f"======\nLoading T4 tables in `{self.schema_dir}`...")

0 commit comments

Comments
 (0)