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.
Files changed (69) hide show
  1. {micropython_stubber-1.23.3.dist-info → micropython_stubber-1.24.1.dist-info}/METADATA +29 -11
  2. {micropython_stubber-1.23.3.dist-info → micropython_stubber-1.24.1.dist-info}/RECORD +68 -65
  3. {micropython_stubber-1.23.3.dist-info → micropython_stubber-1.24.1.dist-info}/WHEEL +1 -1
  4. mpflash/README.md +2 -2
  5. mpflash/mpflash/basicgit.py +22 -2
  6. mpflash/mpflash/common.py +23 -13
  7. mpflash/mpflash/downloaded.py +10 -2
  8. mpflash/mpflash/flash/esp.py +1 -1
  9. mpflash/mpflash/mpboard_id/__init__.py +9 -4
  10. mpflash/mpflash/mpboard_id/add_boards.py +25 -14
  11. mpflash/mpflash/mpboard_id/board.py +2 -2
  12. mpflash/mpflash/mpboard_id/board_id.py +10 -6
  13. mpflash/mpflash/mpboard_id/board_info.zip +0 -0
  14. mpflash/mpflash/mpremoteboard/__init__.py +13 -8
  15. mpflash/mpflash/vendor/board_database.py +185 -0
  16. mpflash/mpflash/vendor/readme.md +10 -1
  17. mpflash/mpflash/versions.py +28 -40
  18. mpflash/poetry.lock +1147 -231
  19. mpflash/pyproject.toml +4 -3
  20. stubber/__init__.py +1 -1
  21. stubber/board/createstubs.py +76 -34
  22. stubber/board/createstubs_db.py +34 -25
  23. stubber/board/createstubs_db_min.py +90 -83
  24. stubber/board/createstubs_db_mpy.mpy +0 -0
  25. stubber/board/createstubs_mem.py +34 -25
  26. stubber/board/createstubs_mem_min.py +123 -116
  27. stubber/board/createstubs_mem_mpy.mpy +0 -0
  28. stubber/board/createstubs_min.py +154 -145
  29. stubber/board/createstubs_mpy.mpy +0 -0
  30. stubber/board/modulelist.txt +16 -0
  31. stubber/codemod/enrich.py +301 -86
  32. stubber/codemod/merge_docstub.py +251 -66
  33. stubber/codemod/test_enrich.py +87 -0
  34. stubber/codemod/visitors/type_helpers.py +182 -0
  35. stubber/commands/build_cmd.py +16 -3
  36. stubber/commands/clone_cmd.py +3 -3
  37. stubber/commands/config_cmd.py +4 -2
  38. stubber/commands/enrich_folder_cmd.py +33 -21
  39. stubber/commands/get_core_cmd.py +1 -2
  40. stubber/commands/get_docstubs_cmd.py +60 -6
  41. stubber/commands/get_frozen_cmd.py +15 -12
  42. stubber/commands/get_mcu_cmd.py +3 -3
  43. stubber/commands/merge_cmd.py +1 -2
  44. stubber/commands/publish_cmd.py +19 -4
  45. stubber/commands/stub_cmd.py +3 -3
  46. stubber/commands/switch_cmd.py +3 -5
  47. stubber/commands/variants_cmd.py +3 -3
  48. stubber/cst_transformer.py +52 -17
  49. stubber/freeze/common.py +27 -11
  50. stubber/freeze/freeze_manifest_2.py +8 -1
  51. stubber/freeze/get_frozen.py +4 -1
  52. stubber/merge_config.py +111 -0
  53. stubber/minify.py +1 -2
  54. stubber/publish/database.py +51 -10
  55. stubber/publish/merge_docstubs.py +38 -17
  56. stubber/publish/package.py +32 -18
  57. stubber/publish/publish.py +8 -8
  58. stubber/publish/stubpackage.py +117 -50
  59. stubber/rst/lookup.py +205 -41
  60. stubber/rst/reader.py +106 -59
  61. stubber/rst/rst_utils.py +24 -11
  62. stubber/stubber.py +1 -1
  63. stubber/stubs_from_docs.py +31 -13
  64. stubber/update_module_list.py +2 -2
  65. stubber/utils/config.py +33 -13
  66. stubber/utils/post.py +9 -6
  67. stubber/publish/missing_class_methods.py +0 -51
  68. {micropython_stubber-1.23.3.dist-info → micropython_stubber-1.24.1.dist-info}/LICENSE +0 -0
  69. {micropython_stubber-1.23.3.dist-info → micropython_stubber-1.24.1.dist-info}/entry_points.txt +0 -0
