The Move Field refactoring introduces a circular dependency.

Offen
#829 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
42/100
Issue-Typ
Bug
Klarheit
Größtenteils klar
Aktivitätsstatus
Veraltet
Tech-Stack
python
Bereich
devtools

Rechercherichtung

Start with the reproduction in the issue: input/a.py defines A with self.owner = self and imports B from b.py. Apply the move-field refactoring to A.owner and check the output, where b.py now imports A and a.py imports B, creating the cycle. The issue does not say how the cycle should be avoided, so confirm the expected behavior with maintainers before coding. Done means the refactored output no longer has a circular import, with a test covering this two-file case.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

bug

The MoveField refactoring introduces a circular dependency.

Steps to reproduce the behavior:

  1. Code before refactoring:
-- input/a.py
from b import B

class A:
    def __init__(self):
        self.b = B()
        self.owner = self

-- input/b.py
class B:
    pass
  1. Apply the move field to A.owner

  2. Code after refactoring:

-- input/a.py
from b import B

class A:
    def __init__(self):
        self.b = B(self)


-- input/b.py
from a import A

class B:
    def __init__(self, owner: A):
        self.owner = owner
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.