micropython-stubber 1.13.6__py3-none-any.whl → 1.13.8__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 (33) hide show
  1. {micropython_stubber-1.13.6.dist-info → micropython_stubber-1.13.8.dist-info}/METADATA +1 -1
  2. {micropython_stubber-1.13.6.dist-info → micropython_stubber-1.13.8.dist-info}/RECORD +32 -32
  3. stubber/__init__.py +3 -2
  4. stubber/basicgit.py +10 -7
  5. stubber/board/createstubs.py +4 -3
  6. stubber/board/createstubs_db.py +5 -4
  7. stubber/board/createstubs_db_min.py +33 -33
  8. stubber/board/createstubs_db_mpy.mpy +0 -0
  9. stubber/board/createstubs_info.py +906 -0
  10. stubber/board/createstubs_lvgl.py +5 -4
  11. stubber/board/createstubs_lvgl_min.py +41 -41
  12. stubber/board/createstubs_lvgl_mpy.mpy +0 -0
  13. stubber/board/createstubs_mem.py +5 -4
  14. stubber/board/createstubs_mem_min.py +48 -48
  15. stubber/board/createstubs_mem_mpy.mpy +0 -0
  16. stubber/board/createstubs_min.py +41 -41
  17. stubber/board/createstubs_mpy.mpy +0 -0
  18. stubber/codemod/board.py +1 -1
  19. stubber/commands/cli.py +1 -1
  20. stubber/commands/switch_cmd.py +8 -1
  21. stubber/data/micropython_tags.csv +1 -1
  22. stubber/get_cpython.py +3 -1
  23. stubber/publish/enums.py +8 -0
  24. stubber/publish/merge_docstubs.py +5 -3
  25. stubber/publish/publish.py +5 -3
  26. stubber/publish/stubpacker.py +7 -7
  27. stubber/rst/lookup.py +1 -1
  28. stubber/utils/manifest.py +1 -1
  29. stubber/utils/repos.py +22 -9
  30. stubber/utils/my_version.py +0 -15
  31. {micropython_stubber-1.13.6.dist-info → micropython_stubber-1.13.8.dist-info}/LICENSE +0 -0
  32. {micropython_stubber-1.13.6.dist-info → micropython_stubber-1.13.8.dist-info}/WHEEL +0 -0
  33. {micropython_stubber-1.13.6.dist-info → micropython_stubber-1.13.8.dist-info}/entry_points.txt +0 -0
@@ -3,7 +3,7 @@ Create stubs for the lvgl modules on a MicroPython board.
3
3
 
4
4
  Note that the stubs can be very large, and it may be best to directly store them on an SD card if your device supports this.
5
5
 
