Inline method refactoring inserts an unexpected argument
Mantenedores costumam responder em até 7 dias
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 4/5
- Tempo estimado
- 3-5 dias
- Facilidade para iniciantes
- 35/100
Direção de pesquisa
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.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
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")
- Linguagem predominante
- Python
- Estrelas
- 2.2k
- Forks
- 197
- Merge médio
- 2d 13h
- PRs com merge (30d)
- 5
Preparar o ambiente
- Sem Dockerfile nem arquivo Docker Compose
- Tem um modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de python-rope/rope
-
Dificuldade 1/5 1-3 horas Facilidade para iniciantes 88/100
python-rope/rope#927 ·
Mantenedores costumam responder em até 7 dias
-
Extract raises IndexError or ModuleSyntaxError instead of RefactoringError for an empty or whitespace-only regionTalvez já em andamento @aliassar assumiu hoje. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
python-rope/rope#926 ·
Mantenedores costumam responder em até 7 dias
-
simplify.real_code blanks t-strings, so renames inside them edit the wrong offsetTalvez já em andamento @sean0407 assumiu há 10 dias. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 83/100
python-rope/rope#913 ·
Mantenedores costumam responder em até 7 dias
-
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 30/100
python-rope/rope#925 ·
Mantenedores costumam responder em até 7 dias
-
Extract method/variable and introduce parameter don't check whether the new name is already in useAberta
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 62/100
python-rope/rope#924 ·
Mantenedores costumam responder em até 7 dias
Todas as issues de python-rope/rope
Issues semelhantes
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 82/100
unionai-oss/pandera#2640 ·
Mantenedores costumam responder em até 2 dias
-
enhancement
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
JdeRobot/RoboticsInfrastructure#843 ·
Mantenedores costumam responder em até 1 dia
-
automated endpoint-dead needs-curation
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 62/100
almanac-data/climate-almanac#122 ·
Mantenedores costumam responder em até 1 dia
-
area:harness enhancement
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 75/100
evarness-ai/iris-harness#420 ·
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 85/100
suitenumerique/find#206 ·
Mantenedores costumam responder em até 2 dias