Rename Method allows rename functions using datamodels function names

Aberta
#833 0 comentários 0 reações 0 responsáveis Ver no GitHub

Mantenedores costumam responder em até 2 dias

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
3/5
Tempo estimado
1-2 dias
Facilidade para iniciantes
55/100
Tipo de issue
Bug
Clareza
Claramente especificada
Status de atividade
Estagnada
Stack de tecnologia
python
Domínio
devtools

Direção de pesquisa

The payload gives a reproduction: applying Rename Method to Soma.total turns the method into __str__, which breaks print(s) and makes s.__str__() return a number. It does not name the rope source files, so start by finding the rename method's implementation in the repository. Check how it validates new names, and whether it refuses names that match Python data-model (dunder) methods. Done means that renaming to a dunder name is rejected or handled, and that a test covers the Soma example.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

bug

Rename Method allows rename functions using datamodels function names

Steps to reproduce the behavior:

  1. Code before refactoring:
class Soma:
    def __init__(self, a, b):
        self.a = a
        self.b = b

    def total(self):
        return self.a + self.b

s = Soma(2, 3)
print(s.total())
print(s)
  1. Apply the rename method to Soma.total

  2. Code after refactoring:

class Soma:
    def __init__(self, a, b):
        self.a = a
        self.b = b

    def __str__(self):
        return self.a + self.b

s = Soma(2, 3)
print(s.__str__())
print(s)
Linguagem predominante
Python
Estrelas
2.2k
Forks
197
Merge médio
1d 20h
PRs com merge (30d)
7

Preparar o ambiente

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de python-rope/rope

Todas as issues de python-rope/rope

Issues semelhantes

Mais issues de Python

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.