`box_from_file` returns `ruamel.yaml.scalarfloat.ScalarFloat` instead of `float` for floating-point values
評価
調査の方向性
box_from_file エントリポイントから始め、Float 値を含む YAML MRE を再現し、その後、ruamel YAML のスカラー値がどのように保持されるかを追跡します。完了条件は、読み込まれた値と Box.to_dict() の結果が組み込みの float 型を使用することです。リポジトリのテスト構造から適切な場所が特定できる場合は、回帰テストを追加または更新してください。
索引モデルが issue の本文から書いたものです。
説明
When I load a Box from a YAML file, the floating-pont values are represented as a type from the ruamel YAML library, and not cast to the builtin float type. This resulted in a difficult bug (as without explicitly calling type() on it, it is rendered visually as a float) where these are being improperly serialised when interacting with another library, as it doesn't know how to handle them. This happens even if I convert the box to a builtin dictionary with Box.to_dict().
MRE:
Float: 0.1
import box
float = box.box_from_file('Float.yaml')
print( float.Float )
print(type(float.Float))
outputs
0.1
<class 'ruamel.yaml.scalarfloat.ScalarFloat'>
I assume it would be more appropriate for all types from YAML/JSON/etc that can be represented as builtin to be converted as part of the process.
I would look into this further, but my debugger seems to refuse to step into the function or hit any manually-added breakpoints - I see .pyi and C wrappers, so looks like it might be implemented internally in C.
Thanks
- 主要言語
- Python
- スター
- 2.8k
- フォーク
- 145
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
cdgriffith/Box のほかの issue
-
subclass of `Box` does not unpickle correctly対応中かも @koriyoshi2041 が 142 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
cdgriffith/Box#308 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 42/100
cdgriffith/Box#307 · コメント 1 件 ·
-
Dotted keys read from YAML are lost with box_dots / default_box対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 3/5 1〜2日 初心者へのやさしさ 48/100
cdgriffith/Box#305 ·
-
[Bug] Camel killer box and box dots gives unexpected behaviour対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 3/5 1〜2日 初心者へのやさしさ 30/100
cdgriffith/Box#300 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 42/100
cdgriffith/Box#298 ·
似ている issue
-
documentation good first issue help wanted
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
drevendev/HungryCrab#273 ·
メンテナーはふだん 1 日以内に返信
-
good first issue help wanted
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
drevendev/BeautifulRepo#19 ·
メンテナーはふだん 2 日以内に返信
-
Moonshot: Kimi K3 always sends `reasoning_effort="max"`, though the API now accepts `low` and `high`オープンaccepted
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
UKGovernmentBEIS/inspect_ai#5939 ·
メンテナーはふだん 1 日以内に返信
-
bug linux
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
メンテナーはふだん 1 日以内に返信
-
area:data data-quality
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
reacher-z/Awesome-CUA#1468 ·
メンテナーはふだん 1 日以内に返信