The Inline Method removes an overridden method
Maintainer thường phản hồi trong vòng 7 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 35/100
Hướng nghiên cứu
Start by running the two-class snippet in the issue (WordList overriding append and extend) and confirm the before-and-after output differs. Then apply Inline Method to WordList.extend in rope and find where the inlining step decides which calls to keep. The issue does not name rope's internal files, so locate them from that entry point. Done means the inlined code still routes each element through the overridden append, so Word objects are still created.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
The Inline Method removes an overridden method that changes the type of the stored objects.
Steps to reproduce the behavior:
- Code before refactoring:
class Word(str):
def __new__(cls, value):
print(f"criando Word({value!r})")
return super().__new__(cls, value)
class WordList(list):
def append(self, obj):
print(f"append: recebi {obj!r} (type={type(obj).__name__})")
if isinstance(obj, str) and not isinstance(obj, Word):
obj = Word(obj)
super().append(obj)
def extend(self, iterable):
print("extend (custom): chamando append para cada elemento")
for e in iterable:
self.append(e)
wl = WordList()
wl.extend(["ola", "mundo"])
print("conteúdo wl:", wl)
print("types wl:", [type(x).__name__ for x in wl])
-
Apply the inline method to
WordList.extend -
Code after refactoring:
class Word(str):
def __new__(cls, value):
print(f"criando Word({value!r})")
return super().__new__(cls, value)
class WordList(list):
def append(self, obj):
print(f"append: recebi {obj!r} (type={type(obj).__name__})")
if isinstance(obj, str) and not isinstance(obj, Word):
obj = Word(obj)
super().append(obj)
wl = WordList()
wl.extend(["ola", "mundo"])
print("conteúdo wl:", wl)
print("types wl:", [type(x).__name__ for x in wl])
- Ngôn ngữ chính
- Python
- Star
- 2.2k
- Fork
- 197
- Merge trung bình
- 2 ngày 13 giờ
- Pull request đã merge (30 ngày)
- 5
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của python-rope/rope
-
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 88/100
python-rope/rope#927 ·
Maintainer thường phản hồi trong vòng 7 ngày
-
Extract raises IndexError or ModuleSyntaxError instead of RefactoringError for an empty or whitespace-only regionCó thể đã có người làm @aliassar đã nhận 1 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
python-rope/rope#926 ·
Maintainer thường phản hồi trong vòng 7 ngày
-
simplify.real_code blanks t-strings, so renames inside them edit the wrong offsetCó thể đã có người làm @sean0407 đã nhận 12 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
python-rope/rope#913 ·
Maintainer thường phản hồi trong vòng 7 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 30/100
python-rope/rope#925 ·
Maintainer thường phản hồi trong vòng 7 ngày
-
Extract method/variable and introduce parameter don't check whether the new name is already in useCó thể đã có người làm @aliassar đã nhận hôm nay. Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 62/100
python-rope/rope#924 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 7 ngày
Tất cả issue của python-rope/rope
Issue tương tự
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 1 ngày
-
area:docs documentation effort:M ready-for-agent
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
mczielinski/ob-analytics#423 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
infra
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 3 ngày
-
documentation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
vllm-project/vllm-ascend#21033 ·
Maintainer thường phản hồi trong vòng 1 ngày