micropython-stubber 1.23.3__py3-none-any.whl → 1.24.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {micropython_stubber-1.23.3.dist-info → micropython_stubber-1.24.1.dist-info}/METADATA +29 -11
- {micropython_stubber-1.23.3.dist-info → micropython_stubber-1.24.1.dist-info}/RECORD +68 -65
- {micropython_stubber-1.23.3.dist-info → micropython_stubber-1.24.1.dist-info}/WHEEL +1 -1
- mpflash/README.md +2 -2
- mpflash/mpflash/basicgit.py +22 -2
- mpflash/mpflash/common.py +23 -13
- mpflash/mpflash/downloaded.py +10 -2
- mpflash/mpflash/flash/esp.py +1 -1
- mpflash/mpflash/mpboard_id/__init__.py +9 -4
- mpflash/mpflash/mpboard_id/add_boards.py +25 -14
- mpflash/mpflash/mpboard_id/board.py +2 -2
- mpflash/mpflash/mpboard_id/board_id.py +10 -6
- mpflash/mpflash/mpboard_id/board_info.zip +0 -0
- mpflash/mpflash/mpremoteboard/__init__.py +13 -8
- mpflash/mpflash/vendor/board_database.py +185 -0
- mpflash/mpflash/vendor/readme.md +10 -1
- mpflash/mpflash/versions.py +28 -40
- mpflash/poetry.lock +1147 -231
- mpflash/pyproject.toml +4 -3
- stubber/__init__.py +1 -1
- stubber/board/createstubs.py +76 -34
- stubber/board/createstubs_db.py +34 -25
- stubber/board/createstubs_db_min.py +90 -83
- stubber/board/createstubs_db_mpy.mpy +0 -0
- stubber/board/createstubs_mem.py +34 -25
- stubber/board/createstubs_mem_min.py +123 -116
- stubber/board/createstubs_mem_mpy.mpy +0 -0
- stubber/board/createstubs_min.py +154 -145
- stubber/board/createstubs_mpy.mpy +0 -0
- stubber/board/modulelist.txt +16 -0
- stubber/codemod/enrich.py +301 -86
- stubber/codemod/merge_docstub.py +251 -66
- stubber/codemod/test_enrich.py +87 -0
- stubber/codemod/visitors/type_helpers.py +182 -0
- stubber/commands/build_cmd.py +16 -3
- stubber/commands/clone_cmd.py +3 -3
- stubber/commands/config_cmd.py +4 -2
- stubber/commands/enrich_folder_cmd.py +33 -21
- stubber/commands/get_core_cmd.py +1 -2
- stubber/commands/get_docstubs_cmd.py +60 -6
- stubber/commands/get_frozen_cmd.py +15 -12
- stubber/commands/get_mcu_cmd.py +3 -3
- stubber/commands/merge_cmd.py +1 -2
- stubber/commands/publish_cmd.py +19 -4
- stubber/commands/stub_cmd.py +3 -3
- stubber/commands/switch_cmd.py +3 -5
- stubber/commands/variants_cmd.py +3 -3
- stubber/cst_transformer.py +52 -17
- stubber/freeze/common.py +27 -11
- stubber/freeze/freeze_manifest_2.py +8 -1
- stubber/freeze/get_frozen.py +4 -1
- stubber/merge_config.py +111 -0
- stubber/minify.py +1 -2
- stubber/publish/database.py +51 -10
- stubber/publish/merge_docstubs.py +38 -17
- stubber/publish/package.py +32 -18
- stubber/publish/publish.py +8 -8
- stubber/publish/stubpackage.py +117 -50
- stubber/rst/lookup.py +205 -41
- stubber/rst/reader.py +106 -59
- stubber/rst/rst_utils.py +24 -11
- stubber/stubber.py +1 -1
- stubber/stubs_from_docs.py +31 -13
- stubber/update_module_list.py +2 -2
- stubber/utils/config.py +33 -13
- stubber/utils/post.py +9 -6
- stubber/publish/missing_class_methods.py +0 -51
- {micropython_stubber-1.23.3.dist-info → micropython_stubber-1.24.1.dist-info}/LICENSE +0 -0
- {micropython_stubber-1.23.3.dist-info → micropython_stubber-1.24.1.dist-info}/entry_points.txt +0 -0
stubber/board/createstubs_min.py
CHANGED
@@ -1,20 +1,22 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
1
|
+
A1='windows'
|
2
|
+
A0='No report file'
|
3
|
+
z='Failed to create the report.'
|
4
|
+
y='{}/{}'
|
5
|
+
x='logging'
|
6
|
+
w='sys'
|
7
|
+
v='method'
|
8
|
+
u='function'
|
9
|
+
t='bool'
|
10
|
+
s='str'
|
11
|
+
r='float'
|
12
|
+
q='int'
|
13
|
+
p='stubber'
|
14
|
+
o=Exception
|
15
|
+
n=KeyError
|
16
|
+
m=sorted
|
17
|
+
l=NotImplementedError
|
18
|
+
h='pycom'
|
19
|
+
g='unix'
|
18
20
|
f=',\n'
|
19
21
|
e='dict'
|
20
22
|
d='list'
|
@@ -22,19 +24,19 @@ c='tuple'
|
|
22
24
|
b='micropython'
|
23
25
|
a=TypeError
|
24
26
|
Z=repr
|
25
|
-
|
26
|
-
V=
|
27
|
-
U=
|
28
|
-
T='
|
29
|
-
S=
|
30
|
-
R=
|
31
|
-
Q=
|
32
|
-
P=
|
33
|
-
O=
|
27
|
+
W='-preview'
|
28
|
+
V=True
|
29
|
+
U='-'
|
30
|
+
T='board'
|
31
|
+
S=len
|
32
|
+
R=open
|
33
|
+
Q=print
|
34
|
+
P='family'
|
35
|
+
O=IndexError
|
34
36
|
N=ImportError
|
35
37
|
M=dir
|
36
|
-
|
37
|
-
|
38
|
+
L='port'
|
39
|
+
K='.'
|
38
40
|
I=AttributeError
|
39
41
|
H=False
|
40
42
|
G='/'
|
@@ -48,42 +50,44 @@ try:from ujson import dumps
|
|
48
50
|
except:from json import dumps
|
49
51
|
try:from machine import reset
|
50
52
|
except N:pass
|
51
|
-
try:from collections import OrderedDict as
|
52
|
-
except N:from ucollections import OrderedDict as
|
53
|
-
__version__='v1.
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
class
|
58
|
-
INFO=20;WARNING=30;ERROR=40;level=INFO;prnt=
|
53
|
+
try:from collections import OrderedDict as i
|
54
|
+
except N:from ucollections import OrderedDict as i
|
55
|
+
__version__='v1.24.0'
|
56
|
+
A2=2
|
57
|
+
A3=2
|
58
|
+
A7=['lib','/lib','/sd/lib','/flash/lib',K]
|
59
|
+
class J:
|
60
|
+
DEBUG=10;INFO=20;WARNING=30;ERROR=40;level=INFO;prnt=Q
|
59
61
|
@staticmethod
|
60
|
-
def getLogger(name):return
|
62
|
+
def getLogger(name):return J()
|
61
63
|
@classmethod
|
62
64
|
def basicConfig(A,level):A.level=level
|
65
|
+
def debug(A,msg):
|
66
|
+
if A.level<=J.DEBUG:A.prnt('DEBUG :',msg)
|
63
67
|
def info(A,msg):
|
64
|
-
if A.level<=
|
68
|
+
if A.level<=J.INFO:A.prnt('INFO :',msg)
|
65
69
|
def warning(A,msg):
|
66
|
-
if A.level<=
|
70
|
+
if A.level<=J.WARNING:A.prnt('WARN :',msg)
|
67
71
|
def error(A,msg):
|
68
|
-
if A.level<=
|
69
|
-
A=
|
70
|
-
|
72
|
+
if A.level<=J.ERROR:A.prnt('ERROR :',msg)
|
73
|
+
A=J.getLogger(p)
|
74
|
+
J.basicConfig(level=J.INFO)
|
71
75
|
class Stubber:
|
72
76
|
def __init__(B,path=D,firmware_id=D):
|
73
77
|
C=firmware_id
|
74
78
|
try:
|
75
|
-
if os.uname().release=='1.13.0'and os.uname().version<'v1.13-103':raise
|
79
|
+
if os.uname().release=='1.13.0'and os.uname().version<'v1.13-103':raise l('MicroPython 1.13.0 cannot be stubbed')
|
76
80
|
except I:pass
|
77
|
-
B.info=_info();A.info('Port: {}'.format(B.info[
|
81
|
+
B.info=_info();A.info('Port: {}'.format(B.info[L]));A.info('Board: {}'.format(B.info[T]));F.collect()
|
78
82
|
if C:B._fwid=C.lower()
|
79
|
-
elif B.info[
|
83
|
+
elif B.info[P]==b:B._fwid='{family}-v{version}-{port}-{board}'.format(**B.info).rstrip(U)
|
80
84
|
else:B._fwid='{family}-v{version}-{port}'.format(**B.info)
|
81
85
|
B._start_free=F.mem_free()
|
82
86
|
if path:
|
83
87
|
if path.endswith(G):path=path[:-1]
|
84
88
|
else:path=get_root()
|
85
89
|
B.path='{}/stubs/{}'.format(path,B.flat_fwid).replace('//',G)
|
86
|
-
try:
|
90
|
+
try:X(path+G)
|
87
91
|
except E:A.error('error creating stub folder {}'.format(path))
|
88
92
|
B.problematic=['upip','upysh','webrepl_setup','http_client','http_client_ssl','http_server','http_server_ssl'];B.excluded=['webrepl','_webrepl','port_diag','example_sub_led.py','example_pub_button.py'];B.modules=[];B._json_name=D;B._json_first=H
|
89
93
|
def get_obj_attributes(L,item_instance):
|
@@ -93,16 +97,16 @@ class Stubber:
|
|
93
97
|
try:
|
94
98
|
D=getattr(H,A)
|
95
99
|
try:E=Z(type(D)).split("'")[1]
|
96
|
-
except
|
97
|
-
if E in{
|
98
|
-
elif E in{
|
100
|
+
except O:E=B
|
101
|
+
if E in{q,r,s,t,c,d,e}:G=1
|
102
|
+
elif E in{u,v}:G=2
|
99
103
|
elif E in'class':G=3
|
100
104
|
else:G=4
|
101
105
|
C.append((A,Z(D),Z(type(D)),D,G))
|
102
106
|
except I as J:K.append("Couldn't get attribute '{}' from object '{}', Err: {}".format(A,H,J))
|
103
|
-
except MemoryError as J:
|
104
|
-
C=
|
105
|
-
def add_modules(A,modules):A.modules=
|
107
|
+
except MemoryError as J:Q('MemoryError: {}'.format(J));sleep(1);reset()
|
108
|
+
C=m([A for A in C if not A[0].startswith('__')],key=lambda x:x[4]);F.collect();return C,K
|
109
|
+
def add_modules(A,modules):A.modules=m(set(A.modules)|set(modules))
|
106
110
|
def create_all_stubs(B):
|
107
111
|
A.info('Start micropython-stubber {} on {}'.format(__version__,B._fwid));B.report_start();F.collect()
|
108
112
|
for C in B.modules:B.create_one_stub(C)
|
@@ -111,60 +115,62 @@ class Stubber:
|
|
111
115
|
B=module_name
|
112
116
|
if B in C.problematic:A.warning('Skip module: {:<25} : Known problematic'.format(B));return H
|
113
117
|
if B in C.excluded:A.warning('Skip module: {:<25} : Excluded'.format(B));return H
|
114
|
-
I='{}/{}.pyi'.format(C.path,B.replace(
|
118
|
+
I='{}/{}.pyi'.format(C.path,B.replace(K,G));F.collect();D=H
|
115
119
|
try:D=C.create_module_stub(B,I)
|
116
120
|
except E:return H
|
117
121
|
F.collect();return D
|
118
|
-
def create_module_stub(
|
122
|
+
def create_module_stub(J,module_name,file_name=D):
|
119
123
|
I=file_name;C=module_name
|
120
|
-
if I is D:L=C.replace(
|
124
|
+
if I is D:L=C.replace(K,'_')+'.pyi';I=J.path+G+L
|
121
125
|
else:L=I.split(G)[-1]
|
122
|
-
if G in C:C=C.replace(G,
|
126
|
+
if G in C:C=C.replace(G,K)
|
123
127
|
M=D
|
124
128
|
try:M=__import__(C,D,D,'*');P=F.mem_free();A.info('Stub module: {:<25} to file: {:<70} mem:{:>5}'.format(C,L,P))
|
125
129
|
except N:return H
|
126
|
-
|
127
|
-
with
|
128
|
-
|
129
|
-
if C not in{'os',
|
130
|
+
X(I)
|
131
|
+
with R(I,'w')as O:Q=str(J.info).replace('OrderedDict(',B).replace('})','}');S='"""\nModule: \'{0}\' on {1}\n"""\n# MCU: {2}\n# Stubber: {3}\n'.format(C,J._fwid,Q,__version__);O.write(S);O.write('from __future__ import annotations\nfrom typing import Any, Generator\nfrom _typeshed import Incomplete\n\n');J.write_object_stub(O,M,C,B)
|
132
|
+
J.report_add(C,I)
|
133
|
+
if C not in{'os',w,x,'gc'}:
|
130
134
|
try:del M
|
131
|
-
except(E,
|
132
|
-
F.collect();return
|
135
|
+
except(E,n):A.warning('could not del new_module')
|
136
|
+
F.collect();return V
|
133
137
|
def write_object_stub(L,fp,object_expr,obj_name,indent,in_class=0):
|
134
|
-
Z=' at ...>';Y='generator';X='{0}{1}: {3} = {2}\n';W='bound_method';V='Incomplete';O=in_class;N='Exception';M=object_expr;K=' at ';J=fp;
|
138
|
+
Z=' at ...>';Y='generator';X='{0}{1}: {3} = {2}\n';W='bound_method';V='Incomplete';O=in_class;N='Exception';M=object_expr;K=' at ';J=fp;E=indent;F.collect()
|
135
139
|
if M in L.problematic:A.warning('SKIPPING problematic module:{}'.format(M));return
|
136
140
|
a,P=L.get_obj_attributes(M)
|
137
141
|
if P:A.error(P)
|
138
|
-
for(
|
139
|
-
if
|
140
|
-
if
|
141
|
-
if I=="<class 'type'>"and
|
142
|
-
Q=B;
|
143
|
-
if
|
144
|
-
|
145
|
-
if
|
146
|
-
J.write(
|
147
|
-
elif any(A in I for A in[u,
|
142
|
+
for(C,H,I,b,g)in a:
|
143
|
+
if C in['classmethod','staticmethod','BaseException',N]:continue
|
144
|
+
if C[0].isdigit():A.warning('NameError: invalid name {}'.format(C));continue
|
145
|
+
if I=="<class 'type'>"and S(E)<=A3*4:
|
146
|
+
Q=B;R=C.endswith(N)or C.endswith('Error')or C in['KeyboardInterrupt','StopIteration','SystemExit']
|
147
|
+
if R:Q=N
|
148
|
+
D='\n{}class {}({}):\n'.format(E,C,Q)
|
149
|
+
if R:D+=E+' ...\n';J.write(D);continue
|
150
|
+
J.write(D);L.write_object_stub(J,b,'{0}.{1}'.format(obj_name,C),E+' ',O+1);D=E+' def __init__(self, *argv, **kwargs) -> None:\n';D+=E+' ...\n\n';J.write(D)
|
151
|
+
elif any(A in I for A in[v,u,'closure']):
|
148
152
|
T=V;U=B
|
149
153
|
if O>0:U='self, '
|
150
|
-
if W in I or W in H:
|
151
|
-
else:
|
152
|
-
|
154
|
+
if W in I or W in H:D='{}@classmethod\n'.format(E)+'{}def {}(cls, *args, **kwargs) -> {}:\n'.format(E,C,T)
|
155
|
+
else:D='{}def {}({}*args, **kwargs) -> {}:\n'.format(E,C,U,T)
|
156
|
+
D+=E+' ...\n\n';J.write(D)
|
153
157
|
elif I=="<class 'module'>":0
|
154
158
|
elif I.startswith("<class '"):
|
155
|
-
G=I[8:-2];
|
156
|
-
if G in(
|
157
|
-
|
159
|
+
G=I[8:-2];D=B
|
160
|
+
if G in(s,q,r,t,'bytearray','bytes'):
|
161
|
+
if C.upper()==C:D='{0}{1}: Final[{3}] = {2}\n'.format(E,C,H,G)
|
162
|
+
else:D=X.format(E,C,H,G)
|
163
|
+
elif G in(e,d,c):f={e:'{}',d:'[]',c:'()'};D=X.format(E,C,f[G],G)
|
158
164
|
elif G in('object','set','frozenset','Pin',Y):
|
159
165
|
if G==Y:G='Generator'
|
160
|
-
|
166
|
+
D='{0}{1}: {2} ## = {4}\n'.format(E,C,G,I,H)
|
161
167
|
else:
|
162
168
|
G=V
|
163
169
|
if K in H:H=H.split(K)[0]+Z
|
164
170
|
if K in H:H=H.split(K)[0]+Z
|
165
|
-
|
166
|
-
J.write(
|
167
|
-
else:J.write("# all other, type = '{0}'\n".format(I));J.write(
|
171
|
+
D='{0}{1}: {2} ## {3} = {4}\n'.format(E,C,G,I,H)
|
172
|
+
J.write(D)
|
173
|
+
else:J.write("# all other, type = '{0}'\n".format(I));J.write(E+C+' # type: Incomplete\n')
|
168
174
|
@property
|
169
175
|
def flat_fwid(self):
|
170
176
|
A=self._fwid;B=' .()/\\:$'
|
@@ -176,29 +182,29 @@ class Stubber:
|
|
176
182
|
try:os.stat(path);F=os.listdir(path)
|
177
183
|
except(E,I):return
|
178
184
|
for G in F:
|
179
|
-
B=
|
185
|
+
B=y.format(path,G)
|
180
186
|
try:os.remove(B)
|
181
187
|
except E:
|
182
188
|
try:C.clean(B);os.rmdir(B)
|
183
189
|
except E:pass
|
184
190
|
def report_start(B,filename='modules.json'):
|
185
|
-
H='firmware';B._json_name=
|
191
|
+
H='firmware';B._json_name=y.format(B.path,filename);B._json_first=V;X(B._json_name);A.info('Report file: {}'.format(B._json_name));F.collect()
|
186
192
|
try:
|
187
|
-
with
|
188
|
-
except E as I:A.error(
|
193
|
+
with R(B._json_name,'w')as G:G.write('{');G.write(dumps({H:B.info})[1:-1]);G.write(f);G.write(dumps({p:{C:__version__},'stubtype':H})[1:-1]);G.write(f);G.write('"modules" :[\n')
|
194
|
+
except E as I:A.error(z);B._json_name=D;raise I
|
189
195
|
def report_add(B,module_name,stub_file):
|
190
|
-
if not B._json_name:raise
|
196
|
+
if not B._json_name:raise o(A0)
|
191
197
|
try:
|
192
|
-
with
|
198
|
+
with R(B._json_name,'a')as C:
|
193
199
|
if not B._json_first:C.write(f)
|
194
200
|
else:B._json_first=H
|
195
201
|
D='{{"module": "{}", "file": "{}"}}'.format(module_name,stub_file.replace('\\',G));C.write(D)
|
196
|
-
except E:A.error(
|
202
|
+
except E:A.error(z)
|
197
203
|
def report_end(B):
|
198
|
-
if not B._json_name:raise
|
199
|
-
with
|
204
|
+
if not B._json_name:raise o(A0)
|
205
|
+
with R(B._json_name,'a')as C:C.write('\n]}')
|
200
206
|
A.info('Path: {}'.format(B.path))
|
201
|
-
def
|
207
|
+
def X(path):
|
202
208
|
B=D=0
|
203
209
|
while B!=-1:
|
204
210
|
B=path.find(G,D)
|
@@ -206,90 +212,93 @@ def W(path):
|
|
206
212
|
C=path[0]if B==0 else path[:B]
|
207
213
|
try:I=os.stat(C)
|
208
214
|
except E as F:
|
209
|
-
if F.args[0]==
|
210
|
-
try:os.mkdir(C)
|
215
|
+
if F.args[0]==A2:
|
216
|
+
try:A.debug('Create folder {}'.format(C));os.mkdir(C)
|
211
217
|
except E as H:A.error('failed to create folder {}'.format(C));raise H
|
212
218
|
D=B+1
|
213
|
-
def
|
219
|
+
def Y(s):
|
214
220
|
C=' on '
|
215
221
|
if not s:return B
|
216
222
|
s=s.split(C,1)[0]if C in s else s
|
217
223
|
if s.startswith('v'):
|
218
|
-
if not
|
219
|
-
A=s.split(
|
220
|
-
if not
|
221
|
-
A=s.split(
|
224
|
+
if not U in s:return B
|
225
|
+
A=s.split(U)[1];return A
|
226
|
+
if not W in s:return B
|
227
|
+
A=s.split(W)[1].split(K)[1];return A
|
222
228
|
def _info():
|
223
|
-
|
224
|
-
try:
|
225
|
-
except a:
|
226
|
-
A=
|
227
|
-
if A[
|
228
|
-
elif A[
|
229
|
-
elif A[
|
230
|
-
try:A[C]=
|
229
|
+
X='ev3-pybricks';V='pycopy';U='win32';S='arch';R='cpu';Q='ver';F='mpy';E='build'
|
230
|
+
try:J=sys.implementation[0]
|
231
|
+
except a:J=sys.implementation.name
|
232
|
+
A=i({P:J,C:B,E:B,Q:B,L:sys.platform,T:'UNKNOWN',R:B,F:B,S:B})
|
233
|
+
if A[L].startswith('pyb'):A[L]='stm32'
|
234
|
+
elif A[L]==U:A[L]=A1
|
235
|
+
elif A[L]=='linux':A[L]=g
|
236
|
+
try:A[C]=A4(sys.implementation.version)
|
231
237
|
except I:pass
|
232
|
-
try:
|
233
|
-
except(I,
|
234
|
-
A[
|
238
|
+
try:K=sys.implementation._machine if'_machine'in M(sys.implementation)else os.uname().machine;A[T]=K;A[R]=K.split('with')[-1].strip();A[F]=sys.implementation._mpy if'_mpy'in M(sys.implementation)else sys.implementation.mpy if F in M(sys.implementation)else B
|
239
|
+
except(I,O):pass
|
240
|
+
A[T]=A5()
|
235
241
|
try:
|
236
242
|
if'uname'in M(os):
|
237
|
-
A[E]=
|
238
|
-
if not A[E]:A[E]=
|
239
|
-
elif C in M(sys):A[E]=
|
240
|
-
except(I,
|
241
|
-
if A[C]==B and sys.platform not in(
|
242
|
-
try:
|
243
|
-
except(
|
244
|
-
for(d,e
|
245
|
-
try:
|
246
|
-
except(N,
|
247
|
-
if A[
|
248
|
-
if A[
|
243
|
+
A[E]=Y(os.uname()[3])
|
244
|
+
if not A[E]:A[E]=Y(os.uname()[2])
|
245
|
+
elif C in M(sys):A[E]=Y(sys.version)
|
246
|
+
except(I,O,a):pass
|
247
|
+
if A[C]==B and sys.platform not in(g,U):
|
248
|
+
try:Z=os.uname();A[C]=Z.release
|
249
|
+
except(O,I,a):pass
|
250
|
+
for(c,d,e)in[(V,V,'const'),(h,h,'FAT'),(X,'pybricks.hubs','EV3Brick')]:
|
251
|
+
try:f=__import__(d,D,D,e);A[P]=c;del f;break
|
252
|
+
except(N,n):pass
|
253
|
+
if A[P]==X:A['release']='2.0.0'
|
254
|
+
if A[P]==b:
|
249
255
|
A[C]
|
250
256
|
if A[C]and A[C].endswith('.0')and A[C]>='1.10.0'and A[C]<='1.19.9':A[C]=A[C][:-2]
|
251
257
|
if F in A and A[F]:
|
252
|
-
G=int(A[F])
|
253
|
-
|
258
|
+
G=int(A[F])
|
259
|
+
try:H=[D,'x86','x64','armv6','armv6m','armv7m','armv7em','armv7emsp','armv7emdp','xtensa','xtensawin','rv32imc'][G>>10]
|
260
|
+
except O:H='unknown'
|
261
|
+
if H:A[S]=H
|
254
262
|
A[F]='v{}.{}'.format(G&255,G>>8&3)
|
255
|
-
if A[E]and not A[C].endswith(
|
263
|
+
if A[E]and not A[C].endswith(W):A[C]=A[C]+W
|
256
264
|
A[Q]=f"{A[C]}-{A[E]}"if A[E]else f"{A[C]}";return A
|
257
|
-
def
|
258
|
-
A=version;B=
|
259
|
-
if
|
265
|
+
def A4(version):
|
266
|
+
A=version;B=K.join([str(A)for A in A[:3]])
|
267
|
+
if S(A)>3 and A[3]:B+=U+A[3]
|
260
268
|
return B
|
261
|
-
def
|
269
|
+
def A5():
|
262
270
|
try:from boardname import BOARDNAME as C;A.info('Found BOARDNAME: {}'.format(C))
|
263
271
|
except N:A.warning('BOARDNAME not found');C=B
|
264
272
|
return C
|
265
273
|
def get_root():
|
266
274
|
try:A=os.getcwd()
|
267
|
-
except(E,I):A=
|
275
|
+
except(E,I):A=K
|
268
276
|
B=A
|
269
|
-
for B in[
|
277
|
+
for B in['/remote','/sd','/flash',G,A,K]:
|
270
278
|
try:C=os.stat(B);break
|
271
279
|
except E:continue
|
272
280
|
return B
|
273
|
-
def
|
281
|
+
def A6(filename):
|
274
282
|
try:
|
275
|
-
if os.stat(filename)[0]>>14:return
|
283
|
+
if os.stat(filename)[0]>>14:return V
|
276
284
|
return H
|
277
285
|
except E:return H
|
278
|
-
def
|
286
|
+
def j():Q("-p, --path path to store the stubs in, defaults to '.'");sys.exit(1)
|
279
287
|
def read_path():
|
280
288
|
path=B
|
281
|
-
if
|
289
|
+
if S(sys.argv)==3:
|
282
290
|
A=sys.argv[1].lower()
|
283
291
|
if A in('--path','-p'):path=sys.argv[2]
|
284
|
-
else:
|
285
|
-
elif
|
292
|
+
else:j()
|
293
|
+
elif S(sys.argv)==2:j()
|
286
294
|
return path
|
287
|
-
def
|
288
|
-
try:A=bytes('abc',encoding='utf8');B=
|
289
|
-
except(
|
290
|
-
def main():stubber=Stubber(path=read_path());stubber.clean();stubber.modules=['WM8960','_OTA','_asyncio','_boot_fat','_coap','_espnow','_flash_control_OTA','_main_pybytes','_mqtt','_mqtt_core','_msg_handl','_onewire','_periodical_pin','_pybytes','_pybytes_ca','_pybytes_config','_pybytes_config_reader','_pybytes_connection','_pybytes_constants','_pybytes_debug','_pybytes_library','_pybytes_machine_learning','_pybytes_main','_pybytes_protocol','_pybytes_pyconfig','_pybytes_pymesh_config','_rp2','_terminal','_thread','_uasyncio','_urequest','adcfft','aioble/__init__','aioble/central','aioble/client','aioble/core','aioble/device','aioble/l2cap','aioble/peripheral','aioble/security','aioble/server','aioespnow','ak8963','apa102','apa106','argparse','array','asyncio/__init__','asyncio/core','asyncio/event','asyncio/funcs','asyncio/lock','asyncio/stream','binascii','bluetooth','breakout_as7262','breakout_bh1745','breakout_bme280','breakout_bme68x','breakout_bmp280','breakout_dotmatrix','breakout_encoder','breakout_icp10125','breakout_ioexpander','breakout_ltr559','breakout_matrix11x7','breakout_mics6814','breakout_msa301','breakout_paa5100','breakout_pmw3901','breakout_potentiometer','breakout_rgbmatrix5x5','breakout_rtc','breakout_scd41','breakout_sgp30','breakout_trackball','breakout_vl53l5cx','btree','cmath','collections','crypto','cryptolib','curl','deflate','dht','display','display_driver_utils','ds18x20','encoder','errno','esp','esp32','espidf','espnow','ffi','flashbdev','framebuf','freesans20','fs_driver','functools','galactic','gc','gfx_pack','gsm','hashlib','heapq','hub75','ili9341','ili9XXX','imagetools','inisetup','interstate75','io','jpegdec','js','jsffi','json','lcd160cr','lodepng',
|
291
|
-
if __name__=='__main__'or
|
292
|
-
if not
|
293
|
-
|
295
|
+
def k():
|
296
|
+
try:A=bytes('abc',encoding='utf8');B=k.__module__;return H
|
297
|
+
except(l,I):return V
|
298
|
+
def main():stubber=Stubber(path=read_path());stubber.clean();stubber.modules=['WM8960','_OTA','_asyncio','_boot_fat','_coap','_espnow','_flash_control_OTA','_main_pybytes','_mqtt','_mqtt_core','_msg_handl','_onewire','_periodical_pin','_pybytes','_pybytes_ca','_pybytes_config','_pybytes_config_reader','_pybytes_connection','_pybytes_constants','_pybytes_debug','_pybytes_library','_pybytes_machine_learning','_pybytes_main','_pybytes_protocol','_pybytes_pyconfig','_pybytes_pymesh_config','_rp2','_terminal','_thread','_uasyncio','_urequest','adcfft','aioble/__init__','aioble/central','aioble/client','aioble/core','aioble/device','aioble/l2cap','aioble/peripheral','aioble/security','aioble/server','aioespnow','ak8963','apa102','apa106','argparse','array','asyncio/__init__','asyncio/core','asyncio/event','asyncio/funcs','asyncio/lock','asyncio/stream','binascii','bluetooth','breakout_as7262','breakout_bh1745','breakout_bme280','breakout_bme68x','breakout_bmp280','breakout_dotmatrix','breakout_encoder','breakout_icp10125','breakout_ioexpander','breakout_ltr559','breakout_matrix11x7','breakout_mics6814','breakout_msa301','breakout_paa5100','breakout_pmw3901','breakout_potentiometer','breakout_rgbmatrix5x5','breakout_rtc','breakout_scd41','breakout_sgp30','breakout_trackball','breakout_vl53l5cx','btree','builtins','cc3200','cmath','collections','crypto','cryptolib','curl','deflate','dht','display','display_driver_utils','ds18x20','embed','encoder','errno','esp','esp32','esp8266','espidf','espnow','ffi','flashbdev','framebuf','freesans20','fs_driver','functools','galactic','gc','gfx_pack','gsm','hashlib','heapq','hub75','ili9341','ili9XXX','imagetools','inisetup','interstate75','io','jpegdec','js','jsffi','json','lcd160cr','lodepng',x,'lsm6dsox','lv_colors','lv_utils','lvgl','lwip','machine','marshal','math','microWebSocket','microWebSrv','microWebTemplate',b,'mimxrt','mip','mip/__init__','mip/__main__','motor','mpu6500','mpu9250','neopixel','network','nrf','ntptime','onewire','openamp','os','pcf85063a','pic16bit','picoexplorer','picographics','picokeypad','picoscroll','picounicorn','picowireless','pimoroni','pimoroni_bus','pimoroni_i2c','plasma','platform','powerpc','pyb',h,'pye','qemu','qrcode','queue','random','renesas','renesas-ra','requests','requests/__init__','rp2','rtch','samd','select','servo','socket','ssd1306','ssh','ssl','stm','stm32','struct',w,'termios','time','tls','tpcalib','uarray','uasyncio/__init__','uasyncio/core','uasyncio/event','uasyncio/funcs','uasyncio/lock','uasyncio/stream','uasyncio/tasks','ubinascii','ubluetooth','ucollections','ucrypto','ucryptolib','uctypes','uerrno','uftpd','uhashlib','uheapq','uio','ujson','ulab','ulab/approx','ulab/compare','ulab/fft','ulab/filter','ulab/linalg','ulab/numerical','ulab/poly','ulab/user','ulab/vector','umachine','umqtt/__init__','umqtt/robust','umqtt/simple',g,'uos','uplatform','uqueue','urandom','ure','urequests','urllib/urequest','usb/device','usb/device/cdc','usb/device/hid','usb/device/keyboard','usb/device/midi','usb/device/mouse','uselect','usocket','ussl','ustruct','usys','utelnetserver','utime','utimeq','uwebsocket','uzlib',C,'vfs','webassembly','websocket','websocket_helper',A1,'wipy','writer','xpt2046','ymodem','zephyr','zlib'];F.collect();stubber.create_all_stubs()
|
299
|
+
if __name__=='__main__'or k():
|
300
|
+
if not A6('no_auto_stubber.txt'):
|
301
|
+
Q(f"createstubs.py: {__version__}")
|
302
|
+
try:F.threshold(4096);F.enable()
|
294
303
|
except BaseException:pass
|
295
304
|
main()
|
Binary file
|
stubber/board/modulelist.txt
CHANGED
@@ -77,6 +77,8 @@ breakout_sgp30
|
|
77
77
|
breakout_trackball
|
78
78
|
breakout_vl53l5cx
|
79
79
|
btree
|
80
|
+
builtins
|
81
|
+
cc3200
|
80
82
|
cmath
|
81
83
|
collections
|
82
84
|
crypto
|
@@ -87,10 +89,12 @@ dht
|
|
87
89
|
display
|
88
90
|
display_driver_utils
|
89
91
|
ds18x20
|
92
|
+
embed
|
90
93
|
encoder
|
91
94
|
errno
|
92
95
|
esp
|
93
96
|
esp32
|
97
|
+
esp8266
|
94
98
|
espidf
|
95
99
|
espnow
|
96
100
|
ffi
|
@@ -125,11 +129,13 @@ lv_utils
|
|
125
129
|
lvgl
|
126
130
|
lwip
|
127
131
|
machine
|
132
|
+
marshal
|
128
133
|
math
|
129
134
|
microWebSocket
|
130
135
|
microWebSrv
|
131
136
|
microWebTemplate
|
132
137
|
micropython
|
138
|
+
mimxrt
|
133
139
|
mip
|
134
140
|
mip/__init__
|
135
141
|
mip/__main__
|
@@ -138,11 +144,13 @@ mpu6500
|
|
138
144
|
mpu9250
|
139
145
|
neopixel
|
140
146
|
network
|
147
|
+
nrf
|
141
148
|
ntptime
|
142
149
|
onewire
|
143
150
|
openamp
|
144
151
|
os
|
145
152
|
pcf85063a
|
153
|
+
pic16bit
|
146
154
|
picoexplorer
|
147
155
|
picographics
|
148
156
|
picokeypad
|
@@ -154,12 +162,16 @@ pimoroni_bus
|
|
154
162
|
pimoroni_i2c
|
155
163
|
plasma
|
156
164
|
platform
|
165
|
+
powerpc
|
157
166
|
pyb
|
158
167
|
pycom
|
159
168
|
pye
|
169
|
+
qemu
|
160
170
|
qrcode
|
161
171
|
queue
|
162
172
|
random
|
173
|
+
renesas
|
174
|
+
renesas-ra
|
163
175
|
requests
|
164
176
|
requests/__init__
|
165
177
|
rp2
|
@@ -172,6 +184,7 @@ ssd1306
|
|
172
184
|
ssh
|
173
185
|
ssl
|
174
186
|
stm
|
187
|
+
stm32
|
175
188
|
struct
|
176
189
|
sys
|
177
190
|
termios
|
@@ -212,6 +225,7 @@ umachine
|
|
212
225
|
umqtt/__init__
|
213
226
|
umqtt/robust
|
214
227
|
umqtt/simple
|
228
|
+
unix
|
215
229
|
uos
|
216
230
|
uplatform
|
217
231
|
uqueue
|
@@ -237,8 +251,10 @@ uwebsocket
|
|
237
251
|
uzlib
|
238
252
|
version
|
239
253
|
vfs
|
254
|
+
webassembly
|
240
255
|
websocket
|
241
256
|
websocket_helper
|
257
|
+
windows
|
242
258
|
wipy
|
243
259
|
writer
|
244
260
|
xpt2046
|