Skip to content

Commit 22ff754

Browse files
authored
Merge pull request #74 from SummerGGift/auto_completion
【添加】micropython 模块自动补全实现
2 parents 8ef3560 + ccafa6c commit 22ff754

26 files changed

+2450
-1
lines changed

docs/07-Network_Module/03-network-WLAN.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ nic.connect('your-ssid', 'your-password')
5555

5656
获取或者设置网络接口的参数,IP 地址,子网掩码,网关,DNS 服务器。当调用该方法不附带参数时,该方法会返回一个包含四个元素的元组来描述上面的信息。想要设置上面的值,传入一个包含上述四个元素的元组,例如:
5757

58-
```
58+
```python
5959
nic.ifconfig(('192.168.0.4', '255.255.255.0', '192.168.0.1', '8.8.8.8'))
6060
```
6161

docs/code-completion/_thread.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
"""
2+
_thread 模块提供了用于处理多线程的基本方法——多个控制线程共享它们的全局数据空间。
3+
为了实现同步,提供了简单的锁(也称为互斥锁或二进制信号量)。
4+
"""
5+
6+
def start_new_thread(testThread) -> None:
7+
"""start_new_thread(testThread, ())"""
8+
...

docs/code-completion/array.py

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
"""
2+
array 模块定义了一个对象类型,它可以简洁地表示基本值的数组:字符、整数、浮点数。支持代码格式: b, B, h, H, i, I, l, L, q, Q, f, d (最后2个需要支持浮点数)。
3+
"""
4+
5+
class array(object):
6+
def __init__(self) -> None:
7+
"""
8+
用给定类型的元素创建数组。数组的初始内容由 iterable 提供,如果没有提供,则创建一个空数组。
9+
typecode:数组的类型
10+
iterable:数组初始内容
11+
示例:
12+
13+
- import array
14+
- a = array.array('i', [2, 4, 1, 5])'
15+
- b = array.array('f')
16+
- print(a)
17+
- array('i', [2, 4, 1, 5])
18+
- print(b)
19+
- array('f')
20+
"""
21+
...
22+
23+
def append(val) -> None:
24+
"""
25+
将一个新元素追加到数组的末尾。
26+
示例:
27+
28+
- a = array.array('f', [3, 6])
29+
- print(a)
30+
- array('f', [3.0, 6.0])
31+
- a.append(7.0)
32+
- print(a)
33+
- array('f', [3.0, 6.0, 7.0])
34+
"""
35+
...
36+
37+
def extend(iterable) -> None:
38+
"""
39+
将一个新的数组追加到数组的末尾,注意追加的数组和原来数组的数据类型要保持一致。
40+
示例:
41+
42+
- a = array.array('i', [1, 2, 3])
43+
- b = array.array('i', [4, 5])
44+
- a.extend(b)
45+
- print(a)
46+
- array('i', [1, 2, 3, 4, 5])
47+
"""
48+
...
49+

docs/code-completion/cmath.py

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
"""
2+
cmath 模块提供了对复数的数学函数的访问。这个模块中的函数接受整数、浮点数或复数作为参数。他们还将接受任何有复数或浮点方法的 Python 对象:这些方法分别用于将对象转换成复数或浮点数,然后将该函数应用到转换的结果中。
3+
"""
4+
5+
e = ... # type: int
6+
pi = ... # type: int
7+
8+
def cos(z) -> None:
9+
"""返回z的余弦。"""
10+
...
11+
12+
def exp(z) -> None:
13+
"""返回z的指数。"""
14+
...
15+
16+
def log(z) -> None:
17+
"""返回z的对数。"""
18+
...
19+
20+
def log10(z) -> None:
21+
"""返回z的常用对数。"""
22+
...
23+
24+
def phase(z) -> None:
25+
"""返回z的相位, 范围是(-pi, +pi],以弧度表示。"""
26+
...
27+
28+
def polar(z) -> None:
29+
"""返回z的极坐标。"""
30+
...
31+
32+
def rect(r, phi) -> None:
33+
"""返回模量r和相位phi的复数。"""
34+
...
35+
36+
def sin(z) -> None:
37+
"""返回z的正弦。"""
38+
...
39+
40+
def sqrt(z) -> None:
41+
"""返回z的平方根。"""
42+
...
43+

docs/code-completion/gc.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
"""
2+
gc 模块提供了垃圾收集器的控制接口。
3+
"""
4+
5+
def enable() -> None:
6+
"""允许自动回收内存碎片。"""
7+
...
8+
9+
def disable() -> None:
10+
"""禁止自动回收,但可以通过collect()函数进行手动回收内存碎片。"""
11+
...
12+
13+
def collect() -> None:
14+
"""运行一次垃圾回收。"""
15+
...
16+
17+
def mem_alloc() -> None:
18+
"""返回已分配的内存数量。"""
19+
...
20+
21+
def mem_free() -> None:
22+
"""返回剩余的内存数量。"""
23+
...

0 commit comments

Comments
 (0)