Make a Converter without the default hook factories
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
调研方向
The payload names no files. Start with the fallback-hook-factories section of the docs and the unstructure_fallback_factory and structure_fallback_factory arguments of Converter, to see how a child converter consults its parent. Then check why the default structure_attrs_fromdict preference overrides the parent's hook. The issue is open on which approach to take (a BaseConverter workaround or new __init__ flags), so agree on a design with maintainers first. Done means a child converter uses a hook registered on its parent even when a default hook exists.
由索引模型根据 Issue 内容生成。
描述
The problem
Let's take the fallback-hook-factories section
parent = Converter()
child = Converter(
unstructure_fallback_factory=parent.get_unstructure_hook,
structure_fallback_factory=parent.get_structure_hook,
)
Let's say in parent you added another custom hook factory such as
@parent.register_structure_hook_factory(lambda val: issubclass(val, Foo))
def structure_Foo(cls) -> StructureHook:
...
You would expect that the child would pick up this new converter of the parent, but that is not the case if there is already a way to structure Foo from the default converters in Converter
So what now?
One way around this is to use BaseConverter I guess, but it is not quite that straightforward and trying it out I still hit some other preferences that override it, e.g. structure_attrs_fromdict.
Another option would be to have flags in the __init__ of those converters to truely not add any defaults and let it fallback to the parent more directly.
- 主要语言
- Python
- 星标
- 1.1k
- 派生
- 171
- 平均合并
- 14 小时 46 分钟
- 30 天内合并 PR
- 5
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
python-attrs/cattrs 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 72/100
python-attrs/cattrs#796 ·
维护者通常 1 天内回复
-
decimal.Decimal not handled in preconf converters (json, pyyaml)可能已有人在做 @Binilkks 于 112 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 72/100
python-attrs/cattrs#761 · 2 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 64/100
python-attrs/cattrs#513 · 4 条评论 ·
维护者通常 1 天内回复
-
难度 3/5 1-2 天 新手友好度 62/100
python-attrs/cattrs#797 ·
维护者通常 1 天内回复
-
难度 3/5 半天 新手友好度 64/100
python-attrs/cattrs#795 ·
维护者通常 1 天内回复
查看 python-attrs/cattrs 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 72/100
PolicyEngine/policyengine-us#10262 ·
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 74/100
kellyjonbrazil/jc#788 ·
维护者通常 2 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
`/search.json` ignores the documented `editions.sort` parameter可能已有人在做 @PranavD2905 今天认领。 未关闭Affects: Server Good First Issue Module: Solr Needs: Triage Theme: Public APIs Theme: Search
难度 2/5 1-3 小时 新手友好度 74/100
internetarchive/openlibrary#13989 · 1 条评论 ·
维护者通常 1 天内回复
-
bug P2: misleading query
难度 2/5 1-3 小时 新手友好度 62/100
jeffknupp/association#478 ·