Rename Method refactoring is allowed in methods of the descriptor protocol

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

Maintainer antworten meist innerhalb von 7 Tagen

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Anfängerfreundlichkeit
35/100
Issue-Typ
Bug
Klarheit
Größtenteils klar
Aktivitätsstatus
Veraltet
Tech-Stack
python
Bereich
tooling

Rechercherichtung

Start by reproducing the report: apply the Rename Method refactoring to __get__ in the three-line Descriptor class from the issue and confirm the method is renamed to value. The payload does not name the source files, so locate the Rename Method implementation in the rope package first. Done means dunder descriptor methods are either left unchanged or refused with a warning, and the issue's example produces the same code before and after.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

bug rename-refactor

Steps to reproduce the behavior:

  1. Code before refactoring:
class Descriptor:
    def __get__(self, instance, owner):
        return 40

  1. Apply the Rename Method refactoring to the method __get__.

  2. Expected code after refactoring: the same as the original. It would be nice if Rope could emit a warning that applying the refactoring to this type of class is not allowed.

Rope produces the result below:

class Descriptor:
    def value(self, instance, owner):
        return 40
Vorherrschende Sprache
Python
Sterne
2.2k
Forks
197
Ø Merge
2 T. 13 Std.
Gemergte PRs (30 T.)
5

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.