Rename Method allows rename functions using datamodels function names

Offen
#833 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 2 Tagen

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Anfängerfreundlichkeit
55/100
Issue-Typ
Bug
Klarheit
Klar beschrieben
Aktivitätsstatus
Veraltet
Tech-Stack
python
Bereich
devtools

Rechercherichtung

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.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

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)
Vorherrschende Sprache
Python
Sterne
2.2k
Forks
197
Ø Merge
1 T. 20 Std.
Gemergte PRs (30 T.)
7

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus python-rope/rope

Alle Issues in python-rope/rope

Ähnliche Issues

Weitere Issues zu Python

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.