Skip to content

Commit

Permalink
refine tables list building
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzocerrone committed Oct 14, 2024
1 parent ada080e commit f416062
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/ngio/tables/tables_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
"""

from typing import Literal
from warnings import warn

import zarr
from pydantic import ValidationError

from ngio.io import StoreLike
from ngio.pydantic_utils import BaseWithExtraFields
Expand Down Expand Up @@ -134,9 +136,15 @@ def list(
list_of_typed_tables = []
for table_name in list_of_tables:
table = self._group[table_name]
common_meta = CommonMeta(**table.attrs)
if common_meta.type == table_type:
list_of_typed_tables.append(table_name)
try:
common_meta = CommonMeta(**table.attrs)
if common_meta.type == table_type:
list_of_typed_tables.append(table_name)
except ValidationError:
warn(
f"Table {table_name} metadata is not correctly formatted.",
stacklevel=1,
)
return list_of_typed_tables

def get_table(
Expand Down

0 comments on commit f416062

Please sign in to comment.