The Inline Method removes an overridden method
メンテナーはふだん 7 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
Start by running the two-class snippet in the issue (WordList overriding append and extend) and confirm the before-and-after output differs. Then apply Inline Method to WordList.extend in rope and find where the inlining step decides which calls to keep. The issue does not name rope's internal files, so locate them from that entry point. Done means the inlined code still routes each element through the overridden append, so Word objects are still created.
索引モデルが issue の本文から書いたものです。
説明
The Inline Method removes an overridden method that changes the type of the stored objects.
Steps to reproduce the behavior:
- Code before refactoring:
class Word(str):
def __new__(cls, value):
print(f"criando Word({value!r})")
return super().__new__(cls, value)
class WordList(list):
def append(self, obj):
print(f"append: recebi {obj!r} (type={type(obj).__name__})")
if isinstance(obj, str) and not isinstance(obj, Word):
obj = Word(obj)
super().append(obj)
def extend(self, iterable):
print("extend (custom): chamando append para cada elemento")
for e in iterable:
self.append(e)
wl = WordList()
wl.extend(["ola", "mundo"])
print("conteúdo wl:", wl)
print("types wl:", [type(x).__name__ for x in wl])
-
Apply the inline method to
WordList.extend -
Code after refactoring:
class Word(str):
def __new__(cls, value):
print(f"criando Word({value!r})")
return super().__new__(cls, value)
class WordList(list):
def append(self, obj):
print(f"append: recebi {obj!r} (type={type(obj).__name__})")
if isinstance(obj, str) and not isinstance(obj, Word):
obj = Word(obj)
super().append(obj)
wl = WordList()
wl.extend(["ola", "mundo"])
print("conteúdo wl:", wl)
print("types wl:", [type(x).__name__ for x in wl])
- 主要言語
- Python
- スター
- 2.2k
- フォーク
- 197
- 平均マージ
- 2日 13時間
- マージ済み PR(30日)
- 5
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
python-rope/rope のほかの issue
-
難易度 1/5 1〜3時間 初心者へのやさしさ 88/100
python-rope/rope#927 ·
メンテナーはふだん 7 日以内に返信
-
Extract raises IndexError or ModuleSyntaxError instead of RefactoringError for an empty or whitespace-only region対応中かも @aliassar が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
python-rope/rope#926 ·
メンテナーはふだん 7 日以内に返信
-
simplify.real_code blanks t-strings, so renames inside them edit the wrong offset対応中かも @sean0407 が 11 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 83/100
python-rope/rope#913 ·
メンテナーはふだん 7 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 30/100
python-rope/rope#925 ·
メンテナーはふだん 7 日以内に返信
-
Extract method/variable and introduce parameter don't check whether the new name is already in useオープン
難易度 3/5 1〜2日 初心者へのやさしさ 62/100
python-rope/rope#924 ·
メンテナーはふだん 7 日以内に返信
python-rope/rope の issue をすべて見る
似ている issue
-
DBFS append mode silently overwrites existing files対応中かも @IlyaKhalafi が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
fsspec/filesystem_spec#2429 ·
メンテナーはふだん 1 日以内に返信
-
[Bug]: Retrieval rerank fallback statistics stay zero after provider failure対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
volcengine/OpenViking#7014 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
fedora-copr/copr#4600 ·
メンテナーはふだん 2 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
ansys/pydpf-core#3620 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信