@@ -1,20 +1,22 @@
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=Exception
14
- m=KeyError
15
- l=sorted
16
- k=NotImplementedError
17
- g='pycom'
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
- Y=print
26
- V='-preview'
27
- U=True
28
- T='-'
29
- S='board'
30
- R=len
31
- Q=open
32
- P=IndexError
33
- O='family'
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
- K='port'
37
- J='.'
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 h
52
- except N:from ucollections import OrderedDict as h
53
- __version__='v1.23.3'
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
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 L()
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<=L.INFO:A.prnt('INFO :',msg)
68
+ if A.level<=J.INFO:A.prnt('INFO :',msg)
65
69
  def warning(A,msg):
66
- if A.level<=L.WARNING:A.prnt('WARN :',msg)
70
+ if A.level<=J.WARNING:A.prnt('WARN :',msg)
67
71
  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)
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 k('MicroPython 1.13.0 cannot be stubbed')
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[K]));A.info('Board: {}'.format(B.info[S]));F.collect()
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[O]==b:B._fwid='{family}-v{version}-{port}-{board}'.format(**B.info).rstrip(T)
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:W(path+G)
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 P:E=B
97
- if E in{p,q,r,s,c,d,e}:G=1
98
- elif E in{t,u}:G=2
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:Y('MemoryError: {}'.format(J));sleep(1);reset()
104
- C=l([A for A in C if not A[0].startswith('__')],key=lambda x:x[4]);F.collect();return C,K
105
- def add_modules(A,modules):A.modules=l(set(A.modules)|set(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(J,G));F.collect();D=H
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(K,module_name,file_name=D):
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(J,'_')+'.pyi';I=K.path+G+L
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,J)
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
- 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
+ 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,m):A.warning('could not del new_module')
132
- F.collect();return U
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;D=indent;F.collect()
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(E,H,I,b,g)in a:
139
- if E in['classmethod','staticmethod','BaseException',N]:continue
140
- if E[0].isdigit():A.warning('NameError: invalid name {}'.format(E));continue
141
- if I=="<class 'type'>"and R(D)<=A1*4:
142
- Q=B;S=E.endswith(N)or E.endswith('Error')or E in['KeyboardInterrupt','StopIteration','SystemExit']
143
- if S:Q=N
144
- C='\n{}class {}({}):\n'.format(D,E,Q)
145
- if S:C+=D+' ...\n';J.write(C);continue
146
- J.write(C);L.write_object_stub(J,b,'{0}.{1}'.format(obj_name,E),D+' ',O+1);C=D+' def __init__(self, *argv, **kwargs) -> None:\n';C+=D+' ...\n\n';J.write(C)
147
- elif any(A in I for A in[u,t,'closure']):
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:C='{}@classmethod\n'.format(D)+'{}def {}(cls, *args, **kwargs) -> {}:\n'.format(D,E,T)
151
- else:C='{}def {}({}*args, **kwargs) -> {}:\n'.format(D,E,U,T)
152
- C+=D+' ...\n\n';J.write(C)
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];C=B
156
- if G in(r,p,q,s,'bytearray','bytes'):C=X.format(D,E,H,G)
157
- elif G in(e,d,c):f={e:'{}',d:'[]',c:'()'};C=X.format(D,E,f[G],G)
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
- C='{0}{1}: {2} ## = {4}\n'.format(D,E,G,I,H)
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
- C='{0}{1}: {2} ## {3} = {4}\n'.format(D,E,G,I,H)
166
- J.write(C)
167
- else:J.write("# all other, type = '{0}'\n".format(I));J.write(D+E+' # type: Incomplete\n')
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=x.format(path,G)
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=x.format(B.path,filename);B._json_first=U;W(B._json_name);A.info('Report file: {}'.format(B._json_name));F.collect()
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 Q(B._json_name,'w')as G:G.write('{');G.write(dumps({H:B.info})[1:-1]);G.write(f);G.write(dumps({o:{C:__version__},'stubtype':H})[1:-1]);G.write(f);G.write('"modules" :[\n')
188
- except E as I:A.error(y);B._json_name=D;raise I
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 n(z)
196
+ if not B._json_name:raise o(A0)
191
197
  try:
