Application.print_alias_help() should take into account *any* Configurable class
- 主要语言
- Python
- 星标
- 653
- 派生
- 217
- 平均合并
- 2 天 21 小时
- 30 天内合并 PR
- 2
描述
It seems to me that in both the current release and the master version (where the code has been moved to emit_alias_help), the case where an alias refers to a class that is *not* in the inheritance hierarchy for a given instance will throw an error. Luckily, one can *use* such aliases (I do in my own projects, it's a nice way to share configurations between classes), it's just one can't print help.
The relevant code in master is (lines 389-393 in config/application.py):
```
classdict = {}
for cls in self.classes:
# include all parents (up to, but excluding Configurable) in available names
for c in cls.mro()[:-3]:
classdict[c.__name__] = c
```
贡献指南
调研方向
Start in config/application.py at lines 389-393 and compare print_alias_help() with its master equivalent, emit_alias_help. Trace how aliases are mapped to configurable classes, especially when the target is outside an instance's inheritance hierarchy. Done means help prints aliases for any Configurable class without raising an error.
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- python
- 领域
- cli
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 38/100