6
- This variant was generated from createstubs.py by micropython-stubber v1.13.4
6
+ This variant was generated from createstubs.py by micropython-stubber v1.13.7
7
7
  """
8
8
  # Copyright (c) 2019-2023 Jos Verlinde
9
9
  # pylint: disable= invalid-name, missing-function-docstring, import-outside-toplevel, logging-not-lazy
@@ -24,7 +24,7 @@ try:
24
24
  except ImportError:
25
25
  from ucollections import OrderedDict # type: ignore
26
26
 
27
- __version__ = "v1.13.4"
27
+ __version__ = "v1.13.7"
28
28
  ENOENT = 2
29
29
  _MAX_CLASS_LEVEL = 2 # Max class nesting
30
30
  LIBS = [".", "/lib", "/sd/lib", "/flash/lib", "lib"]
@@ -94,7 +94,7 @@ class Stubber:
94
94
  _errors = []
95
95
  self._log.debug("get attributes {} {}".format(repr(item_instance), item_instance))
96
96
  for name in dir(item_instance):
97
- if name.startswith("_"):
97
+ if name.startswith("_") and not name in self.modules:
98
98
  continue
99
99
  self._log.debug("get attribute {}".format(name))
100
100
  try:
@@ -121,7 +121,8 @@ class Stubber:
121
121
  reset()
122
122
 
123
123
  # remove internal __
124
- _result = sorted([i for i in _result if not (i[0].startswith("_"))], key=lambda x: x[4])
124
+ # _result = sorted([i for i in _result if not (i[0].startswith("_"))], key=lambda x: x[4])
125
+ _result = sorted([i for i in _result if not (i[0].startswith("__"))], key=lambda x: x[4])
125
126
  gc.collect()
126
127
  return _result, _errors
127
128
 
@@ -17,12 +17,12 @@ Y='list'
17
17
  X='tuple'
18
18
  W=open
19
19
  V=repr
20
- T=KeyError
21
- S=IndexError
22
- R=dir
23
- Q=ImportError
24
- P=True
25
- O='_'
20
+ T='_'
21
+ S=KeyError
22
+ R=IndexError
23
+ Q=dir
24
+ P=ImportError
25
+ O=True
26
26
  N='family'
27
27
  M=len
28
28
  L='.'
@@ -38,10 +38,10 @@ B=''
38
38
  import gc as C,sys,uos as os
39
39
  from ujson import dumps as a
40
40
  try:from machine import reset
41
- except Q:pass
41
+ except P:pass
42
42
  try:from collections import OrderedDict as b
43
- except Q:from ucollections import OrderedDict as b
44
- __version__='v1.13.4'
43
+ except P:from ucollections import OrderedDict as b
44
+ __version__='v1.13.7'
45
45
  u=2
46
46
  v=2
47
47
  w=[L,'/lib','/sd/lib','/flash/lib','lib']
@@ -65,21 +65,21 @@ class Stubber:
65
65
  except F:J('error creating stub folder {}'.format(path))
66
66
  A.problematic=['upip','upysh','webrepl_setup','http_client','http_client_ssl','http_server','http_server_ssl'];A.excluded=['webrepl','_webrepl','port_diag','example_sub_led.py','example_pub_button.py'];A.modules=[]
67
67
  def get_obj_attributes(L,item_instance):
68
- H=item_instance;A=[];J=[]
69
- for D in R(H):
70
- if D.startswith(O):continue
68
+ H=item_instance;D=[];J=[]
69
+ for A in Q(H):
70
+ if A.startswith(T)and not A in L.modules:continue
71
71
  try:
72
- E=getattr(H,D)
72
+ E=getattr(H,A)
73
73
  try:F=V(type(E)).split("'")[1]
74
- except S:F=B
74
+ except R:F=B
75
75
  if F in{n,o,p,q,X,Y,Z}:G=1
76
76
  elif F in{r,s}:G=2
77
77
  elif F in'class':G=3
78
78
  else:G=4
79
- A.append((D,V(E),V(type(E)),E,G))
80
- except I as K:J.append("Couldn't get attribute '{}' from object '{}', Err: {}".format(D,H,K))
79
+ D.append((A,V(E),V(type(E)),E,G))
80
+ except I as K:J.append("Couldn't get attribute '{}' from object '{}', Err: {}".format(A,H,K))
81
81
  except MemoryError as K:sleep(1);reset()
82
- A=i([A for A in A if not A[0].startswith(O)],key=lambda x:x[4]);C.collect();return A,J
82
+ D=i([A for A in D if not A[0].startswith('__')],key=lambda x:x[4]);C.collect();return D,J
83
83
  def add_modules(A,modules):A.modules=i(set(A.modules)|set(modules))
84
84
  def create_all_stubs(A):
85
85
  C.collect()
@@ -94,27 +94,27 @@ class Stubber:
94
94
  C.collect();return D
95
95
  def create_module_stub(I,module_name,file_name=E):
96
96
  D=file_name;A=module_name
97
- if D is E:K=A.replace(L,O)+'.py';D=I.path+G+K
97
+ if D is E:K=A.replace(L,T)+'.py';D=I.path+G+K
98
98
  else:K=D.split(G)[-1]
99
99
  if G in A:A=A.replace(G,L)
100
100
  M=E
101
- try:M=__import__(A,E,E,'*');R=C.mem_free();J('Stub module: {:<25} to file: {:<70} mem:{:>5}'.format(A,K,R))
102
- except Q:return H
101
+ try:M=__import__(A,E,E,'*');Q=C.mem_free();J('Stub module: {:<25} to file: {:<70} mem:{:>5}'.format(A,K,Q))
102
+ except P:return H
103
103
  c(D)
104
- with W(D,'w')as N:S='"""\nModule: \'{0}\' on {1}\n"""\n# MCU: {2}\n# Stubber: {3}\n'.format(A,I._fwid,I.info,__version__);N.write(S);N.write('from typing import Any\n\n');I.write_object_stub(N,M,A,B)
104
+ with W(D,'w')as N:R='"""\nModule: \'{0}\' on {1}\n"""\n# MCU: {2}\n# Stubber: {3}\n'.format(A,I._fwid,I.info,__version__);N.write(R);N.write('from typing import Any\n\n');I.write_object_stub(N,M,A,B)
105
105
  I._report.append('{{"module": "{}", "file": "{}"}}'.format(A,D.replace('\\',G)))
