Rename Method allows changing datamodels function names.

Đang mở
#832 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

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
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
python
Lĩnh vực
tooling

Hướng nghiên cứu

Start with the rename refactoring in rope's refactor package, where the rename method is applied to a function definition, and check how it treats special methods such as __new__. Reproduce with the Singleton snippet in the issue to see that the definition is renamed while the super().__new__ call is left alone. The issue does not say whether dunder methods should be refused or renamed differently, so confirm the intended behavior with the maintainers before changing code.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

bug

Rename Method allows changing datamodels function names.

Steps to reproduce the behavior:

  1. Code before refactoring:
class Singleton:
    _instancia = None

    def __new__(cls):
        if cls._instancia is None:
            cls._instancia = super().__new__(cls)
        return cls._instancia

a = Singleton()
b = Singleton()
print(a is b)
  1. Apply the rename method to Singleton.__new__

  2. Code after refactoring:

class Singleton:
    _instancia = None

    def get_instance(cls):
        if cls._instancia is None:
            cls._instancia = super().__new__(cls)
        return cls._instancia

a = Singleton()
b = Singleton()
print(a is b)
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

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của python-rope/rope

Tất cả issue của python-rope/rope

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.