The Inline Method is allowed for constructor methods

Đang mở
#750 1 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
1-2 ngày
Mức phù hợp với người mới
38/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

The payload names no rope source files, so start by locating the Inline Method refactoring in the rope package and finding where it checks which methods can be inlined. Reproduce with the sample MyClass that defines new and init, then apply Inline Method to MyClass.new. Done means the refactoring refuses constructor methods like new and init, with a test covering that case.

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

Mô tả

enhancement inline-refactor

Python’s instantiation process starts with a call to the class constructor, which triggers the instance creator, __new__(), to create a new empty object.
The process continues with the instance initializer, __init__(), which takes the constructor’s arguments to initialize the newly created object.
Rope allows applying the Inline Method refactoring to the __new__() method.

Steps to reproduce the behavior:

  1. Code before refactoring:
unicode = str


class MyClass(unicode):
    def __new__(cls, string):
        return super(MyClass, cls).__new__(cls, string)

    def __init__(self, string):
        self.value = string
  1. Apply the Inline Method refactoring to MyClass.__new__
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.