106
106
  if A not in{'os','sys','logging','gc'}:
107
107
  try:del M
108
- except (F,T):pass
108
+ except (F,S):pass
109
109
  try:del sys.modules[A]
110
- except T:pass
111
- C.collect();return P
110
+ except S:pass
111
+ C.collect();return O
112
112
  def write_object_stub(L,fp,object_expr,obj_name,indent,in_class=0):
113
113
  d='{0}{1} = {2} # type: {3}\n';c='bound_method';b='Any';Q=in_class;P=object_expr;O='Exception';H=fp;D=indent;C.collect()
114
114
  if P in L.problematic:return
115
115
  R,N=L.get_obj_attributes(P)
116
116
  if N:J(N)
117
- for (E,K,G,S,f) in R:
117
+ for (E,K,G,T,f) in R:
118
118
  if E in['classmethod','staticmethod','BaseException',O]:continue
119
119
  if E[0].isdigit():continue
120
120
  if G=="<class 'type'>"and M(D)<=v*4:
@@ -122,7 +122,7 @@ class Stubber:
122
122
  if V:U=O
123
123
  A='\n{}class {}({}):\n'.format(D,E,U)
124
124
  if V:A+=D+' ...\n';H.write(A);return
125
- H.write(A);L.write_object_stub(H,S,'{0}.{1}'.format(obj_name,E),D+' ',Q+1);A=D+' def __init__(self, *argv, **kwargs) -> None:\n';A+=D+' ...\n\n';H.write(A)
125
+ H.write(A);L.write_object_stub(H,T,'{0}.{1}'.format(obj_name,E),D+' ',Q+1);A=D+' def __init__(self, *argv, **kwargs) -> None:\n';A+=D+' ...\n\n';H.write(A)
126
126
  elif s in G or r in G:
127
127
  W=b;a=B
128
128
  if Q>0:a='self, '
@@ -140,12 +140,12 @@ class Stubber:
140
140
  H.write(A)
141
141
  else:H.write("# all other, type = '{0}'\n".format(G));H.write(D+E+' # type: Any\n')
142
142
  del R;del N
143
- try:del E,K,G,S
144
- except (F,T,j):pass
143
+ try:del E,K,G,T
144
+ except (F,S,j):pass
145
145
  @property
146
146
  def flat_fwid(self):
147
147
  A=self._fwid;B=' .()/\\:$'
148
- for C in B:A=A.replace(C,O)
148
+ for C in B:A=A.replace(C,T)
149
149
  return A
150
150
  def clean(B,path=E):
151
151
  if path is E:path=B.path
@@ -162,7 +162,7 @@ class Stubber:
162
162
  J('Created stubs for {} modules on board {}\nPath: {}'.format(M(A._report),A._fwid,A.path));E=t.format(A.path,filename);C.collect()
163
163
  try:
164
164
  with W(E,'w')as B:
165
- A.write_json_header(B);D=P
165
+ A.write_json_header(B);D=O
166
166
  for G in A._report:A.write_json_node(B,G,D);D=H
