mirror of
https://gitee.com/Lyon1998/pikapython.git
synced 2025-01-29 17:22:56 +08:00
fix docstring for .pyi
This commit is contained in:
parent
e577386ee8
commit
2c3dd1223f
@ -69,3 +69,9 @@ class CAN(PikaStdDevice.CAN):
|
||||
|
||||
|
||||
def __del__(self): ...
|
||||
|
||||
|
||||
"""
|
||||
def test_doc_string_pyi():
|
||||
pass
|
||||
"""
|
||||
|
@ -3011,7 +3011,8 @@ Arg* __eventListener_runEvent(PikaEventListener* listener,
|
||||
pika_debug("event handler: %p", handler);
|
||||
if (NULL == handler) {
|
||||
pika_platform_printf(
|
||||
"Error: can not find event handler by id: [0x%02" PRIxPTR "]\r\n", eventId);
|
||||
"Error: can not find event handler by id: [0x%02" PRIxPTR "]\r\n",
|
||||
eventId);
|
||||
return NULL;
|
||||
}
|
||||
Arg* eventCallBack = obj_getArg(handler, "eventCallBack");
|
||||
|
@ -2,4 +2,4 @@
|
||||
#define PIKA_VERSION_MINOR 13
|
||||
#define PIKA_VERSION_MICRO 4
|
||||
|
||||
#define PIKA_EDIT_TIME "2024/08/11 01:43:35"
|
||||
#define PIKA_EDIT_TIME "2024/10/12 16:14:35"
|
||||
|
@ -435,10 +435,29 @@ impl Compiler {
|
||||
let lines: Vec<&str> = file_str.split('\n').collect();
|
||||
let mut last_line = String::from("");
|
||||
/* analyse each line */
|
||||
let mut inside_docstring = false;
|
||||
for line in lines.iter() {
|
||||
let mut line = line.replace("\r", "");
|
||||
/* replace \t with 4 spaces */
|
||||
line = line.replace("\t", " ");
|
||||
|
||||
// Check for docstring blocks (both single-line and multi-line)
|
||||
if line.trim().contains("\"\"\"") {
|
||||
let count = line.matches("\"\"\"").count();
|
||||
if count == 1 {
|
||||
// If we encounter just one set of """ and we are not inside a docstring block, start or end the block
|
||||
inside_docstring = !inside_docstring;
|
||||
continue;
|
||||
} else if count == 2 {
|
||||
// If there are two sets of """ on the same line, it's a single-line docstring, skip it
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// Skip lines inside the docstring block
|
||||
if inside_docstring {
|
||||
continue;
|
||||
}
|
||||
|
||||
if line.contains("(") && !line.contains(")") {
|
||||
last_line = line.clone();
|
||||
continue;
|
||||
@ -452,6 +471,7 @@ impl Compiler {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
self = match pkg_type {
|
||||
PackageType::CPackageTop | PackageType::CPackageInner => {
|
||||
Compiler::analyse_pyi_line(self, line.to_string(), &file_name, is_top_c_pkg)
|
||||
@ -461,6 +481,7 @@ impl Compiler {
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user