192
- with Q(B._json_name,'a')as C:
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(y)
202
+ except E:A.error(z)
197
203
  def report_end(B):
198
- if not B._json_name:raise n(z)
199
- with Q(B._json_name,'a')as C:C.write('\n]}')
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 W(path):
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]==A0:
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 X(s):
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 T in s:return B
219
- A=s.split(T)[1];return A
220
- if not V in s:return B
221
- A=s.split(V)[1].split(J)[1];return A
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
- Z='ev3-pybricks';Y='pycopy';W='unix';U='win32';T='arch';R='cpu';Q='ver';F='mpy';E='build'
224
- try:H=sys.implementation[0]
225
- except a:H=sys.implementation.name
226
- A=h({O:H,C:B,E:B,Q:B,K:sys.platform,S:'UNKNOWN',R:B,F:B,T:B})
227
- if A[K].startswith('pyb'):A[K]='stm32'
228
- elif A[K]==U:A[K]='windows'
229
- elif A[K]=='linux':A[K]=W
230
- try:A[C]=A2(sys.implementation.version)
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:J=sys.implementation._machine if'_machine'in M(sys.implementation)else os.uname().machine;A[S]=J;A[R]=J.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
233
- except(I,P):pass
234
- A[S]=A3()
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]=X(os.uname()[3])
238
- if not A[E]:A[E]=X(os.uname()[2])
239
- elif C in M(sys):A[E]=X(sys.version)
240
- except(I,P,a):pass
241
- if A[C]==B and sys.platform not in(W,U):
242
- try:c=os.uname();A[C]=c.release
243
- except(P,I,a):pass
244
- for(d,e,f)in[(Y,Y,'const'),(g,g,'FAT'),(Z,'pybricks.hubs','EV3Brick')]:
245
- try:i=__import__(e,D,D,f);A[O]=d;del i;break
246
- except(N,m):pass
247
- if A[O]==Z:A['release']='2.0.0'
248
- if A[O]==b:
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]);L=[D,'x86','x64','armv6','armv6m','armv7m','armv7em','armv7emsp','armv7emdp','xtensa','xtensawin'][G>>10]
253
- if L:A[T]=L
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(V):A[C]=A[C]+V
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 A2(version):
258
- A=version;B=J.join([str(A)for A in A[:3]])
259
- if R(A)>3 and A[3]:B+=T+A[3]
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 A3():
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=J
275
+ except(E,I):A=K
268
276
  B=A
269
- for B in[A,'/sd','/flash',G,J]:
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 A4(filename):
281
+ def A6(filename):
274
282
  try:
275
- if os.stat(filename)[0]>>14:return U
283
+ if os.stat(filename)[0]>>14:return V
276
284
  return H
277
285
  except E:return H
278
- def i():Y("-p, --path path to store the stubs in, defaults to '.'");sys.exit(1)
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 R(sys.argv)==3:
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:i()
285
- elif R(sys.argv)==2:i()
292
+ else:j()
293
+ elif S(sys.argv)==2:j()
286
294
  return path
287
- def j():
288
- try:A=bytes('abc',encoding='utf8');B=j.__module__;return H
289
- except(k,I):return U
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',w,'lsm6dsox','lv_colors','lv_utils','lvgl','lwip','machine','math','microWebSocket','microWebSrv','microWebTemplate',b,'mip','mip/__init__','mip/__main__','motor','mpu6500','mpu9250','neopixel','network','ntptime','onewire','openamp','os','pcf85063a','picoexplorer','picographics','picokeypad','picoscroll','picounicorn','picowireless','pimoroni','pimoroni_bus','pimoroni_i2c','plasma','platform','pyb',g,'pye','qrcode','queue','random','requests','requests/__init__','rp2','rtch','samd','select','servo','socket','ssd1306','ssh','ssl','stm','struct',v,'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','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','websocket','websocket_helper','wipy','writer','xpt2046','ymodem','zephyr','zlib'];F.collect();stubber.create_all_stubs()
291
- if __name__=='__main__'or j():
292
- if not A4('no_auto_stubber.txt'):
293
- try:F.threshold(4*1024);F.enable()
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
@@ -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