167
167
  A.write_json_end(B)
168
168
  I=A._start_free-C.mem_free()
@@ -193,8 +193,8 @@ def _info():
193
193
  h='ev3-pybricks';g='pycom';f='pycopy';c='GENERIC';a='arch';Z='cpu';Y='ver';V='with';G='mpy';F='build';A=b({N:sys.implementation.name,D:B,F:B,Y:B,l:'stm32'if sys.platform.startswith('pyb')else sys.platform,K:c,Z:B,G:B,a:B})
194
194
  try:A[D]=L.join([str(A)for A in sys.implementation.version])
195
195
  except I:pass
196
- try:W=sys.implementation._machine if'_machine'in R(sys.implementation)else os.uname().machine;A[K]=W.strip();A[Z]=W.split(V)[1].strip();A[G]=sys.implementation._mpy if'_mpy'in R(sys.implementation)else sys.implementation.mpy if G in R(sys.implementation)else B
197
- except (I,S):pass
196
+ try:W=sys.implementation._machine if'_machine'in Q(sys.implementation)else os.uname().machine;A[K]=W.strip();A[Z]=W.split(V)[1].strip();A[G]=sys.implementation._mpy if'_mpy'in Q(sys.implementation)else sys.implementation.mpy if G in Q(sys.implementation)else B
197
+ except (I,R):pass
198
198
  C.collect()
199
199
  for J in [A+'/board_info.csv'for A in w]:
200
200
  if e(J):
@@ -204,26 +204,26 @@ def _info():
204
204
  H=H.split(V)[0].strip()
205
205
  if d(A,H,J):break
206
206
  A[K]=c
207
- A[K]=A[K].replace(' ',O);C.collect()
207
+ A[K]=A[K].replace(' ',T);C.collect()
208
208
  try:
209
209
  A[F]=U(os.uname()[3])
210
210
  if not A[F]:A[F]=U(os.uname()[2])
211
211
  if not A[F]and';'in sys.version:A[F]=U(sys.version.split(';')[1])
212
- except (I,S):pass
212
+ except (I,R):pass
213
213
  if A[F]and M(A[F])>5:A[F]=B
214
214
  if A[D]==B and sys.platform not in('unix','win32'):
215
215
  try:i=os.uname();A[D]=i.release
216
- except (S,I,TypeError):pass
216
+ except (R,I,TypeError):pass
217
217
  for (j,k,n) in [(f,f,'const'),(g,g,'FAT'),(h,'pybricks.hubs','EV3Brick')]:
218
218
  try:o=__import__(k,E,E,n);A[N]=j;del o;break
219
- except (Q,T):pass
219
+ except (P,S):pass
220
220
  if A[N]==h:A['release']='2.0.0'
221
221
  if A[N]==m:
222
222
  if A[D]and A[D].endswith('.0')and A[D]>='1.10.0'and A[D]<='1.19.9':A[D]=A[D][:-2]
223
223
  if G in A and A[G]:
224
- P=int(A[G]);X=[E,'x86','x64','armv6','armv6m','armv7m','armv7em','armv7emsp','armv7emdp','xtensa','xtensawin'][P>>10]
224
+ O=int(A[G]);X=[E,'x86','x64','armv6','armv6m','armv7m','armv7em','armv7emsp','armv7emdp','xtensa','xtensawin'][O>>10]
225
225
  if X:A[a]=X
226
- A[G]='v{}.{}'.format(P&255,P>>8&3)
226
+ A[G]='v{}.{}'.format(O&255,O>>8&3)
227
227
  A[Y]=f"v{A[D]}-{A[F]}"if A[F]else f"v{A[D]}";return A
228
228
  def d(info,board_descr,filename):
229
229
  with W(filename,'r')as B:
@@ -231,7 +231,7 @@ def d(info,board_descr,filename):
231
231
  A=B.readline()
232
232
  if not A:break
233
233
  C,D=A.split(',')[0].strip(),A.split(',')[1].strip()
234
- if C==board_descr:info[K]=D;return P
234
+ if C==board_descr:info[K]=D;return O
235
235
  return H
