precice / precice/python-bindings
Improve errors from `convert` function
まだ誰も着手していません。
- 主要言語
- Cython
- スター
- 30
- フォーク
- 19
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
The error return by the convert function is not helpful at the moment. I stumbled over this when I organized my participant names in an Enum
class ParticipantNames(Enum):
MASS_LEFT = "Mass-Left"
MASS_RIGHT = "Mass-Right"
One has to pass, for example, ParticipantNames.MASS_LEFT.value to the API. But I forgot the .values part, which led to an errors similar to
>>> precice.Interface(1,2,3,4)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "cyprecice/cyprecice.pyx", line 87, in cyprecice.Interface.__cinit__
File "cyprecice/cyprecice.pyx", line 24, in cyprecice.convert
TypeError: Could not convert.
I think it would be good to tell the user which type was received from the API and which types are supported here. If I would have known that I provided a <enum 'ParticipantNames'> instead of a <class 'str'> this would have helped me a lot debugging.
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
cyprecice/cyprecice.pyx の convert 関数(15-24 行目)から始め、文字列が想定されている箇所に Enum メンバーを渡して失敗を再現します。受け取った型とサポートされている型を示すようにエラーの挙動を更新し、その後、結果のメッセージを issue の Interface の例と照合します。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- python
- 領域
- api
- issue の種類
- バグ
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 活発さ
- 活発
- 明瞭さ
- 明確に書かれている
- 初心者へのやさしさ
- 78/100