Plugin API feature requests
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- Python
- Star
- 20.6k
- Fork
- 3.3k
- Chỉ số merge pull request
- Chỉ số pull request đang chờ
Mô tả
I recently wrote a plugin that used get_function_hook() to intercept instantiations of a certain set of classes (recognized by name), and found a bunch of functionality missing. Here's a list.
-
I needed the names of the arguments but they were not directly available. I ended up using
rtype.type.names['__init__'].node.arg_names(with various type andNoneguards) and subtracting 1 to compensate forself, which looked very hacky. It would be nice ifFunctionContextalso has anarg_namesargument. -
CheckerPluginInterfacehas nofail()method. It exists on the implementation, and the similarTypeAnalyzerPluginInterfacedoes define it. -
I needed to look up a name in the module's global namespace; I ended up calling
ctx.api.lookup_qualified()but that's not in the interface, and perhaps it's not the thing to use. -
I needed the functionality of
parse_bool()but it's not there (it only exists onSemanticAnalyzerPluginInterface). -
I needed something similar to what's in mypy/plugins/common.py as
_get_bool_argument()_get_argument()but had to write my own because the starting point was aFunctionContextinstead of aClassDefContext. -
(Not directly a plugin issue, but this happened.) I was also bitten by the error message
The type alias{} is invalid in runtime context-- this seems a bit inconsistent because expanding theUnionthat the alias references makes it go away. I.e. ifA = Optional[int],foo(A)gives that error, butfoo(Optional[int])doesn't.
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.
Hướng nghiên cứu
Xem xét các giao diện plugin liên quan đến FunctionContext, CheckerPluginInterface và SemanticAnalyzerPluginInterface, cùng với mypy/plugins/common.py và hành vi runtime của type alias đã được báo cáo. Issue này chứa một số yêu cầu API riêng biệt thay vì một thay đổi có phạm vi duy nhất; để hoàn thành, cần quyết định những yêu cầu nào được hỗ trợ và xác định hành vi mong đợi của chúng.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- python
- Lĩnh vực
- tooling
- Loại issue
- Tính năng
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Cần làm rõ
- Mức phù hợp với người mới
- 25/100