google / google/python-fire

Fire can't find custom `__str__` of `~datasets.Dataset` from HuggingFace

Aberta
#595 1 comentário 0 reações 0 responsáveis Ver no GitHub
Linguagem predominante
Python
Estrelas
28.2k
Forks
1.5k
Métricas de merge de PRs
Nenhum PR com merge em 30d

Descrição

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)
```

Guia de contribuição

Abrir o guia de contribuição

Avaliação

Esta issue ainda não foi avaliada.

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.