The Move Field refactoring introduces a circular dependency.

Aperta
#829 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 7 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
42/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
python
Ambito
devtools

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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
Lingua principale
Python
Stelle
2.2k
Fork
197
Merge medio
2g 13h
PR unite (30g)
5

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di python-rope/rope

Tutte le issue di python-rope/rope

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.