google / google/python-fire

Simple string argument is Converted to integer because input only contains numeric data

未關閉
#453 2 則留言 6 個 reaction 已指派 0 人 在 GitHub 檢視
主要語言
Python
星號
28.2k
分支
1.5k
PR 合併指標
30 天內沒有已合併 PR

描述

A simple argument is automatically converted to integer because the input only has numeric data in a string. I wondered if it is a wanted feature. Thank you

Python3 version = Pyton3.8.10
Fire version = 0.5

file sample.py
```Python3
import fire
from fire import Fire

print(fire.__version__)

def sample(sequence:str):
print(sequence, type(sequence))

Fire(sample)
```
```bash
$ python3 ./sample.py "00"
0.5.0
0
```

Expected behavior: "00" string type

貢獻指南

開啟貢獻指南

研究方向

使用 sample.py 範例和命令 `python3 ./sample.py "00"` 重現轉換流程。追蹤 Python Fire 的 CLI 引數解析和轉換邏輯,以找出為什麼這個值會變成整數;當能夠將 "00" 保留為字串,並為回報的行為新增涵蓋測試時,即視為完成。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
python
領域
cli
Issue 類型
缺陷
難度
3/5
預估耗時
1-2 天
活躍度
停滯
描述清晰度
基本清楚
新手友好度
45/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。