236
236
  def get_root():
237
237
  try:A=os.getcwd()
@@ -243,7 +243,7 @@ def get_root():
243
243
  return B
244
244
  def e(filename):
245
245
  try:
246
- if os.stat(filename)[0]>>14:return P
246
+ if os.stat(filename)[0]>>14:return O
247
247
  return H
248
248
  except F:return H
249
249
  def f():sys.exit(1)
@@ -257,7 +257,7 @@ def read_path():
257
257
  return path
258
258
  def g():
259
259
  try:A=bytes('abc',encoding='utf8');B=g.__module__;return H
260
- except (h,I):return P
260
+ except (h,I):return O
261
261
  def main():
262
262
  D='lvgl'
263
263
  try:import lvgl as A
Binary file
@@ -9,7 +9,7 @@
9
9
  - cross compilation, using mpy-cross,
10
10
  to avoid the compilation step on the micropython device
11
11
 
12
- This variant was generated from createstubs.py by micropython-stubber v1.13.4
12
+ This variant was generated from createstubs.py by micropython-stubber v1.13.8
13
13
  """
14
14
  # Copyright (c) 2019-2023 Jos Verlinde
15
15
  # pylint: disable= invalid-name, missing-function-docstring, import-outside-toplevel, logging-not-lazy
@@ -30,7 +30,7 @@ try:
30
30
  except ImportError:
31
31
  from ucollections import OrderedDict # type: ignore
32
32
 
33
- __version__ = "v1.13.4"
33
+ __version__ = "v1.13.8"
34
34
  ENOENT = 2
35
35
  _MAX_CLASS_LEVEL = 2 # Max class nesting
36
36
  LIBS = [".", "/lib", "/sd/lib", "/flash/lib", "lib"]
@@ -100,7 +100,7 @@ class Stubber:
100
100
  _errors = []
101
101
  self._log.debug("get attributes {} {}".format(repr(item_instance), item_instance))
102
102
  for name in dir(item_instance):
103
- if name.startswith("_"):
103
+ if name.startswith("_") and not name in self.modules:
104
104
  continue
105
105
  self._log.debug("get attribute {}".format(name))
106
106
  try:
@@ -127,7 +127,8 @@ class Stubber:
127
127
  reset()
128
128
 
129
129
  # remove internal __
130
- _result = sorted([i for i in _result if not (i[0].startswith("_"))], key=lambda x: x[4])
130
+ # _result = sorted([i for i in _result if not (i[0].startswith("_"))], key=lambda x: x[4])
131
+ _result = sorted([i for i in _result if not (i[0].startswith("__"))], key=lambda x: x[4])
131
132
  gc.collect()
132
133
  return _result, _errors
133
134
 
@@ -15,13 +15,13 @@ Z='list'
15
15
  Y='tuple'
16
16
  X='micropython'
17
17
  W=repr
18
- U=KeyError
19
- T=open
20
- S=IndexError
21
- R=dir
22
- Q=ImportError
23
- P=True
24
- O='_'
18
+ U='_'
19
+ T=KeyError
20
+ S=open
21
+ R=IndexError
22
+ Q=dir
23
+ P=ImportError
24
+ O=True
25
25
  N='family'
26
26
  M=len
27
27
  L='.'
@@ -37,10 +37,10 @@ C=''
37
37
  import gc as B,sys,uos as os
38
38
  from ujson import dumps as b
39
39
  try:from machine import reset
40
- except Q:pass
40
+ except P:pass
41
41
  try:from collections import OrderedDict as c
42
- except Q:from ucollections import OrderedDict as c
43
- __version__='v1.13.4'
42
+ except P:from ucollections import OrderedDict as c
43
+ __version__='v1.13.8'
44
44
  u=2
45
45
  v=2
46
46
  d=[L,'/lib','/sd/lib','/flash/lib','lib']
@@ -64,21 +64,21 @@ class Stubber:
64
64
  except D:J('error creating stub folder {}'.format(path))
65
65
  A.problematic=['upip','upysh','webrepl_setup','http_client','http_client_ssl','http_server','http_server_ssl'];A.excluded=['webrepl','_webrepl','port_diag','example_sub_led.py','example_pub_button.py'];A.modules=[]
66
66
  def get_obj_attributes(L,item_instance):
67
- H=item_instance;A=[];J=[]
68
- for D in R(H):
69
- if D.startswith(O):continue
67
+ H=item_instance;D=[];J=[]
68
+ for A in Q(H):
69
+ if A.startswith(U)and not A in L.modules:continue
70
70
  try:
71
- E=getattr(H,D)
71
+ E=getattr(H,A)
72
72
  try:F=W(type(E)).split("'")[1]
73
- except S:F=C
73
+ except R:F=C
74
74
  if F in{n,o,p,q,Y,Z,a}:G=1
75
75
  elif F in{r,s}:G=2
76
76
  elif F in'class':G=3
77
77
  else:G=4
78
- A.append((D,W(E),W(type(E)),E,G))
79
- except I as K:J.append("Couldn't get attribute '{}' from object '{}', Err: {}".format(D,H,K))
78
+ D.append((A,W(E),W(type(E)),E,G))
79
+ except I as K:J.append("Couldn't get attribute '{}' from object '{}', Err: {}".format(A,H,K))
80
80
  except MemoryError as K:sleep(1);reset()
81
- A=k([A for A in A if not A[0].startswith(O)],key=lambda x:x[4]);B.collect();return A,J
81
+ D=k([A for A in D if not A[0].startswith('__')],key=lambda x:x[4]);B.collect();return D,J
82
82
  def add_modules(A,modules):A.modules=k(set(A.modules)|set(modules))
83
83
  def create_all_stubs(A):
84
84
  B.collect()
@@ -93,21 +93,21 @@ class Stubber:
93
93
  B.collect();return E
94
94
  def create_module_stub(I,module_name,file_name=F):
95
95
  E=file_name;A=module_name
96
- if E is F:K=A.replace(L,O)+'.py';E=I.path+G+K
96
+ if E is F:K=A.replace(L,U)+'.py';E=I.path+G+K
97
97
  else:K=E.split(G)[-1]
98
98
  if G in A:A=A.replace(G,L)
99
99
  M=F
100
- try:M=__import__(A,F,F,'*');R=B.mem_free();J('Stub module: {:<25} to file: {:<70} mem:{:>5}'.format(A,K,R))
101
- except Q:return H
100
+ try:M=__import__(A,F,F,'*');Q=B.mem_free();J('Stub module: {:<25} to file: {:<70} mem:{:>5}'.format(A,K,Q))
101
+ except P:return H
102
102
  e(E)
103
- with T(E,'w')as N:S='"""\nModule: \'{0}\' on {1}\n"""\n# MCU: {2}\n# Stubber: {3}\n'.format(A,I._fwid,I.info,__version__);N.write(S);N.write('from typing import Any\n\n');I.write_object_stub(N,M,A,C)
103
+ with S(E,'w')as N:R='"""\nModule: \'{0}\' on {1}\n"""\n# MCU: {2}\n# Stubber: {3}\n'.format(A,I._fwid,I.info,__version__);N.write(R);N.write('from typing import Any\n\n');I.write_object_stub(N,M,A,C)
104
104
  I._report.append('{{"module": "{}", "file": "{}"}}'.format(A,E.replace('\\',G)))
