Copy is not deep for weakrefs in subnetworks
メンテナーはふだん 1 日以内に返信
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 85/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- python
- 領域
- backend, testing-qa
調査の方向性
test_network.py にある既存のテストから始め、提供されている ac_dc_network fixture を使って問題を再現します。Network.copy() が Subnetwork オブジェクトとその親参照をどのように扱うかを追跡します。テストがパスすれば完了です。コピーされた subnetworks は別個のオブジェクトで、その n 参照はコピーされたネットワークを指し、元のオブジェクトは引き続き元のネットワークを参照します。
索引モデルが issue の本文から書いたものです。
説明
Version Checks (indicate both or one)
-
I have confirmed this bug exists on the lastest release of PyPSA.
-
I have confirmed this bug exists on the current
masterbranch of PyPSA.
Issue Description
Following #1889, copying a pypsa network first removes the weakref and then re-binds the reference to the parent network inside a Subnetwork. This re-binding uses the original network object, so the copy contains a reference to the original. This behavior results in all sorts of subtle errors when working with the copy.
Reproducible Example
"""Based on the test in test_network.py"""
def test_copy_relinks_sub_networks(ac_dc_network):
"""Copying relinks SubNetwork parent references to the copied network."""
n = ac_dc_network
n.determine_network_topology()
n_copy = n.copy()
for name in n.c.sub_networks.static.index:
sub = n.c.sub_networks.static.obj.loc[name]
sub_copy = n_copy.c.sub_networks.static.obj.loc[name]
assert sub is not sub_copy
assert sub.n is n
assert sub_copy.n is n_copy
Expected Behavior
The test above should succeed.
Installed Versions
- 主要言語
- Python
- スター
- 2.2k
- フォーク
- 712
- 平均マージ
- 1日 9時間
- マージ済み PR(30日)
- 38
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
PyPSA/PyPSA のほかの issue
-
Ramp limits of a fixed modular committable unit scale with p_nom times the number of running modulesオープンoperational realism optimization
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
メンテナーはふだん 1 日以内に返信
-
breaking components API data validation high priority needs triage
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信
-
Docs list e_sum_min/e_sum_max constraints for Links and Processes, which do not exist対応中かも @FabianHofmann が 6 日前に担当しました。 オープンdocumentation optimization
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信
-
n.add of a single component spends half its time on default-column inserts and the unknown-bus isin対応中かも @MaykThewessen が 5 日前に担当しました。 オープン
難易度 3/5 1〜2日 初心者へのやさしさ 35/100
メンテナーはふだん 1 日以内に返信
-
needs triage
難易度 4/5 3〜5日 初心者へのやさしさ 54/100
メンテナーはふだん 1 日以内に返信
似ている issue
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
huggingface/smolagents#2976 ·
メンテナーはふだん 1 日以内に返信
-
bug Triage-Needed
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
FuRongJun-1999/dsh-memory#170 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
pgvector/pgvector-python#163 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 82/100
521xueweihan/HelloGitHub#3940 ·