Fire can't find custom `__str__` of `~datasets.Dataset` from HuggingFace
- 主要语言
- Python
- 星标
- 28.2k
- 派生
- 1.5k
- PR 合并指标
- 30 天内没有已合并 PR
描述
Hi,
I am using fire on a `main` function that returns a `~datasets.Dataset` object. When running from cli, I get the help screen for `~datasets.Dataset` rather than the `__str__` implementation (likely inherited from a parent class -- haven't looked).
## Reproducible example
```python
from datasets import Dataset
import fire
def main():
# Create a simple dataset
dataset = Dataset.from_dict({"a": [1, 2, 3], "b": [4, 5, 6]})
return dataset
if __name__ == "__main__":
fire.Fire(main)
# This works but I feel shouldn't be necessary:
# def custom_serializer(obj: object) -> str:
# if hasattr(obj, "__str__"):
# return str(obj)
# else:
# return ""
# fire.Fire(main, serialize=custom_serializer)
```
贡献指南
调研方向
Start with the reproducible main function and the fire.Fire(main) entry point, then compare the default output for the returned Dataset with the behavior when serialize=custom_serializer is supplied. Trace how Fire serializes returned objects and determine what completion should look like for objects with a custom __str__ implementation.
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- python
- 领域
- cli
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 45/100