105
105
  if A not in{'os','sys','logging','gc'}:
106
106
  try:del M
107
- except (D,U):pass
107
+ except (D,T):pass
108
108
  try:del sys.modules[A]
109
- except U:pass
110
- B.collect();return P
109
+ except T:pass
110
+ B.collect();return O
111
111
  def write_object_stub(L,fp,object_expr,obj_name,indent,in_class=0):
112
112
  d='{0}{1} = {2} # type: {3}\n';c='bound_method';b='Any';Q=in_class;P=object_expr;O='Exception';H=fp;E=indent;B.collect()
113
113
  if P in L.problematic:return
@@ -117,9 +117,9 @@ class Stubber:
117
117
  if F in['classmethod','staticmethod','BaseException',O]:continue
118
118
  if F[0].isdigit():continue
119
119
  if G=="<class 'type'>"and M(E)<=v*4:
120
- T=C;V=F.endswith(O)or F.endswith('Error')or F in['KeyboardInterrupt','StopIteration','SystemExit']
121
- if V:T=O
122
- A='\n{}class {}({}):\n'.format(E,F,T)
120
+ U=C;V=F.endswith(O)or F.endswith('Error')or F in['KeyboardInterrupt','StopIteration','SystemExit']
121
+ if V:U=O
122
+ A='\n{}class {}({}):\n'.format(E,F,U)
123
123
  if V:A+=E+' ...\n';H.write(A);return
