Inline method refactoring inserts an unexpected argument
Les mainteneurs répondent en général sous 2 jours
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Accessibilité débutants
- 35/100
Piste de recherche
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.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
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")
- Langage dominant
- Python
- Étoiles
- 2.2k
- Forks
- 197
- Merge moyen
- 1 j 20 h
- PR mergées (30 j)
- 7
Préparer son environnement
- Aucun Dockerfile ni fichier Docker Compose
- Propose un modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de python-rope/rope
-
Difficulté 1/5 1-3 heures Accessibilité débutants 88/100
python-rope/rope#927 ·
Les mainteneurs répondent en général sous 2 jours
-
Extract raises IndexError or ModuleSyntaxError instead of RefactoringError for an empty or whitespace-only regionPeut-être pris @aliassar l’a pris il y a 2 jours. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
python-rope/rope#926 ·
Les mainteneurs répondent en général sous 2 jours
-
simplify.real_code blanks t-strings, so renames inside them edit the wrong offsetPeut-être pris @sean0407 l’a pris il y a 12 jours. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 83/100
python-rope/rope#913 ·
Les mainteneurs répondent en général sous 2 jours
-
bug
Difficulté 4/5 3-5 jours Accessibilité débutants 48/100
python-rope/rope#935 ·
Les mainteneurs répondent en général sous 2 jours
-
Difficulté 4/5 3-5 jours Accessibilité débutants 30/100
python-rope/rope#925 ·
Les mainteneurs répondent en général sous 2 jours
Toutes les issues de python-rope/rope
Issues similaires
-
fuzz fuzz-unconfirmed
Difficulté 2/5 1-3 heures Accessibilité débutants 70/100
Les mainteneurs répondent en général sous 1 jour
-
ready-for-agent
Difficulté 2/5 1-3 heures Accessibilité débutants 86/100
neilsh/stunt-reel#220 ·
Les mainteneurs répondent en général sous 1 jour
-
[Issue]: use_fp4_cache is accepted but ignored; the launcher always writes FP8 recordsPeut-être pris @0z5a l’a pris aujourd’hui. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
Les mainteneurs répondent en général sous 1 jour
-
area: cli priority: p3 size: S type: bug
Difficulté 2/5 1-3 heures Accessibilité débutants 83/100
finos/open-resource-broker#757 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 65/100
Les mainteneurs répondent en général sous 6 jours