We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents c7b721f + 8c77252 commit 8cdc67aCopy full SHA for 8cdc67a
tools/extract_pyi.py
@@ -20,12 +20,22 @@
20
if not os.path.isdir(module_path):
21
continue
22
pyi_lines = []
23
- for class_file in os.listdir(module_path):
+ classes = os.listdir(module_path)
24
+ classes = [x for x in sorted(classes) if x.endswith(".c")]
25
+ if classes[-1] == "__init__.c":
26
+ classes.insert(0, classes.pop())
27
+ for class_file in classes:
28
class_path = os.path.join(module_path, class_file)
29
with open(class_path, "r") as f:
30
for line in f:
- if line.startswith("//| "):
- pyi_lines.append(line[4:])
31
+ if line.startswith("//|"):
32
+ if line[3] == " ":
33
+ line = line[4:]
34
+ elif line[3] == "\n":
35
+ line = line[3:]
36
+ else:
37
+ continue
38
+ pyi_lines.append(line)
39
40
stub_filename = os.path.join(stub_directory, module + ".pyi")
41
print(stub_filename)
0 commit comments