Convert schema-like objects to dataclasses
還沒有人認領這個 Issue。
評估
研究方向
先檢視 constants.py 中的平行字典,尤其是 formula term system,以及 issue 中連結的 CF-supported Parametric Vertical Coordinates 區段。搭配 issue #942 探查程式碼庫中的其他類似 schema 的物件,並且只考慮具有真正實用 consumer 的候選項;當值得處理的案例都具備明確的、基於 dataclass 的 schemas,且沒有過度設計時,即可視為完成。
由索引模型根據 Issue 內容生成。
描述
As well as incorporating enumerations (see #942), there are objects in the codebase where we could convert to further data classes in order to better encode and handle their schema-like nature. Though we should only do so if a genuinely useful case for the logic using them, to avoid over-engineering.
An immediate example I see is from the parallel dictionaries in the constants module, e.g. the formula term system, where the same key space for the CF-supported Parametric Vertical Coordinates are spread across four parallel dicts which each define constraints set out in Appendix D of the CF Conventions:
and where conversion to data classes of a template similar to the following would make the underlying schema explicit and improve readability/maintainability:
from dataclasses import dataclass
@dataclass(frozen=True)
class FormulaDefinition:
standard_names: dict
units: dict
max_dimensions: dict
computed_standard_names: dict
But we can systematically survey the codebase for further candidates, ideally at the same time as we plan #942.
- 主要語言
- Python
- 星號
- 151
- 分支
- 23
- PR 合併指標
- 30 天內沒有已合併 PR
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 沒有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
NCAS-CMS/cf-python 的其他 Issue
-
documentation missing (404 errors)可能已有人在做 @davidhassell 於 1 天前認領。 未關閉bug documentation
難度 2/5 1-3 小時 新手友好度 72/100
-
question
難度 3/5 1-2 天 新手友好度 55/100
-
installation
難度 4/5 3-5 天 新手友好度 45/100
-
Attempt at unsupported conservative 3D mesh regridding可能重新可做 @sadielbartholomew 於 58 天前認領,目前沒有進行中的 PR。 未關閉bug?
-
bug
難度 3/5 1-2 天 新手友好度 45/100
查看 NCAS-CMS/cf-python 的全部 Issue
相似的 Issue
-
難度 2/5 1-3 小時 新手友好度 82/100
aws-samples/sample-per-model-bedrock#795 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 74/100
維護者通常 1 天內回覆
-
Pretalx reports older version to be the latest release than what is actually installed and available未關閉
難度 2/5 1-3 小時 新手友好度 68/100
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 70/100
維護者通常 1 天內回覆
-
bug
難度 2/5 1-3 小時 新手友好度 75/100
micropython/micropython#19906 ·
維護者通常 1 天內回覆