python - google fire 自动运行@property
问题描述
我使用google fire进行 cli,并在下面遇到了一个问题。
# test.py
import fire
class C:
@property
def foo(self):
print('foo')
def bar(self):
print('bar')
fire.Fire()
然后运行为
python test.py C bar
foo
bar
看到它打印出不需要的“foo”,有什么优雅的方法可以解决这个问题吗?
解决方案
我已经通过将fire
版本更新到 3.x解决了这个问题。
推荐阅读
- amazon-web-services - AWS KCL C# 不处理记录
- r - 根据分类变量过滤曲线图
- php - 当我尝试在 PHP + GD 库中添加图像时,文本消失了
- javascript - 为什么在使用自动完成功能更改 place_changed 后拖动标记后反向地理编码不起作用?
- postgresql - 如何在 Nixos 上安装 postgresql-client / psql
- python - Django 查询 ForeignKeys 以返回“分组依据”列表
- javascript - 角度“未捕获的错误:区域已加载”
- ms-access - VBA 取消发送由 Gmail 发送的电子邮件
- python - 在 Python 中将两个单独的列表组合成一个列表
- csv - 如何使用 ConvertRecord 和 CSVRecordSetWriter 在 Apache NiFi 中输出标头(无数据)?