124
124
  H.write(A);L.write_object_stub(H,S,'{0}.{1}'.format(obj_name,F),E+' ',Q+1);A=E+' def __init__(self, *argv, **kwargs) -> None:\n';A+=E+' ...\n\n';H.write(A)
125
125
  elif s in G or r in G:
@@ -140,11 +140,11 @@ class Stubber:
140
140
  else:H.write("# all other, type = '{0}'\n".format(G));H.write(E+F+' # type: Any\n')
141
141
  del R;del N
142
142
  try:del F,K,G,S
143
- except (D,U,l):pass
143
+ except (D,T,l):pass
144
144
  @property
145
145
  def flat_fwid(self):
146
146
  A=self._fwid;B=' .()/\\:$'
147
- for C in B:A=A.replace(C,O)
147
+ for C in B:A=A.replace(C,U)
148
148
  return A
149
149
  def clean(B,path=F):
150
150
  if path is F:path=B.path
@@ -160,8 +160,8 @@ class Stubber:
160
160
  def report(A,filename='modules.json'):
161
161
  J('Created stubs for {} modules on board {}\nPath: {}'.format(M(A._report),A._fwid,A.path));F=t.format(A.path,filename);B.collect()
162
162
  try:
163
- with T(F,'w')as C:
164
- A.write_json_header(C);E=P
163
+ with S(F,'w')as C:
164
+ A.write_json_header(C);E=O
165
165
  for G in A._report:A.write_json_node(C,G,E);E=H
166
166
  A.write_json_end(C)
167
167
  I=A._start_free-B.mem_free()
@@ -189,48 +189,48 @@ def V(s):
189
189
  if A in s:s=s.split(A,1)[0]
190
190
  return s.split('-')[1]if'-'in s else C
191
191
  def _info():
192
- j='ev3-pybricks';i='pycom';h='pycopy';e='GENERIC';b='arch';a='cpu';Z='ver';T='with';G='mpy';D='build';A=c({N:sys.implementation.name,E:C,D:C,Z:C,m:'stm32'if sys.platform.startswith('pyb')else sys.platform,K:e,a:C,G:C,b:C})
192
+ j='ev3-pybricks';i='pycom';h='pycopy';e='GENERIC';b='arch';a='cpu';Z='ver';S='with';G='mpy';D='build';A=c({N:sys.implementation.name,E:C,D:C,Z:C,m:'stm32'if sys.platform.startswith('pyb')else sys.platform,K:e,a:C,G:C,b:C})
193
193
  try:A[E]=L.join([str(A)for A in sys.implementation.version])
194
194
  except I:pass
195
- try:W=sys.implementation._machine if'_machine'in R(sys.implementation)else os.uname().machine;A[K]=W.strip();A[a]=W.split(T)[1].strip();A[G]=sys.implementation._mpy if'_mpy'in R(sys.implementation)else sys.implementation.mpy if G in R(sys.implementation)else C
196
- except (I,S):pass
195
+ try:W=sys.implementation._machine if'_machine'in Q(sys.implementation)else os.uname().machine;A[K]=W.strip();A[a]=W.split(S)[1].strip();A[G]=sys.implementation._mpy if'_mpy'in Q(sys.implementation)else sys.implementation.mpy if G in Q(sys.implementation)else C
196
+ except (I,R):pass
197
197
  B.collect()
