micropython-stubber 1.16.2__py3-none-any.whl → 1.17.0__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.16.2.dist-info → micropython_stubber-1.17.0.dist-info}/METADATA +2 -1
- {micropython_stubber-1.16.2.dist-info → micropython_stubber-1.17.0.dist-info}/RECORD +54 -54
- stubber/__init__.py +1 -1
- stubber/basicgit.py +27 -33
- stubber/board/board_info.csv +137 -103
- stubber/board/createstubs.py +222 -189
- stubber/board/createstubs_db.py +284 -214
- stubber/board/createstubs_db_min.py +286 -265
- stubber/board/createstubs_db_mpy.mpy +0 -0
- stubber/board/createstubs_lvgl.py +171 -113
- stubber/board/createstubs_lvgl_min.py +738 -275
- stubber/board/createstubs_lvgl_mpy.mpy +0 -0
- stubber/board/createstubs_mem.py +237 -174
- stubber/board/createstubs_mem_min.py +263 -247
- stubber/board/createstubs_mem_mpy.mpy +0 -0
- stubber/board/createstubs_min.py +242 -227
- stubber/board/createstubs_mpy.mpy +0 -0
- stubber/board/fw_info.py +135 -0
- stubber/board/modulelist.txt +1 -2
- stubber/codemod/_partials/__init__.py +1 -1
- stubber/codemod/_partials/db_main.py +90 -72
- stubber/codemod/_partials/modules_reader.py +29 -17
- stubber/codemod/board.py +2 -4
- stubber/codemod/enrich.py +1 -1
- stubber/commands/build_cmd.py +6 -4
- stubber/commands/get_docstubs_cmd.py +6 -11
- stubber/commands/get_frozen_cmd.py +6 -11
- stubber/commands/switch_cmd.py +6 -4
- stubber/data/board_info.csv +134 -101
- stubber/data/board_info.json +1357 -901
- stubber/freeze/freeze_manifest_2.py +2 -1
- stubber/freeze/get_frozen.py +28 -13
- stubber/minify.py +56 -43
- stubber/publish/candidates.py +15 -23
- stubber/publish/defaults.py +2 -2
- stubber/publish/merge_docstubs.py +5 -7
- stubber/publish/missing_class_methods.py +2 -2
- stubber/publish/pathnames.py +2 -2
- stubber/publish/publish.py +2 -1
- stubber/publish/stubpackage.py +20 -40
- stubber/rst/lookup.py +9 -7
- stubber/rst/reader.py +2 -1
- stubber/stubber.py +5 -6
- stubber/update_fallback.py +3 -1
- stubber/update_module_list.py +1 -1
- stubber/utils/__init__.py +1 -1
- stubber/utils/config.py +7 -9
- stubber/utils/post.py +1 -1
- stubber/utils/repos.py +10 -7
- stubber/utils/versions.py +48 -7
- stubber/variants.py +3 -3
- stubber/board/logging.py +0 -99
- {micropython_stubber-1.16.2.dist-info → micropython_stubber-1.17.0.dist-info}/LICENSE +0 -0
- {micropython_stubber-1.16.2.dist-info → micropython_stubber-1.17.0.dist-info}/WHEEL +0 -0
- {micropython_stubber-1.16.2.dist-info → micropython_stubber-1.17.0.dist-info}/entry_points.txt +0 -0
stubber/board/createstubs_min.py
CHANGED
@@ -1,257 +1,274 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
1
|
+
z='No report file'
|
2
|
+
y='Failed to create the report.'
|
3
|
+
x='{}/{}'
|
4
|
+
w='logging'
|
5
|
+
v='sys'
|
6
|
+
u='method'
|
7
|
+
t='function'
|
8
|
+
s='bool'
|
9
|
+
r='str'
|
10
|
+
q='float'
|
11
|
+
p='int'
|
12
|
+
o='stubber'
|
13
|
+
n=TypeError
|
14
|
+
m=Exception
|
15
|
+
l=KeyError
|
13
16
|
k=sorted
|
14
17
|
j=NotImplementedError
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
18
|
+
f='pycom'
|
19
|
+
e=',\n'
|
20
|
+
d='dict'
|
21
|
+
c='list'
|
22
|
+
b='tuple'
|
23
|
+
a='micropython'
|
24
|
+
Z=repr
|
25
|
+
Y=print
|
26
|
+
V='-preview'
|
27
|
+
U=True
|
28
|
+
T='-'
|
29
|
+
S='board'
|
24
30
|
R=len
|
25
|
-
Q=
|
31
|
+
Q=open
|
26
32
|
P=IndexError
|
27
|
-
O=
|
28
|
-
M=print
|
33
|
+
O='family'
|
29
34
|
N=ImportError
|
30
|
-
|
31
|
-
|
32
|
-
J='
|
33
|
-
I=
|
34
|
-
H=
|
35
|
-
A=False
|
35
|
+
M=dir
|
36
|
+
K='port'
|
37
|
+
J='.'
|
38
|
+
I=AttributeError
|
39
|
+
H=False
|
36
40
|
G='/'
|
37
|
-
E=
|
38
|
-
|
39
|
-
|
41
|
+
E=OSError
|
42
|
+
D=None
|
43
|
+
C='version'
|
40
44
|
B=''
|
41
|
-
import gc as
|
42
|
-
from
|
45
|
+
import gc as F,os,sys
|
46
|
+
from time import sleep
|
47
|
+
try:from ujson import dumps
|
48
|
+
except:from json import dumps
|
43
49
|
try:from machine import reset
|
44
50
|
except N:pass
|
45
|
-
try:from collections import OrderedDict as
|
46
|
-
except N:from ucollections import OrderedDict as
|
47
|
-
__version__='v1.
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
51
|
+
try:from collections import OrderedDict as g
|
52
|
+
except N:from ucollections import OrderedDict as g
|
53
|
+
__version__='v1.17.0'
|
54
|
+
A0=2
|
55
|
+
A1=2
|
56
|
+
A5=['lib','/lib','/sd/lib','/flash/lib',J]
|
57
|
+
class L:
|
58
|
+
INFO=20;WARNING=30;ERROR=40;level=INFO;prnt=Y
|
59
|
+
@staticmethod
|
60
|
+
def getLogger(name):return L()
|
61
|
+
@classmethod
|
62
|
+
def basicConfig(A,level):A.level=level
|
63
|
+
def info(A,msg):
|
64
|
+
if A.level<=L.INFO:A.prnt('INFO :',msg)
|
65
|
+
def warning(A,msg):
|
66
|
+
if A.level<=L.WARNING:A.prnt('WARN :',msg)
|
67
|
+
def error(A,msg):
|
68
|
+
if A.level<=L.ERROR:A.prnt('ERROR :',msg)
|
69
|
+
A=L.getLogger(o)
|
70
|
+
L.basicConfig(level=L.INFO)
|
52
71
|
class Stubber:
|
53
|
-
def __init__(
|
54
|
-
|
72
|
+
def __init__(B,path=D,firmware_id=D):
|
73
|
+
C=firmware_id
|
55
74
|
try:
|
56
75
|
if os.uname().release=='1.13.0'and os.uname().version<'v1.13-103':raise j('MicroPython 1.13.0 cannot be stubbed')
|
57
|
-
except
|
58
|
-
A.
|
59
|
-
if B
|
60
|
-
elif
|
61
|
-
else:
|
62
|
-
|
76
|
+
except I:pass
|
77
|
+
B.info=_info();A.info('Port: {}'.format(B.info[K]));A.info('Board: {}'.format(B.info[S]));F.collect()
|
78
|
+
if C:B._fwid=C.lower()
|
79
|
+
elif B.info[O]==a:B._fwid='{family}-v{version}-{port}-{board}'.format(**B.info).rstrip(T)
|
80
|
+
else:B._fwid='{family}-v{version}-{port}'.format(**B.info)
|
81
|
+
B._start_free=F.mem_free()
|
63
82
|
if path:
|
64
83
|
if path.endswith(G):path=path[:-1]
|
65
84
|
else:path=get_root()
|
66
|
-
|
67
|
-
try:
|
68
|
-
except
|
69
|
-
|
85
|
+
B.path='{}/stubs/{}'.format(path,B.flat_fwid).replace('//',G)
|
86
|
+
try:W(path+G)
|
87
|
+
except E:A.error('error creating stub folder {}'.format(path))
|
88
|
+
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
|
70
89
|
def get_obj_attributes(L,item_instance):
|
71
|
-
|
72
|
-
for A in
|
73
|
-
if A.startswith(
|
90
|
+
H=item_instance;C=[];K=[]
|
91
|
+
for A in M(H):
|
92
|
+
if A.startswith('__')and not A in L.modules:continue
|
74
93
|
try:
|
75
|
-
|
76
|
-
try:
|
77
|
-
except P:
|
78
|
-
if
|
79
|
-
elif
|
80
|
-
elif
|
94
|
+
D=getattr(H,A)
|
95
|
+
try:E=Z(type(D)).split("'")[1]
|
96
|
+
except P:E=B
|
97
|
+
if E in{p,q,r,s,b,c,d}:G=1
|
98
|
+
elif E in{t,u}:G=2
|
99
|
+
elif E in'class':G=3
|
81
100
|
else:G=4
|
82
|
-
|
83
|
-
except
|
84
|
-
except MemoryError as
|
85
|
-
|
101
|
+
C.append((A,Z(D),Z(type(D)),D,G))
|
102
|
+
except I as J:K.append("Couldn't get attribute '{}' from object '{}', Err: {}".format(A,H,J))
|
103
|
+
except MemoryError as J:Y('MemoryError: {}'.format(J));sleep(1);reset()
|
104
|
+
C=k([A for A in C if not A[0].startswith('__')],key=lambda x:x[4]);F.collect();return C,K
|
86
105
|
def add_modules(A,modules):A.modules=k(set(A.modules)|set(modules))
|
87
|
-
def create_all_stubs(
|
88
|
-
|
89
|
-
for
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
if
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
C.collect();return K
|
106
|
+
def create_all_stubs(B):
|
107
|
+
A.info('Start micropython-stubber {} on {}'.format(__version__,B._fwid));B.report_start();F.collect()
|
108
|
+
for C in B.modules:B.create_one_stub(C)
|
109
|
+
B.report_end();A.info('Finally done')
|
110
|
+
def create_one_stub(C,module_name):
|
111
|
+
B=module_name
|
112
|
+
if B in C.problematic:A.warning('Skip module: {:<25} : Known problematic'.format(B));return H
|
113
|
+
if B in C.excluded:A.warning('Skip module: {:<25} : Excluded'.format(B));return H
|
114
|
+
I='{}/{}.pyi'.format(C.path,B.replace(J,G));F.collect();D=H
|
115
|
+
try:D=C.create_module_stub(B,I)
|
116
|
+
except E:return H
|
117
|
+
F.collect();return D
|
118
|
+
def create_module_stub(K,module_name,file_name=D):
|
119
|
+
I=file_name;C=module_name
|
120
|
+
if I is D:L=C.replace(J,'_')+'.pyi';I=K.path+G+L
|
121
|
+
else:L=I.split(G)[-1]
|
122
|
+
if G in C:C=C.replace(G,J)
|
123
|
+
M=D
|
124
|
+
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
|
+
except N:return H
|
126
|
+
W(I)
|
127
|
+
with Q(I,'w')as O:R=str(K.info).replace('OrderedDict(',B).replace('})','}');S='"""\nModule: \'{0}\' on {1}\n"""\n# MCU: {2}\n# Stubber: {3}\n'.format(C,K._fwid,R,__version__);O.write(S);O.write('from __future__ import annotations\nfrom typing import Any, Generator\nfrom _typeshed import Incomplete\n\n');K.write_object_stub(O,M,C,B)
|
128
|
+
K.report_add(C,I)
|
129
|
+
if C not in{'os',v,w,'gc'}:
|
130
|
+
try:del M
|
131
|
+
except(E,l):A.warning('could not del new_module')
|
132
|
+
F.collect();return U
|
115
133
|
def write_object_stub(K,fp,object_expr,obj_name,indent,in_class=0):
|
116
|
-
|
117
|
-
if
|
118
|
-
|
119
|
-
if
|
120
|
-
for(E,J,
|
121
|
-
if E in['classmethod','staticmethod','BaseException',
|
122
|
-
if E[0].isdigit():continue
|
123
|
-
if
|
124
|
-
|
125
|
-
if
|
126
|
-
|
127
|
-
if
|
128
|
-
|
129
|
-
elif any(A in
|
130
|
-
|
131
|
-
if
|
132
|
-
if
|
133
|
-
else:
|
134
|
-
|
135
|
-
elif
|
136
|
-
elif
|
137
|
-
|
138
|
-
if
|
139
|
-
elif
|
140
|
-
|
141
|
-
if
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
try:del E,J,G,T
|
147
|
-
except(F,Q,l):pass
|
134
|
+
X='generator';W='{0}{1}: {3} = {2}\n';V='bound_method';U='Incomplete';N=in_class;M='Exception';L=object_expr;I=fp;D=indent;F.collect()
|
135
|
+
if L in K.problematic:A.warning('SKIPPING problematic module:{}'.format(L));return
|
136
|
+
Y,O=K.get_obj_attributes(L)
|
137
|
+
if O:A.error(O)
|
138
|
+
for(E,J,H,Z,e)in Y:
|
139
|
+
if E in['classmethod','staticmethod','BaseException',M]:continue
|
140
|
+
if E[0].isdigit():A.warning('NameError: invalid name {}'.format(E));continue
|
141
|
+
if H=="<class 'type'>"and R(D)<=A1*4:
|
142
|
+
P=B;Q=E.endswith(M)or E.endswith('Error')or E in['KeyboardInterrupt','StopIteration','SystemExit']
|
143
|
+
if Q:P=M
|
144
|
+
C='\n{}class {}({}):\n'.format(D,E,P)
|
145
|
+
if Q:C+=D+' ...\n';I.write(C);continue
|
146
|
+
I.write(C);K.write_object_stub(I,Z,'{0}.{1}'.format(obj_name,E),D+' ',N+1);C=D+' def __init__(self, *argv, **kwargs) -> None:\n';C+=D+' ...\n\n';I.write(C)
|
147
|
+
elif any(A in H for A in[u,t,'closure']):
|
148
|
+
S=U;T=B
|
149
|
+
if N>0:T='self, '
|
150
|
+
if V in H or V in J:C='{}@classmethod\n'.format(D)+'{}def {}(cls, *args, **kwargs) -> {}:\n'.format(D,E,S)
|
151
|
+
else:C='{}def {}({}*args, **kwargs) -> {}:\n'.format(D,E,T,S)
|
152
|
+
C+=D+' ...\n\n';I.write(C)
|
153
|
+
elif H=="<class 'module'>":0
|
154
|
+
elif H.startswith("<class '"):
|
155
|
+
G=H[8:-2];C=B
|
156
|
+
if G in(r,p,q,s,'bytearray','bytes'):C=W.format(D,E,J,G)
|
157
|
+
elif G in(d,c,b):a={d:'{}',c:'[]',b:'()'};C=W.format(D,E,a[G],G)
|
158
|
+
elif G in('object','set','frozenset','Pin',X):
|
159
|
+
if G==X:G='Generator'
|
160
|
+
C='{0}{1}: {2} ## = {4}\n'.format(D,E,G,H,J)
|
161
|
+
else:G=U;C='{0}{1}: {2} ## {3} = {4}\n'.format(D,E,G,H,J)
|
162
|
+
I.write(C)
|
163
|
+
else:I.write("# all other, type = '{0}'\n".format(H));I.write(D+E+' # type: Incomplete\n')
|
148
164
|
@property
|
149
165
|
def flat_fwid(self):
|
150
166
|
A=self._fwid;B=' .()/\\:$'
|
151
|
-
for C in B:A=A.replace(C,
|
167
|
+
for C in B:A=A.replace(C,'_')
|
152
168
|
return A
|
153
|
-
def clean(
|
154
|
-
if path is
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
169
|
+
def clean(C,path=D):
|
170
|
+
if path is D:path=C.path
|
171
|
+
A.info('Clean/remove files in folder: {}'.format(path))
|
172
|
+
try:os.stat(path);F=os.listdir(path)
|
173
|
+
except(E,I):return
|
174
|
+
for G in F:
|
175
|
+
B=x.format(path,G)
|
176
|
+
try:os.remove(B)
|
177
|
+
except E:
|
178
|
+
try:C.clean(B);os.rmdir(B)
|
179
|
+
except E:pass
|
180
|
+
def report_start(B,filename='modules.json'):
|
181
|
+
H='firmware';B._json_name=x.format(B.path,filename);B._json_first=U;W(B._json_name);A.info('Report file: {}'.format(B._json_name));F.collect()
|
182
|
+
try:
|
183
|
+
with Q(B._json_name,'w')as G:G.write('{');G.write(dumps({H:B.info})[1:-1]);G.write(e);G.write(dumps({o:{C:__version__},'stubtype':H})[1:-1]);G.write(e);G.write('"modules" :[\n')
|
184
|
+
except E as I:A.error(y);B._json_name=D;raise I
|
185
|
+
def report_add(B,module_name,stub_file):
|
186
|
+
if not B._json_name:raise m(z)
|
165
187
|
try:
|
166
|
-
with
|
167
|
-
B.
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
def T(s):
|
190
|
-
A=' on '
|
188
|
+
with Q(B._json_name,'a')as C:
|
189
|
+
if not B._json_first:C.write(e)
|
190
|
+
else:B._json_first=H
|
191
|
+
D='{{"module": "{}", "file": "{}"}}'.format(module_name,stub_file.replace('\\',G));C.write(D)
|
192
|
+
except E:A.error(y)
|
193
|
+
def report_end(B):
|
194
|
+
if not B._json_name:raise m(z)
|
195
|
+
with Q(B._json_name,'a')as C:C.write('\n]}')
|
196
|
+
A.info('Path: {}'.format(B.path))
|
197
|
+
def W(path):
|
198
|
+
B=D=0
|
199
|
+
while B!=-1:
|
200
|
+
B=path.find(G,D)
|
201
|
+
if B!=-1:
|
202
|
+
C=path[0]if B==0 else path[:B]
|
203
|
+
try:I=os.stat(C)
|
204
|
+
except E as F:
|
205
|
+
if F.args[0]==A0:
|
206
|
+
try:os.mkdir(C)
|
207
|
+
except E as H:A.error('failed to create folder {}'.format(C));raise H
|
208
|
+
D=B+1
|
209
|
+
def X(s):
|
210
|
+
C=' on '
|
191
211
|
if not s:return B
|
192
|
-
|
193
|
-
|
212
|
+
s=s.split(C,1)[0]if C in s else s
|
213
|
+
if s.startswith('v'):
|
214
|
+
if not T in s:return B
|
215
|
+
A=s.split(T)[1];return A
|
216
|
+
if not V in s:return B
|
217
|
+
A=s.split(V)[1].split(J)[1];return A
|
194
218
|
def _info():
|
195
|
-
|
196
|
-
if A[
|
197
|
-
elif A[
|
198
|
-
elif A[
|
199
|
-
try:A[
|
200
|
-
except
|
201
|
-
try:
|
202
|
-
except(
|
203
|
-
|
204
|
-
for U in[A+'/board_info.csv'for A in z]:
|
205
|
-
if g(U):
|
206
|
-
M=A[J].strip()
|
207
|
-
if f(A,M,U):break
|
208
|
-
if X in M:
|
209
|
-
M=M.split(X)[0].strip()
|
210
|
-
if f(A,M,U):break
|
211
|
-
A[J]=h
|
212
|
-
A[J]=A[J].replace(' ',S);C.collect()
|
219
|
+
Y='ev3-pybricks';W='pycopy';U='unix';T='win32';R='arch';Q='cpu';L='ver';F='mpy';E='build';A=g({O:sys.implementation.name,C:B,E:B,L:B,K:sys.platform,S:'UNKNOWN',Q:B,F:B,R:B})
|
220
|
+
if A[K].startswith('pyb'):A[K]='stm32'
|
221
|
+
elif A[K]==T:A[K]='windows'
|
222
|
+
elif A[K]=='linux':A[K]=U
|
223
|
+
try:A[C]=A2(sys.implementation.version)
|
224
|
+
except I:pass
|
225
|
+
try:H=sys.implementation._machine if'_machine'in M(sys.implementation)else os.uname().machine;A[S]=H;A[Q]=H.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
|
226
|
+
except(I,P):pass
|
227
|
+
A[S]=A3()
|
213
228
|
try:
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
if A[
|
220
|
-
try:
|
221
|
-
except(P,
|
222
|
-
for(
|
223
|
-
try:
|
224
|
-
except(N,
|
225
|
-
if A[
|
226
|
-
if A[
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
A[
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
229
|
+
if'uname'in M(os):
|
230
|
+
A[E]=X(os.uname()[3])
|
231
|
+
if not A[E]:A[E]=X(os.uname()[2])
|
232
|
+
elif C in M(sys):A[E]=X(sys.version)
|
233
|
+
except(I,P,n):pass
|
234
|
+
if A[C]==B and sys.platform not in(U,T):
|
235
|
+
try:Z=os.uname();A[C]=Z.release
|
236
|
+
except(P,I,n):pass
|
237
|
+
for(b,c,d)in[(W,W,'const'),(f,f,'FAT'),(Y,'pybricks.hubs','EV3Brick')]:
|
238
|
+
try:e=__import__(c,D,D,d);A[O]=b;del e;break
|
239
|
+
except(N,l):pass
|
240
|
+
if A[O]==Y:A['release']='2.0.0'
|
241
|
+
if A[O]==a:
|
242
|
+
A[C]
|
243
|
+
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]
|
244
|
+
if F in A and A[F]:
|
245
|
+
G=int(A[F]);J=[D,'x86','x64','armv6','armv6m','armv7m','armv7em','armv7emsp','armv7emdp','xtensa','xtensawin'][G>>10]
|
246
|
+
if J:A[R]=J
|
247
|
+
A[F]='v{}.{}'.format(G&255,G>>8&3)
|
248
|
+
if A[E]and not A[C].endswith(V):A[C]=A[C]+V
|
249
|
+
A[L]=f"{A[C]}-{A[E]}"if A[E]else f"{A[C]}";return A
|
250
|
+
def A2(version):
|
251
|
+
A=version;B=J.join([str(A)for A in A[:3]])
|
252
|
+
if R(A)>3 and A[3]:B+=T+A[3]
|
253
|
+
return B
|
254
|
+
def A3():
|
255
|
+
try:from boardname import BOARDNAME as C;A.info('Found BOARDNAME: {}'.format(C))
|
256
|
+
except N:A.warning('BOARDNAME not found');C=B
|
257
|
+
return C
|
241
258
|
def get_root():
|
242
259
|
try:A=os.getcwd()
|
243
|
-
except(
|
260
|
+
except(E,I):A=J
|
244
261
|
B=A
|
245
|
-
for B in[A,'/sd','/flash',G,
|
262
|
+
for B in[A,'/sd','/flash',G,J]:
|
246
263
|
try:C=os.stat(B);break
|
247
|
-
except
|
264
|
+
except E:continue
|
248
265
|
return B
|
249
|
-
def
|
266
|
+
def A4(filename):
|
250
267
|
try:
|
251
|
-
if os.stat(filename)[0]>>14:return
|
252
|
-
return
|
253
|
-
except
|
254
|
-
def h():sys.exit(1)
|
268
|
+
if os.stat(filename)[0]>>14:return U
|
269
|
+
return H
|
270
|
+
except E:return H
|
271
|
+
def h():Y("-p, --path path to store the stubs in, defaults to '.'");sys.exit(1)
|
255
272
|
def read_path():
|
256
273
|
path=B
|
257
274
|
if R(sys.argv)==3:
|
@@ -261,13 +278,11 @@ def read_path():
|
|
261
278
|
elif R(sys.argv)==2:h()
|
262
279
|
return path
|
263
280
|
def i():
|
264
|
-
try:
|
265
|
-
except(j,
|
266
|
-
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','json','lcd160cr','lodepng',
|
281
|
+
try:A=bytes('abc',encoding='utf8');B=i.__module__;return H
|
282
|
+
except(j,I):return U
|
283
|
+
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','json','lcd160cr','lodepng',w,'lsm6dsox','lv_colors','lv_utils','lvgl','lwip','machine','math','microWebSocket','microWebSrv','microWebTemplate',a,'mip','mip/__init__','mip/__main__','motor','mpu6500','mpu9250','neopixel','network','ntptime','onewire','os','pcf85063a','picoexplorer','picographics','picokeypad','picoscroll','picounicorn','picowireless','pimoroni','pimoroni_bus','pimoroni_i2c','plasma','platform','pyb',f,'pye','qrcode','queue','random','requests','requests/__init__','rp2','rtch','samd','select','servo','socket','ssd1306','ssh','ssl','stm','struct',v,'termios','time','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','uos','uplatform','uqueue','urandom','ure','urequests','urllib/urequest','uselect','usocket','ussl','ustruct','usys','utelnetserver','utime','utimeq','uwebsocket','uzlib',C,'websocket','websocket_helper','wipy','writer','xpt2046','ymodem','zephyr','zlib'];F.collect();stubber.create_all_stubs()
|
267
284
|
if __name__=='__main__'or i():
|
268
|
-
|
269
|
-
|
270
|
-
if not g('no_auto_stubber.txt'):
|
271
|
-
try:C.threshold(4*1024);C.enable()
|
285
|
+
if not A4('no_auto_stubber.txt'):
|
286
|
+
try:F.threshold(4*1024);F.enable()
|
272
287
|
except BaseException:pass
|
273
288
|
main()
|
Binary file
|