-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Description
Summary
#168 doesn't seem to have fully implemented #89.
Example
Contents of example script
#!/usr/bin/env python
from dataclasses import dataclass
from pathlib import Path
from fgpyo.util.metric import Metric
@dataclass(frozen=True, kw_only=True)
class MyMetric(Metric["MyMetric"]):
foo: str
bar: str | None
example_tsv: Path = Path("example.tsv")
with example_tsv.open("w") as fout:
fout.write("foo\tbar\n")
fout.write("hello\tworld\n")
fout.write("hola\t\n")
metrics: list[MyMetric] = list(MyMetric.read(example_tsv))
$ pixi add python=3.12 fgpyo=1.3.0
$ pixi run ./example.py
Traceback (most recent call last):
File "/Users/msto/code/scratch/fgpyo/./example.py", line 20, in <module>
metrics: list[MyMetric] = list(MyMetric.read(example_tsv))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/msto/code/scratch/.pixi/envs/default/lib/python3.12/site-packages/fgpyo/util/metric.py", line 286, in read
instance: Metric[MetricType] = inspect.attr_from(
^^^^^^^^^^^^^^^^^^
File "/Users/msto/code/scratch/.pixi/envs/default/lib/python3.12/site-packages/fgpyo/util/inspect.py", line 467, in attr_from
set_value
AssertionError: Do not know how to convert string to str | None for value: world
Metadata
Metadata
Assignees
Labels
No labels