198
198
  for J in [A+'/board_info.csv'for A in d]:
199
199
  if g(J):
200
200
  H=A[K].strip()
201
201
  if f(A,H,J):break
202
- if T in H:
203
- H=H.split(T)[0].strip()
202
+ if S in H:
203
+ H=H.split(S)[0].strip()
204
204
  if f(A,H,J):break
205
205
  A[K]=e
206
- A[K]=A[K].replace(' ',O);B.collect()
206
+ A[K]=A[K].replace(' ',U);B.collect()
207
207
  try:
208
208
  A[D]=V(os.uname()[3])
209
209
  if not A[D]:A[D]=V(os.uname()[2])
210
210
  if not A[D]and';'in sys.version:A[D]=V(sys.version.split(';')[1])
211
- except (I,S):pass
211
+ except (I,R):pass
212
212
  if A[D]and M(A[D])>5:A[D]=C
213
213
  if A[E]==C and sys.platform not in('unix','win32'):
214
214
  try:k=os.uname();A[E]=k.release
215
- except (S,I,TypeError):pass
215
+ except (R,I,TypeError):pass
216
216
  for (l,n,o) in [(h,h,'const'),(i,i,'FAT'),(j,'pybricks.hubs','EV3Brick')]:
217
217
  try:p=__import__(n,F,F,o);A[N]=l;del p;break
218
- except (Q,U):pass
218
+ except (P,T):pass
219
219
  if A[N]==j:A['release']='2.0.0'
220
220
  if A[N]==X:
221
221
  if A[E]and A[E].endswith('.0')and A[E]>='1.10.0'and A[E]<='1.19.9':A[E]=A[E][:-2]
222
222
  if G in A and A[G]:
223
- P=int(A[G]);Y=[F,'x86','x64','armv6','armv6m','armv7m','armv7em','armv7emsp','armv7emdp','xtensa','xtensawin'][P>>10]
223
+ O=int(A[G]);Y=[F,'x86','x64','armv6','armv6m','armv7m','armv7em','armv7emsp','armv7emdp','xtensa','xtensawin'][O>>10]
224
224
  if Y:A[b]=Y
225
- A[G]='v{}.{}'.format(P&255,P>>8&3)
225
+ A[G]='v{}.{}'.format(O&255,O>>8&3)
226
226
  A[Z]=f"v{A[E]}-{A[D]}"if A[D]else f"v{A[E]}";return A
227
227
  def f(info,board_descr,filename):
228
- with T(filename,'r')as B:
228
+ with S(filename,'r')as B:
229
229
  while 1:
230
230
  A=B.readline()
231
231
  if not A:break
232
232
  C,D=A.split(',')[0].strip(),A.split(',')[1].strip()
233
- if C==board_descr:info[K]=D;return P
233
+ if C==board_descr:info[K]=D;return O
234
234
  return H
235
235
  def get_root():
236
236
  try:A=os.getcwd()
@@ -242,7 +242,7 @@ def get_root():
242
242
  return B
243
243
  def g(filename):
244
244
  try:
245
- if os.stat(filename)[0]>>14:return P
245
+ if os.stat(filename)[0]>>14:return O
246
246
  return H
247
247
  except D:return H
248
248
  def h():sys.exit(1)
@@ -256,12 +256,12 @@ def read_path():
256
256
  return path
257
257
  def i():
258
258
  try:A=bytes('abc',encoding='utf8');B=i.__module__;return H
259
- except (j,I):return P
259
+ except (j,I):return O
260
260
  def main():
261
261
  stubber=Stubber(path=read_path());stubber.clean();stubber.modules=[]
262
262
  for C in d:
263
263
  try:
264
- with T(C+'/modulelist.txt')as E:
264
+ with S(C+'/modulelist.txt')as E:
265
265
  for A in E.read().split('\n'):
266
266
  A=A.strip()
267
267
  if M(A)>0 and A[0]!='#':stubber.modules.append(A)
Binary file