Rename Method refactoring allowed for methods defined to implement container objects
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ó
- 3/5
- Thời gian dự kiến
- Nửa ngày
- Mức phù hợp với người mới
- 35/100
Hướng nghiên cứu
Start by reproducing the report with the main.py and test.py from the issue, using Rename Method on StringlikeMixin.len with the new name 'text'. The open question is whether Rope should warn or refuse when a method implements a container protocol like len, and the issue does not settle that. Done means agreeing that behaviour with maintainers and then covering it with a test.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Rename Method refactoring allowed for methods defined to implement container objects
It would be nice if Rope sent an alert to the user to avoid incompatible parameter type errors when using the "len()" function.
Steps to reproduce the behavior:
- Code before refactoring:
structure
-- main
---- main.py
-- test
---- test.py
main.py:
implements_to_string = lambda x: x
@implements_to_string
class StringlikeMixin(object):
def __len__(self):
return len(self._strkey())
class BaseBlob(StringlikeMixin):
def __init__(self, text):
self.raw = text
def _strkey(self):
return self.raw
class Sentence(BaseBlob):
def __init__(self, sentence, start_index=0, end_index=None, *args, **kwargs):
super(Sentence, self).__init__(sentence, *args, **kwargs)
test.py:
from unittest import TestCase
from main import main as tb
class SentenceTest(TestCase):
def setUp(self):
self.raw_sentence = 'Any place with frites and Belgian beer has my vote.'
self.sentence = tb.Sentence(self.raw_sentence)
def test_len(self):
self.assertEqual(len(self.sentence), len(self.raw_sentence))
- Apply the Rename Method refactoring with the new name 'text' to the method 'StringlikeMixin.__len__'
- 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 hôm nay. Đ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 11 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 useĐ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 ·
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 ready-for-dev
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 92/100
OpenHands/extensions#897 ·
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 72/100
tensorflow/datasets#11253 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
fix(core): a config section with all keys commented out crashes startupCó thể đã có người làm @Aryanbhargava18 đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
kubeflow/mcp-server#512 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Stop trusting the compromised eMudhra CA certificatesCó thể đã có người làm @anth-volk đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
PolicyEngine/uk-triple-lock#54 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
DBFS append mode silently overwrites existing filesCó thể đã có người làm @IlyaKhalafi đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 77/100
fsspec/filesystem_spec#2429 ·
Maintainer thường phản hồi trong vòng 1 ngày