Skip to content

Commit

Permalink
fix(metadata): remove feature attribute and update dtype
Browse files Browse the repository at this point in the history
- Removed feature attribute and its handling in __post_init__
- Changed dtype default from "dict" to None
- Adjusted __post_init__ to handle dtype "dict" case directly
  • Loading branch information
psmyth94 committed Nov 16, 2024
1 parent 5f6ea24 commit c334b5a
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions src/biosets/features/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,14 @@ class ValueWithMetadata(Value):
class Metadata:
"""Metadata features that can be used to describe the dataset."""

feature: Any = None
id: Optional[str] = None
dtype: str = "dict"
id: Optional[str] = None
# Automatically constructed
pa_type: ClassVar[Any] = None
_type: str = field(default="Metadata", init=False, repr=False)

def __post_init__(self):
if self.feature:
if isinstance(self.feature, Metadata):
self.pa_type = self.feature.pa_type
self.feature = self.feature.feature
elif self.dtype == "dict":
if self.dtype == "dict":
self.pa_type = pa.struct(
{
k: string_to_arrow(v["dtype"])
Expand Down

0 comments on commit c334b5a

Please sign in to comment.