Output of the example for grouping in docs is wrong
- 主要語言
- Python
- 星號
- 28.2k
- 分支
- 1.5k
- PR 合併指標
- 30 天內沒有已合併 PR
描述
Hello.
In the Group Commands section (https://github.com/google/python-fire/blob/master/docs/guide.md#grouping-commands), the example code is
```python
class IngestionStage(object):
def run(self):
return 'Ingesting! Nom nom nom...'
class DigestionStage(object):
def run(self, volume=1):
return ' '.join(['Burp!'] * volume)
def status(self):
return 'Satiated.'
class Pipeline(object):
def __init__(self):
self.ingestion = IngestionStage()
self.digestion = DigestionStage()
def run(self):
self.ingestion.run()
self.digestion.run()
return 'Pipeline complete'
if __name__ == '__main__':
fire.Fire(Pipeline)
```
and according to the guide
```bash
$ python example.py run
Ingesting! Nom nom nom...
Burp!
```
However, the output is wrong. It should be
```bash
$ python example.py run
Pipeline complete
```
This can be easily fixed.
However, in order to demonstrate the pipeline functionality, I would suggest to change the example to
```python
class IngestionStage(object):
def run(self):
return 'Ingesting! Nom nom nom...'
class DigestionStage(object):
def run(self, volume=1):
return ' '.join(['Burp!'] * volume)
def status(self):
return 'Satiated.'
class Pipeline(object):
def __init__(self):
self.ingestion = IngestionStage()
self.digestion = DigestionStage()
def run(self):
ingestion_output = self.ingestion.run()
digestion_output = self.digestion.run()
return ingestion_output + digestion_output
if __name__ == '__main__':
fire.Fire(Pipeline)
```
and accordingly the output should be
```bash
$ python example.py run
Ingesting! Nom nom nom...Burp!
```
I would like to know which change @dbieber would like.
Thank you.
貢獻指南
研究方向
閱讀 docs/guide.md 中的 Group Commands 區段,並將文件中的 Python 範例與執行 python example.py run 的輸出進行比較。向 maintainer 確認範例應顯示 Pipeline complete,還是應示範中間階段的輸出,然後一致地更新程式碼和預期輸出。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- python
- 領域
- documentation
- Issue 類型
- 文件
- 難度
- 2/5
- 預估耗時
- 1-3 小時
- 活躍度
- 停滯
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100