Applying the Inline Method refactoring does not add the required import.
Los mantenedores suelen responder en 7 días
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 45/100
Línea de trabajo
Reproduce with the two files in the report: src/main.py defines Base.split with the default argument sys.maxsize, and src/test.py calls it, so inlining should copy that default into test.py. Start from rope's Inline Method refactoring and check how it collects imports for names used in the inlined body. Done when applying the refactoring to Base.split leaves import sys at the top of test.py, and a test covers the default-argument case.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Steps to reproduce the behavior:
- Code before refactoring:
structure:
project
| - src
| -- __init__.py
| -- main.py
| -- test.py
main.py
import sys
class Base:
def __init__(self, text):
self.raw = text
def split(self, sep=None, maxsplit=sys.maxsize):
return self.raw.split(sep, maxsplit)[0]
test.py
from unittest import TestCase
from src.split_main import Base
class Test(TestCase):
def test_split(self):
blob = Base('Beautiful is better')
self.assertEqual(blob.split(), ['Beautiful'])
-
Apply the Inline Method to Base.split().
-
Expected code after refactoring:
structure:
project
| - src
| -- __init__.py
| -- main.py
| -- test.py
main.py
class Base:
def __init__(self, text):
self.raw = text
test.py
import sys
from unittest import TestCase
from src.split_main import Base
class Test(TestCase):
def test_split(self):
blob = Base('Beautiful is better')
self.assertEqual(blob.raw.split(None, sys.maxsize)[0], ['Beautiful'])
- The "import sys" is not automatically added.
- Lenguaje dominante
- Python
- Estrellas
- 2.2k
- Forks
- 197
- Merge medio
- 2 d 13 h
- PR fusionados (30 d)
- 5
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de python-rope/rope
-
Dificultad 1/5 1-3 horas Aptitud para principiantes 88/100
python-rope/rope#927 ·
Los mantenedores suelen responder en 7 días
-
Extract raises IndexError or ModuleSyntaxError instead of RefactoringError for an empty or whitespace-only regionPosiblemente ocupada @aliassar la tomó hace 1 día. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
python-rope/rope#926 ·
Los mantenedores suelen responder en 7 días
-
simplify.real_code blanks t-strings, so renames inside them edit the wrong offsetPosiblemente ocupada @sean0407 la tomó hace 12 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 83/100
python-rope/rope#913 ·
Los mantenedores suelen responder en 7 días
-
Dificultad 4/5 3-5 días Aptitud para principiantes 30/100
python-rope/rope#925 ·
Los mantenedores suelen responder en 7 días
-
Extract method/variable and introduce parameter don't check whether the new name is already in usePosiblemente ocupada @aliassar la tomó hoy. Abierto
Dificultad 3/5 1-2 días Aptitud para principiantes 62/100
python-rope/rope#924 · 1 comentario ·
Los mantenedores suelen responder en 7 días
Todos los issues de python-rope/rope
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
huggingface/deep-rl-class#723 ·
-
[tool] bug: Qwen3 XML tool parser raises on `...` argument values (Ellipsis is not JSON serializable)Posiblemente ocupada @super-yuki la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 87/100
verl-project/verl#8559 ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
TencentCloud/octop-harness#228 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
google/osv-scalibr#2585 ·
Los mantenedores suelen responder en 2 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
NousResearch/hermes-agent#149323 ·
Los mantenedores suelen responder en 1 día