Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

`box_from_file` returns `ruamel.yaml.scalarfloat.ScalarFloat` instead of `float` for floating-point values

オープン
#264 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

@vinson0522 がすでに取り組んでいます。

2026年8月14日 から。

  • #321 @vinson0522 による — オープン

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
45/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
python
領域
data

調査の方向性

box_from_file エントリポイントから始め、Float 値を含む YAML MRE を再現し、その後、ruamel YAML のスカラー値がどのように保持されるかを追跡します。完了条件は、読み込まれた値と Box.to_dict() の結果が組み込みの float 型を使用することです。リポジトリのテスト構造から適切な場所が特定できる場合は、回帰テストを追加または更新してください。

索引モデルが issue の本文から書いたものです。

説明

bug

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 はありません

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

cdgriffith/Box のほかの issue

cdgriffith/Box の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。