Inline method refactoring inserts an unexpected argument
メンテナーはふだん 7 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
Start by reproducing the Inline Method refactoring on Word.translate in blob.py, using the call in test.py as the target. The bad output is the __0__from_lang keyword in the inlined call, so look at how rope builds argument names when it substitutes call-site arguments. Done when the inlined call reads translate_to('string', from_lang='auto', to_lang="es") with no extra argument.
索引モデルが issue の本文から書いたものです。
説明
Inline method refactoring inserts an unexpected argument in the method call.
Steps to reproduce the behavior:
- Code before refactoring:
structure:
-- main
---- __init__.py
---- blob.py
-- test
---- __init__.py
---- test.py
blob.py:
class Word(str):
def translate_to(self, source, from_lang='auto', to_lang='en', host=None):
pass
def translate(self, from_lang='auto', to="en"):
return self.translate_to('string', from_lang=from_lang, to_lang=to)
test.py:
import main as tb
from unittest import TestCase
class WordTest(TestCase):
def test_translate(self, mock_translate):
mock_translate.return_value = 'gato'
assert_equal(tb.Word("cat").translate(to="es"), "gato")
-
Apply the Inline Method refactoring to the 'Word.translate' in 'blob.py'
-
Expected code after refactoring:
blob.py:
class Word(str):
def translate_to(self, source, from_lang='auto', to_lang='en', host=None):
pass
test.py:
import main as tb
from unittest import TestCase
class WordTest(TestCase):
def test_translate(self, mock_translate):
mock_translate.return_value = 'gato'
assert_equal(tb.Word("cat").translate_to('string', __0__from_lang='auto', to_lang="es"), "gato")
- 主要言語
- 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
-
bug ready-for-dev
難易度 1/5 1〜3時間 初心者へのやさしさ 92/100
OpenHands/extensions#897 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
tensorflow/datasets#11253 ·
メンテナーはふだん 1 日以内に返信
-
fix(core): a config section with all keys commented out crashes startup対応中かも @Aryanbhargava18 が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
kubeflow/mcp-server#512 ·
メンテナーはふだん 1 日以内に返信
-
Stop trusting the compromised eMudhra CA certificates対応中かも @anth-volk が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
PolicyEngine/uk-triple-lock#54 ·
メンテナーはふだん 1 日以内に返信
-
DBFS append mode silently overwrites existing files対応中かも @IlyaKhalafi が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
fsspec/filesystem_spec#2429 ·
メンテナーはふだん 1 日以内に返信