State.wipe() with no arguments raises TypeError instead of clearing state
メンテナーはふだん 3 日以内に返信
評価
調査の方向性
burr/core/state.py の440行目付近にある State.wipe() から始め、メソッドが delete と keep をどのように処理するかを読みます。issue の例で報告された失敗を再現し、その後、引数なしの wipe() を対象とするテストがあるか確認します。呼び出しが TypeError を発生させずに空の状態を返せば完了です。
索引モデルが issue の本文から書いたものです。
説明
What happens
wipe() says that calling it with no arguments deletes the whole state. When both delete and keep are None, the code skips the delete branch and runs [key for key in self._state if key not in keep] with keep=None. Python's in operator raises TypeError on None, so the call fails before anything is deleted. I read this from the code only. I did not run it.
Where
To reproduce
from burr.core.state import State
state = State({"a": 1, "b": 2})
assert state.wipe().get_all() == {}
Expected
State({"a": 1, "b": 2}).wipe() returns an empty state.
Actual
Raises TypeError (argument of type 'NoneType' is not iterable), based on the code path above. Not run.
assert state.wipe().get_all() == {}
~~~~~~~~~~^^
File "/Users/alibb/.ali-hq/work/gh/apache__burr/burr/core/state.py", line 440, in wipe
fields_to_delete = [key for key in self._state if key not in keep]
^^^^^^^^^^^^^^^
TypeError: argument of type 'NoneType' is not a container or iterable
Checked on cdea4eb.
- 主要言語
- Python
- スター
- 2.6k
- フォーク
- 218
- 平均マージ
- 4日 8時間
- マージ済み PR(30日)
- 35
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
apache/burr のほかの issue
-
Redis and Postgres persister integration tests fail when re-run against the same databases対応中かも @YongGoose が今日担当しました。 オープンstatus/needs-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 3 日以内に返信
-
Notebook UI launcher should use the current Python interpreter対応中かも @sivakumar-mahalingam が 21 日前に担当しました。 オープンstatus/needs-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
メンテナーはふだん 3 日以内に返信
-
astep() passes unprocessed inputs to pre_run_step hooks対応中かも @sivakumar-mahalingam が 21 日前に担当しました。 オープンstatus/needs-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 3 日以内に返信
-
`burr` fails to start when the Python path has a space in it対応中かも @enekoreto が 24 日前に担当しました。 オープンstatus/needs-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 3 日以内に返信
-
area/storage area/ui help wanted kind/documentation priority/low
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 3 日以内に返信
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
-
needs-triage tooling
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
neilsh/stunt-reel#317 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
TandoorRecipes/recipes#4926 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
PyTomography/PyTomography#431 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
igormcsouza/tether#278 ·
メンテナーはふだん 1 日以内に返信