micropython-stubber 1.16.0__py3-none-any.whl → 1.16.2__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: micropython-stubber
3
- Version: 1.16.0
3
+ Version: 1.16.2
4
4
  Summary: Tooling to create and maintain stubs for MicroPython
5
5
  Home-page: https://github.com/Josverl/micropython-stubber#readme
6
6
  License: MIT
@@ -28,6 +28,7 @@ Requires-Dist: importlib-metadata (>=1.0,<2.0) ; python_version < "3.8"
28
28
  Requires-Dist: libcst (>=1.1.0,<2.0.0)
29
29
  Requires-Dist: loguru (>=0.6,<0.8)
30
30
  Requires-Dist: mypy (==1.7.0)
31
+ Requires-Dist: mypy-gitlab-code-quality (>=1.1.0,<2.0.0)
31
32
  Requires-Dist: packaging (>=21.3,<24.0)
32
33
  Requires-Dist: pipx (>=1.1.0,<2.0.0)
33
34
  Requires-Dist: pygithub (>=2.1.1,<3.0.0)
@@ -1,22 +1,23 @@
1
- stubber/__init__.py,sha256=K2XTGYCbeoiYM78GCJPZXH2omH_-w8950MKG-0qxEsY,51
1
+ stubber/__init__.py,sha256=M_3BbdDYpkeqQPOEVMHM4AuBZUwB_Xts3L9EsbQb9rk,51
2
2
  stubber/basicgit.py,sha256=O4-4BXrvcUkYi_axYxbUUJmw01SKjYu0ZMPto7zcGsc,9701
3
3
  stubber/board/board_info.csv,sha256=e3xY-VTOh-iOmpGhhuADXnk3Rq-17ID0PJr8eKSH5Fw,7040
4
4
  stubber/board/boot.py,sha256=XjWlKErU5nI1HJSugXIP_3hlwgRQboE6sJrpcbSygnk,1120
5
- stubber/board/createstubs.py,sha256=K86QkaaHxJxewKoC888l6EidziNHp6NqlJOnACFxFto,30698
6
- stubber/board/createstubs_db.py,sha256=2EgrvfgYwh-njO6NhnGSWK43ywTIcx_GVnPw2TD18_Y,28232
7
- stubber/board/createstubs_db_min.py,sha256=bL99dPzIYejESJDg9YELxKHYlw9XeeVxqtBEcZV3r0M,10102
8
- stubber/board/createstubs_db_mpy.mpy,sha256=bdnt5XFkXY72Nzt3BzyBkdcqPl7HnaBbq0ABC4wjI_s,8291
9
- stubber/board/createstubs_lvgl.py,sha256=AzGMHl2mfih_HB0r2MDT9q8tI6Zei7bL_5MhH4d-I-8,25451
10
- stubber/board/createstubs_lvgl_min.py,sha256=kKrRNiyUzr-94ezBFaM9-bQg-M9jmi2klHcYWWdctNc,9416
11
- stubber/board/createstubs_lvgl_mpy.mpy,sha256=YFLGUh0dkB0bKU1DwjrjovOUkm0MBC-vw5ApkUNV9kw,7771
12
- stubber/board/createstubs_mem.py,sha256=7iMaaiZZnTcbhv0_fEqlBaRbPwbDCNvsroiGaZJgTtQ,26349
13
- stubber/board/createstubs_mem_min.py,sha256=uTecXhO8CL0B8AsPdXak-piDWFcoyHxGC4iuLlLb6lM,9532
14
- stubber/board/createstubs_mem_mpy.mpy,sha256=giP_S8P_Iv1XPr6LKLFYg1yXnlKE67XQ7kOf2tPZOi0,7783
15
- stubber/board/createstubs_min.py,sha256=HjmmuikuvsVNjKMx3YArtwKW-HigMNkfQpqDhiL-dus,11952
16
- stubber/board/createstubs_mpy.mpy,sha256=sWAtzClvRz3IMlECP_s_VbB5yBjYzmCm3fZ1-Iz91As,10738
5
+ stubber/board/createstubs.py,sha256=RZMsnCovui_LoZY7srM4m2rIseKJI12hS2xM6jHcZb4,31000
6
+ stubber/board/createstubs_db.py,sha256=xh_5uaaagasvhJ-hz4XelPsvRC6XJwdnZYCEy36HXFg,28448
7
+ stubber/board/createstubs_db_min.py,sha256=G4ajUwvHNo6aWplYU9USBtIlS7wEUNtNOBZf7025lKg,10168
8
+ stubber/board/createstubs_db_mpy.mpy,sha256=dJwroDIOl5tdO905xFcPDUZutWrQ3sbeV23dVpIgnaU,8362
9
+ stubber/board/createstubs_lvgl.py,sha256=To_uCY6AzU-6r1P7AUQJwotIMv3pdQP6VNzUgCIo8HU,25665
10
+ stubber/board/createstubs_lvgl_min.py,sha256=Czd_QQiSXiTKYxzC-AXsA5ddCgAK-mh6x3LN08zRs-k,9480
11
+ stubber/board/createstubs_lvgl_mpy.mpy,sha256=LDqyGgfWJBeYZOat70Cht0B7fyNnxOO4Bs_c_kY1IVc,7843
12
+ stubber/board/createstubs_mem.py,sha256=tkg_ztDu1IVKLt0LHe3Y7aEjwWufep8lLpdDd8vjv2c,26565
13
+ stubber/board/createstubs_mem_min.py,sha256=Jux8d25wu1YfDF5LtjGyOL5agAQHEvlQyZmp0Xb6hUo,9598
14
+ stubber/board/createstubs_mem_mpy.mpy,sha256=M8OXin133KmU844LCVGoBXOOVCIdf2UL4nuipvvsJl8,7875
15
+ stubber/board/createstubs_min.py,sha256=iRp0A8tqkWbM-K2-G5j2PhJnwZ7l2q5O43eyESP5UE8,12080
16
+ stubber/board/createstubs_mpy.mpy,sha256=nRm7QxXjtBl6n9-oWIYe3s3Vo4k7QChaG_sSq2f-YaE,10888
17
+ stubber/board/info.py,sha256=b7SOPZHVsVhaayKCwVkFZlYu0BW-UFI7LuG1Eop9480,5629
17
18
  stubber/board/logging.py,sha256=rdneoAwZg84uiWBJWYIp0gMcT2oU9Lu-1WIu1LqT_9w,2218
18
19
  stubber/board/main.py,sha256=f6V3tdt6sPZVLuwemT-NLuK9GySfW2c2J6PJMOOWQQw,413
19
- stubber/board/modulelist.txt,sha256=-LaSa5Qk3IVFecAm9cs_GBXLOO2O-Fx_SIvMCOzS13Y,2717
20
+ stubber/board/modulelist.txt,sha256=DnFwCc5nQIqNSYQrPZRW2Q4ZkXkTQKaPLAB4_1k2Qck,2774
20
21
  stubber/board/pyrightconfig.json,sha256=6oHS4aDOfwKBAFeUPsCGJzEXpUgBZsPaF0M4P-N26D4,1376
21
22
  stubber/codemod/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
22
23
  stubber/codemod/_partials/__init__.py,sha256=Pihz2Fxu59kYEnoXp44AmFgVFHr7yjXHwPCJqBhMctk,1545
@@ -67,10 +68,10 @@ stubber/publish/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
67
68
  stubber/publish/bump.py,sha256=qSb1DpaIxgyoH3YcPU1XKyDKgqkomxSm0WWf1sAVh0Y,3262
68
69
  stubber/publish/candidates.py,sha256=FUrFyPex6pe3_ISH6Sp3ZYrC4DYZCPjaM7hXaA6Uidg,11463
69
70
  stubber/publish/database.py,sha256=CLy5oiLasA-YzTTXi9d01qLAyk7NpugCDUOa5R9Ac2g,623
70
- stubber/publish/defaults.py,sha256=hSP4rahJ3JqQ0G_shS3JfxWfEyxUFVrhvzagwxtqFZ4,1622
71
+ stubber/publish/defaults.py,sha256=iw2DBoNkYb0DuKE0P86fomAqV1WobSjkG21ocvV92Ss,1624
71
72
  stubber/publish/enums.py,sha256=YI_0q3Iz3v1YqDuHgbuj7x6FBS5y5w3G1UdgpCGunNs,954
72
73
  stubber/publish/helpers.py,sha256=909umfKUHBMBoVnAanop1vKx8loCrWntlfiiG6z89lY,716
73
- stubber/publish/merge_docstubs.py,sha256=XBX6-UzneCQRaYuahwLkfEgySwuxzRlYzlsevOFxgoo,5371
74
+ stubber/publish/merge_docstubs.py,sha256=oDQZwaJvS-ZKG1dsMiH_lxBIMnHc0R-t_UnQDKS-TDs,5371
74
75
  stubber/publish/missing_class_methods.py,sha256=8i4Znit5vOaGjuXlFn_BYBIEt7G45i0l0gbj1hWKgb8,1771
75
76
  stubber/publish/package.py,sha256=751NKo67Kq-2vUDWabWqw2eXTntay_BZ6d1vIIE1sX8,6333
76
77
  stubber/publish/pathnames.py,sha256=04zlFoRUcvTV7qVyc9z8mq2QdnGB82duclcCfTivO-0,1807
@@ -79,7 +80,7 @@ stubber/publish/pypi.py,sha256=Mu1F7Xx4e0NPWK1_Erck6QGEfdY8w67EBeWFi6JiAzk,1240
79
80
  stubber/publish/stubpackage.py,sha256=FsENv3Kr2WASAMhOk6nrvbxF4GowB17wa-6975EePAA,44984
80
81
  stubber/rst/__init__.py,sha256=5VcbDCotIICa2xnJDs_gw2sFXpjjGOZZbwCrNKXy1OE,293
81
82
  stubber/rst/classsort.py,sha256=YCmF4QEYXqZ1Yu2FZb1iPQBrVkq-mrZaBaRcSUlC7ZE,2655
82
- stubber/rst/lookup.py,sha256=zhd4-ntBjcaVMsj2JJBNQx8GBH46oimpQ9pdNLax-7g,19814
83
+ stubber/rst/lookup.py,sha256=T8PdzWzbLdIXxEeu5gMfixGoTIeg4PId4nRFW2fVnZo,19840
83
84
  stubber/rst/output_dict.py,sha256=cpBXRtUD-uh0EgjWIBiRrMLBmIAEXjoJFSOAg-qJQiU,14755
84
85
  stubber/rst/reader.py,sha256=uR0MW6oFrxD5zJS9J4-wevUmcUHOPG6nhHifI9kkuIs,33336
85
86
  stubber/rst/report_return.py,sha256=WZJSbgjsjxFeCeY-vLms56gv_x3TubaGXGQ8--d8RqI,2814
@@ -101,8 +102,8 @@ stubber/utils/stubmaker.py,sha256=jHvRbbJA-Hp60R8NKct-TNM8ufFy2Rl2hesMW7ia7L8,46
101
102
  stubber/utils/typed_config_toml.py,sha256=ikifCIZGNhS_uqsfp6IwIpxdtZqbLtywprjWG_Q0y8o,2629
102
103
  stubber/utils/versions.py,sha256=_xSOwpJV0gAO-TK2KHu-Ze3m__739f1YUVIxiHE2vqY,1859
103
104
  stubber/variants.py,sha256=sCYNG0u8kEshOROYgH91dg1P-yqr0D6PGJjfWP8YmDY,3748
104
- micropython_stubber-1.16.0.dist-info/entry_points.txt,sha256=NQi_M36fgq5k6giSuASas3LrpF6CVdkzfvJC0ja73_g,55
105
- micropython_stubber-1.16.0.dist-info/LICENSE,sha256=2zsOXlYgl9W7_XGXcncAXIYfvSVlyNcVBycC6hhlKhA,1542
106
- micropython_stubber-1.16.0.dist-info/METADATA,sha256=htpgm2b_yzaRyJpq-9Kx-74fRAN2MmytIXrNbwAhNCU,18938
107
- micropython_stubber-1.16.0.dist-info/WHEEL,sha256=d2fvjOD7sXsVzChCqf0Ty0JbHKBaLYwDbGQDwQTnJ50,88
108
- micropython_stubber-1.16.0.dist-info/RECORD,,
105
+ micropython_stubber-1.16.2.dist-info/entry_points.txt,sha256=NQi_M36fgq5k6giSuASas3LrpF6CVdkzfvJC0ja73_g,55
106
+ micropython_stubber-1.16.2.dist-info/LICENSE,sha256=2zsOXlYgl9W7_XGXcncAXIYfvSVlyNcVBycC6hhlKhA,1542
107
+ micropython_stubber-1.16.2.dist-info/METADATA,sha256=GA2sbr96MpsGa2m2o3zqq12rEtKsk0KNKAa-OZqwuYg,18995
108
+ micropython_stubber-1.16.2.dist-info/WHEEL,sha256=d2fvjOD7sXsVzChCqf0Ty0JbHKBaLYwDbGQDwQTnJ50,88
109
+ micropython_stubber-1.16.2.dist-info/RECORD,,
stubber/__init__.py CHANGED
@@ -1,4 +1,4 @@
1
1
  """get the version"""
2
2
 
3
3
 
4
- __version__ = "1.16.0"
4
+ __version__ = "1.16.2"
@@ -20,7 +20,7 @@ try:
20
20
  except ImportError:
21
21
  from ucollections import OrderedDict # type: ignore
22
22
 
23
- __version__ = "v1.16.0"
23
+ __version__ = "v1.16.2"
24
24
  ENOENT = 2
25
25
  _MAX_CLASS_LEVEL = 2 # Max class nesting
26
26
  LIBS = [".", "/lib", "/sd/lib", "/flash/lib", "lib"]
@@ -455,15 +455,20 @@ def _info(): # type:() -> dict[str, str]
455
455
  "version": "",
456
456
  "build": "",
457
457
  "ver": "",
458
- "port": "stm32"
459
- if sys.platform.startswith("pyb")
460
- else sys.platform, # port: esp32 / win32 / linux / stm32
458
+ "port": sys.platform, # port: esp32 / win32 / linux / stm32
461
459
  "board": "GENERIC",
462
460
  "cpu": "",
463
461
  "mpy": "",
464
462
  "arch": "",
465
463
  }
466
464
  )
465
+ # change port names to be consistent with the repo
466
+ if info["port"].startswith("pyb"):
467
+ info["port"] = "stm32"
468
+ elif info["port"] == "win32":
469
+ info["port"] = "windows"
470
+ elif info["port"] == "linux":
471
+ info["port"] = "unix"
467
472
  try:
468
473
  info["version"] = ".".join([str(n) for n in sys.implementation.version])
469
474
  except AttributeError:
@@ -715,6 +720,7 @@ def main():
715
720
  "ak8963",
716
721
  "apa102",
717
722
  "apa106",
723
+ "argparse",
718
724
  "array",
719
725
  "asyncio/__init__",
720
726
  "asyncio/core",
@@ -763,6 +769,7 @@ def main():
763
769
  "esp32",
764
770
  "espidf",
765
771
  "espnow",
772
+ "ffi",
766
773
  "flashbdev",
767
774
  "framebuf",
768
775
  "freesans20",
@@ -799,6 +806,7 @@ def main():
799
806
  "micropython",
800
807
  "mip",
801
808
  "mip/__init__",
809
+ "mip/__main__",
802
810
  "motor",
803
811
  "mpu6500",
804
812
  "mpu9250",
@@ -826,6 +834,7 @@ def main():
826
834
  "queue",
827
835
  "random",
828
836
  "requests",
837
+ "requests/__init__",
829
838
  "rp2",
830
839
  "rtch",
831
840
  "samd",
@@ -838,6 +847,7 @@ def main():
838
847
  "stm",
839
848
  "struct",
840
849
  "sys",
850
+ "termios",
841
851
  "time",
842
852
  "tpcalib",
843
853
  "uarray",
@@ -18,7 +18,7 @@ Create stubs for (all) modules on a MicroPython board.
18
18
  - cross compilation, using mpy-cross, to avoid the compilation step on the micropython device
19
19
 
20
20
 
21
- This variant was generated from createstubs.py by micropython-stubber v1.15.2
21
+ This variant was generated from createstubs.py by micropython-stubber v1.16.2
22
22
  """
23
23
  # Copyright (c) 2019-2023 Jos Verlinde
24
24
 
@@ -39,7 +39,7 @@ try:
39
39
  except ImportError:
40
40
  from ucollections import OrderedDict # type: ignore
41
41
 
42
- __version__ = "v1.16.0"
42
+ __version__ = "v1.16.2"
43
43
  ENOENT = 2
44
44
  _MAX_CLASS_LEVEL = 2 # Max class nesting
45
45
  LIBS = [".", "/lib", "/sd/lib", "/flash/lib", "lib"]
@@ -448,13 +448,20 @@ def _info(): # type:() -> dict[str, str]
448
448
  "version": "",
449
449
  "build": "",
450
450
  "ver": "",
451
- "port": "stm32" if sys.platform.startswith("pyb") else sys.platform, # port: esp32 / win32 / linux / stm32
451
+ "port": sys.platform, # port: esp32 / win32 / linux / stm32
452
452
  "board": "GENERIC",
453
453
  "cpu": "",
454
454
  "mpy": "",
455
455
  "arch": "",
456
456
  }
457
457
  )
458
+ # change port names to be consistent with the repo
459
+ if info["port"].startswith("pyb"):
460
+ info["port"] = "stm32"
461
+ elif info["port"] == "win32":
462
+ info["port"] = "windows"
463
+ elif info["port"] == "linux":
464
+ info["port"] = "unix"
458
465
  try:
459
466
  info["version"] = ".".join([str(n) for n in sys.implementation.version])
460
467
  except AttributeError:
@@ -42,7 +42,7 @@ try:from machine import reset
42
42
  except P:pass
43
43
  try:from collections import OrderedDict as d
44
44
  except P:from ucollections import OrderedDict as d
45
- __version__='v1.16.0'
45
+ __version__='v1.16.2'
46
46
  w=2
47
47
  x=2
48
48
  e=[J,'/lib','/sd/lib','/flash/lib','lib']
@@ -190,20 +190,23 @@ def U(s):
190
190
  if A in s:s=s.split(A,1)[0]
191
191
  return s.split('-')[1]if'-'in s else C
192
192
  def _info():
193
- k='ev3-pybricks';j='pycom';i='pycopy';f='GENERIC';c='arch';b='cpu';a='ver';V='with';G='mpy';F='build';A=d({O:sys.implementation.name,D:C,F:C,a:C,'port':'stm32'if sys.platform.startswith('pyb')else sys.platform,K:f,b:C,G:C,c:C})
193
+ n='ev3-pybricks';m='pycom';l='pycopy';k='unix';j='win32';i='GENERIC';f='arch';c='cpu';b='ver';Y='with';I='mpy';G='port';F='build';A=d({O:sys.implementation.name,D:C,F:C,b:C,G:sys.platform,K:i,c:C,I:C,f:C})
194
+ if A[G].startswith('pyb'):A[G]='stm32'
195
+ elif A[G]==j:A[G]='windows'
196
+ elif A[G]=='linux':A[G]=k
194
197
  try:A[D]=J.join([W(A)for A in sys.implementation.version])
195
198
  except H:pass
196
- try:Y=sys.implementation._machine if'_machine'in Q(sys.implementation)else os.uname().machine;A[K]=Y.strip();A[b]=Y.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 C
199
+ try:Z=sys.implementation._machine if'_machine'in Q(sys.implementation)else os.uname().machine;A[K]=Z.strip();A[c]=Z.split(Y)[1].strip();A[I]=sys.implementation._mpy if'_mpy'in Q(sys.implementation)else sys.implementation.mpy if I in Q(sys.implementation)else C
197
200
  except(H,R):pass
198
201
  B.collect()
199
- for M in[A+'/board_info.csv'for A in e]:
200
- if h(M):
201
- I=A[K].strip()
202
- if g(A,I,M):break
203
- if V in I:
204
- I=I.split(V)[0].strip()
205
- if g(A,I,M):break
206
- A[K]=f
202
+ for N in[A+'/board_info.csv'for A in e]:
203
+ if h(N):
204
+ M=A[K].strip()
205
+ if g(A,M,N):break
206
+ if Y in M:
207
+ M=M.split(Y)[0].strip()
208
+ if g(A,M,N):break
209
+ A[K]=i
207
210
  A[K]=A[K].replace(' ',T);B.collect()
208
211
  try:
209
212
  A[F]=U(os.uname()[3])
@@ -211,20 +214,20 @@ def _info():
211
214
  if not A[F]and';'in sys.version:A[F]=U(sys.version.split(';')[1])
212
215
  except(H,R):pass
213
216
  if A[F]and L(A[F])>5:A[F]=C
214
- if A[D]==C and sys.platform not in('unix','win32'):
215
- try:l=os.uname();A[D]=l.release
217
+ if A[D]==C and sys.platform not in(k,j):
218
+ try:o=os.uname();A[D]=o.release
216
219
  except(R,H,TypeError):pass
217
- for(m,n,o)in[(i,i,'const'),(j,j,'FAT'),(k,'pybricks.hubs','EV3Brick')]:
218
- try:p=__import__(n,E,E,o);A[O]=m;del p;break
220
+ for(p,q,r)in[(l,l,'const'),(m,m,'FAT'),(n,'pybricks.hubs','EV3Brick')]:
221
+ try:s=__import__(q,E,E,r);A[O]=p;del s;break
219
222
  except(P,S):pass
220
- if A[O]==k:A['release']='2.0.0'
223
+ if A[O]==n:A['release']='2.0.0'
221
224
  if A[O]==X:
222
225
  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
- if G in A and A[G]:
224
- N=int(A[G]);Z=[E,'x86','x64','armv6','armv6m','armv7m','armv7em','armv7emsp','armv7emdp','xtensa','xtensawin'][N>>10]
225
- if Z:A[c]=Z
226
- A[G]='v{}.{}'.format(N&255,N>>8&3)
227
- A[a]=f"v{A[D]}-{A[F]}"if A[F]else f"v{A[D]}";return A
226
+ if I in A and A[I]:
227
+ V=int(A[I]);a=[E,'x86','x64','armv6','armv6m','armv7m','armv7em','armv7emsp','armv7emdp','xtensa','xtensawin'][V>>10]
228
+ if a:A[f]=a
229
+ A[I]='v{}.{}'.format(V&255,V>>8&3)
230
+ A[b]=f"v{A[D]}-{A[F]}"if A[F]else f"v{A[D]}";return A
228
231
  def g(info,board_descr,filename):
229
232
  with I(filename,'r')as B:
230
233
  while 1:
Binary file
@@ -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.15.2
6
+ This variant was generated from createstubs.py by micropython-stubber v1.16.2
7
7
  """
8
8
  # Copyright (c) 2019-2023 Jos Verlinde
9
9
 
@@ -24,7 +24,7 @@ try:
24
24
  except ImportError:
25
25
  from ucollections import OrderedDict # type: ignore
26
26
 
27
- __version__ = "v1.15.2a0"
27
+ __version__ = "v1.16.2"
28
28
  ENOENT = 2
29
29
  _MAX_CLASS_LEVEL = 2 # Max class nesting
30
30
  LIBS = [".", "/lib", "/sd/lib", "/flash/lib", "lib"]
@@ -433,13 +433,20 @@ def _info(): # type:() -> dict[str, str]
433
433
  "version": "",
434
434
  "build": "",
435
435
  "ver": "",
436
- "port": "stm32" if sys.platform.startswith("pyb") else sys.platform, # port: esp32 / win32 / linux / stm32
436
+ "port": sys.platform, # port: esp32 / win32 / linux / stm32
437
437
  "board": "GENERIC",
438
438
  "cpu": "",
439
439
  "mpy": "",
440
440
  "arch": "",
441
441
  }
442
442
  )
443
+ # change port names to be consistent with the repo
444
+ if info["port"].startswith("pyb"):
445
+ info["port"] = "stm32"
446
+ elif info["port"] == "win32":
447
+ info["port"] = "windows"
448
+ elif info["port"] == "linux":
449
+ info["port"] = "unix"
443
450
  try:
444
451
  info["version"] = ".".join([str(n) for n in sys.implementation.version])
445
452
  except AttributeError:
@@ -22,10 +22,10 @@ R=len
22
22
  Q=KeyError
23
23
  P=IndexError
24
24
  O=dir
25
- N=print
26
- M=ImportError
27
- L=True
28
- K='family'
25
+ M=print
26
+ N=ImportError
27
+ K=True
28
+ L='family'
29
29
  J='board'
30
30
  I='.'
31
31
  H=AttributeError
@@ -38,10 +38,10 @@ B=''
38
38
  import gc as C,os,sys
39
39
  from ujson import dumps as a
40
40
  try:from machine import reset
41
- except M:pass
41
+ except N:pass
42
42
  try:from collections import OrderedDict as b
43
- except M:from ucollections import OrderedDict as b
44
- __version__='v1.15.2a0'
43
+ except N:from ucollections import OrderedDict as b
44
+ __version__='v1.16.2'
45
45
  u=2
46
46
  v=2
47
47
  w=[I,'/lib','/sd/lib','/flash/lib','lib']
@@ -54,7 +54,7 @@ class Stubber:
54
54
  except H:pass
55
55
  A._report=[];A.info=_info();C.collect()
56
56
  if B:A._fwid=B.lower()
57
- elif A.info[K]==l:A._fwid='{family}-{ver}-{port}-{board}'.format(**A.info)
57
+ elif A.info[L]==l:A._fwid='{family}-{ver}-{port}-{board}'.format(**A.info)
58
58
  else:A._fwid='{family}-{ver}-{port}'.format(**A.info)
59
59
  A._start_free=C.mem_free()
60
60
  if path:
@@ -62,7 +62,7 @@ class Stubber:
62
62
  else:path=get_root()
63
63
  A.path='{}/stubs/{}'.format(path,A.flat_fwid).replace('//',G)
64
64
  try:c(path+G)
65
- except F:N('error creating stub folder {}'.format(path))
65
+ except F:M('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
68
  I=item_instance;D=[];J=[]
@@ -97,29 +97,29 @@ class Stubber:
97
97
  if H is E:O=D.replace(I,S)+'.py';H=J.path+G+O
98
98
  else:O=H.split(G)[-1]
99
99
  if G in D:D=D.replace(G,I)
100
- K=E
101
- try:K=__import__(D,E,E,'*');T=C.mem_free()
102
- except M:return A
100
+ L=E
101
+ try:L=__import__(D,E,E,'*');T=C.mem_free()
102
+ except N:return A
103
103
  c(H)
104
- with V(H,'w')as N:P=str(J.info).replace('OrderedDict(',B).replace('})','}');R='"""\nModule: \'{0}\' on {1}\n"""\n# MCU: {2}\n# Stubber: {3}\n'.format(D,J._fwid,P,__version__);N.write(R);N.write('from typing import Any\nfrom _typeshed import Incomplete\n\n');J.write_object_stub(N,K,D,B)
104
+ with V(H,'w')as M:P=str(J.info).replace('OrderedDict(',B).replace('})','}');R='"""\nModule: \'{0}\' on {1}\n"""\n# MCU: {2}\n# Stubber: {3}\n'.format(D,J._fwid,P,__version__);M.write(R);M.write('from typing import Any\nfrom _typeshed import Incomplete\n\n');J.write_object_stub(M,L,D,B)
105
105
  J._report.append('{{"module": "{}", "file": "{}"}}'.format(D,H.replace('\\',G)))
106
106
  if D not in{'os','sys','logging','gc'}:
107
- try:del K
107
+ try:del L
108
108
  except(F,Q):pass
109
109
  try:del sys.modules[D]
110
110
  except Q:pass
111
- C.collect();return L
111
+ C.collect();return K
112
112
  def write_object_stub(K,fp,object_expr,obj_name,indent,in_class=0):
113
- d='{0}{1} = {2} # type: {3}\n';c='bound_method';b='Incomplete';P=in_class;O=object_expr;M='Exception';H=fp;D=indent;C.collect()
113
+ d='{0}{1} = {2} # type: {3}\n';c='bound_method';b='Incomplete';P=in_class;O=object_expr;N='Exception';H=fp;D=indent;C.collect()
114
114
  if O in K.problematic:return
115
115
  S,L=K.get_obj_attributes(O)
116
- if L:N(L)
116
+ if L:M(L)
117
117
  for(E,J,G,T,f)in S:
118
- if E in['classmethod','staticmethod','BaseException',M]:continue
118
+ if E in['classmethod','staticmethod','BaseException',N]:continue
119
119
  if E[0].isdigit():continue
120
120
  if G=="<class 'type'>"and R(D)<=v*4:
121
- U=B;V=E.endswith(M)or E.endswith('Error')or E in['KeyboardInterrupt','StopIteration','SystemExit']
122
- if V:U=M
121
+ U=B;V=E.endswith(N)or E.endswith('Error')or E in['KeyboardInterrupt','StopIteration','SystemExit']
122
+ if V:U=N
123
123
  A='\n{}class {}({}):\n'.format(D,E,U)
124
124
  if V:A+=D+' ...\n';H.write(A);return
125
125
  H.write(A);K.write_object_stub(H,T,'{0}.{1}'.format(obj_name,E),D+' ',P+1);A=D+' def __init__(self, *argv, **kwargs) -> None:\n';A+=D+' ...\n\n';H.write(A)
@@ -161,11 +161,11 @@ class Stubber:
161
161
  G=s.format(B.path,filename);C.collect()
162
162
  try:
163
163
  with V(G,'w')as D:
164
- B.write_json_header(D);E=L
164
+ B.write_json_header(D);E=K
165
165
  for H in B._report:B.write_json_node(D,H,E);E=A
166
166
  B.write_json_end(D)
167
167
  I=B._start_free-C.mem_free()
168
- except F:N('Failed to create the report.')
168
+ except F:M('Failed to create the report.')
169
169
  def write_json_header(B,f):A='firmware';f.write('{');f.write(a({A:B.info})[1:-1]);f.write(Z);f.write(a({t:{D:__version__},'stubtype':A})[1:-1]);f.write(Z);f.write('"modules" :[\n')
170
170
  def write_json_node(A,f,n,first):
171
171
  if not first:f.write(Z)
@@ -181,7 +181,7 @@ def c(path):
181
181
  except F as D:
182
182
  if D.args[0]==u:
183
183
  try:os.mkdir(B)
184
- except F as E:N('failed to create folder {}'.format(B));raise E
184
+ except F as E:M('failed to create folder {}'.format(B));raise E
185
185
  C=A+1
186
186
  def T(s):
187
187
  A=' on '
@@ -189,20 +189,23 @@ def T(s):
189
189
  if A in s:s=s.split(A,1)[0]
190
190
  return s.split('-')[1]if'-'in s else B
191
191
  def _info():
192
- h='ev3-pybricks';g='pycom';f='pycopy';c='GENERIC';a='arch';Z='cpu';Y='ver';V='with';G='mpy';F='build';A=b({K:sys.implementation.name,D:B,F:B,Y:B,'port':'stm32'if sys.platform.startswith('pyb')else sys.platform,J:c,Z:B,G:B,a:B})
192
+ k='ev3-pybricks';j='pycom';i='pycopy';h='unix';g='win32';f='GENERIC';c='arch';a='cpu';Z='ver';W='with';K='mpy';G='port';F='build';A=b({L:sys.implementation.name,D:B,F:B,Z:B,G:sys.platform,J:f,a:B,K:B,c:B})
193
+ if A[G].startswith('pyb'):A[G]='stm32'
194
+ elif A[G]==g:A[G]='windows'
195
+ elif A[G]=='linux':A[G]=h
193
196
  try:A[D]=I.join([str(A)for A in sys.implementation.version])
194
197
  except H:pass
195
- try:W=sys.implementation._machine if'_machine'in O(sys.implementation)else os.uname().machine;A[J]=W.strip();A[Z]=W.split(V)[1].strip();A[G]=sys.implementation._mpy if'_mpy'in O(sys.implementation)else sys.implementation.mpy if G in O(sys.implementation)else B
198
+ try:X=sys.implementation._machine if'_machine'in O(sys.implementation)else os.uname().machine;A[J]=X.strip();A[a]=X.split(W)[1].strip();A[K]=sys.implementation._mpy if'_mpy'in O(sys.implementation)else sys.implementation.mpy if K in O(sys.implementation)else B
196
199
  except(H,P):pass
197
200
  C.collect()
198
- for N in[A+'/board_info.csv'for A in w]:
199
- if e(N):
200
- L=A[J].strip()
201
- if d(A,L,N):break
202
- if V in L:
203
- L=L.split(V)[0].strip()
204
- if d(A,L,N):break
205
- A[J]=c
201
+ for U in[A+'/board_info.csv'for A in w]:
202
+ if e(U):
203
+ M=A[J].strip()
204
+ if d(A,M,U):break
205
+ if W in M:
206
+ M=M.split(W)[0].strip()
207
+ if d(A,M,U):break
208
+ A[J]=f
206
209
  A[J]=A[J].replace(' ',S);C.collect()
207
210
  try:
208
211
  A[F]=T(os.uname()[3])
@@ -210,27 +213,27 @@ def _info():
210
213
  if not A[F]and';'in sys.version:A[F]=T(sys.version.split(';')[1])
211
214
  except(H,P):pass
212
215
  if A[F]and R(A[F])>5:A[F]=B
213
- if A[D]==B and sys.platform not in('unix','win32'):
214
- try:i=os.uname();A[D]=i.release
216
+ if A[D]==B and sys.platform not in(h,g):
217
+ try:m=os.uname();A[D]=m.release
215
218
  except(P,H,TypeError):pass
216
- for(j,k,m)in[(f,f,'const'),(g,g,'FAT'),(h,'pybricks.hubs','EV3Brick')]:
217
- try:n=__import__(k,E,E,m);A[K]=j;del n;break
218
- except(M,Q):pass
219
- if A[K]==h:A['release']='2.0.0'
220
- if A[K]==l:
219
+ for(n,o,p)in[(i,i,'const'),(j,j,'FAT'),(k,'pybricks.hubs','EV3Brick')]:
220
+ try:q=__import__(o,E,E,p);A[L]=n;del q;break
221
+ except(N,Q):pass
222
+ if A[L]==k:A['release']='2.0.0'
223
+ if A[L]==l:
221
224
  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]
222
- if G in A and A[G]:
223
- U=int(A[G]);X=[E,'x86','x64','armv6','armv6m','armv7m','armv7em','armv7emsp','armv7emdp','xtensa','xtensawin'][U>>10]
224
- if X:A[a]=X
225
- A[G]='v{}.{}'.format(U&255,U>>8&3)
226
- A[Y]=f"v{A[D]}-{A[F]}"if A[F]else f"v{A[D]}";return A
225
+ if K in A and A[K]:
226
+ V=int(A[K]);Y=[E,'x86','x64','armv6','armv6m','armv7m','armv7em','armv7emsp','armv7emdp','xtensa','xtensawin'][V>>10]
227
+ if Y:A[c]=Y
228
+ A[K]='v{}.{}'.format(V&255,V>>8&3)
229
+ A[Z]=f"v{A[D]}-{A[F]}"if A[F]else f"v{A[D]}";return A
227
230
  def d(info,board_descr,filename):
228
231
  with V(filename,'r')as C:
229
232
  while 1:
230
233
  B=C.readline()
231
234
  if not B:break
232
235
  D,E=B.split(',')[0].strip(),B.split(',')[1].strip()
233
- if D==board_descr:info[J]=E;return L
236
+ if D==board_descr:info[J]=E;return K
234
237
  return A
235
238
  def get_root():
236
239
  try:A=os.getcwd()
@@ -242,7 +245,7 @@ def get_root():
242
245
  return B
243
246
  def e(filename):
244
247
  try:
245
- if os.stat(filename)[0]>>14:return L
248
+ if os.stat(filename)[0]>>14:return K
246
249
  return A
247
250
  except F:return A
248
251
  def f():sys.exit(1)
@@ -256,7 +259,7 @@ def read_path():
256
259
  return path
257
260
  def g():
258
261
  try:B=bytes('abc',encoding='utf8');C=g.__module__;return A
259
- except(h,H):return L
262
+ except(h,H):return K
260
263
  def main():
261
264
  D='lvgl'
262
265
  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.15.2
12
+ This variant was generated from createstubs.py by micropython-stubber v1.16.2
13
13
  """
14
14
  # Copyright (c) 2019-2023 Jos Verlinde
15
15
 
@@ -30,7 +30,7 @@ try:
30
30
  except ImportError:
31
31
  from ucollections import OrderedDict # type: ignore
32
32
 
33
- __version__ = "v1.16.0"
33
+ __version__ = "v1.16.2"
34
34
  ENOENT = 2
35
35
  _MAX_CLASS_LEVEL = 2 # Max class nesting
36
36
  LIBS = [".", "/lib", "/sd/lib", "/flash/lib", "lib"]
@@ -439,13 +439,20 @@ def _info(): # type:() -> dict[str, str]
439
439
  "version": "",
440
440
  "build": "",
441
441
  "ver": "",
442
- "port": "stm32" if sys.platform.startswith("pyb") else sys.platform, # port: esp32 / win32 / linux / stm32
442
+ "port": sys.platform, # port: esp32 / win32 / linux / stm32
443
443
  "board": "GENERIC",
444
444
  "cpu": "",
445
445
  "mpy": "",
446
446
  "arch": "",
447
447
  }
448
448
  )
449
+ # change port names to be consistent with the repo
450
+ if info["port"].startswith("pyb"):
451
+ info["port"] = "stm32"
452
+ elif info["port"] == "win32":
453
+ info["port"] = "windows"
454
+ elif info["port"] == "linux":
455
+ info["port"] = "unix"
449
456
  try:
450
457
  info["version"] = ".".join([str(n) for n in sys.implementation.version])
451
458
  except AttributeError:
@@ -41,7 +41,7 @@ try:from machine import reset
41
41
  except O:pass
42
42
  try:from collections import OrderedDict as d
43
43
  except O:from ucollections import OrderedDict as d
44
- __version__='v1.16.0'
44
+ __version__='v1.16.2'
45
45
  v=2
46
46
  w=2
47
47
  e=[I,'/lib','/sd/lib','/flash/lib','lib']
@@ -189,20 +189,23 @@ def U(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
- k='ev3-pybricks';j='pycom';i='pycopy';f='GENERIC';c='arch';b='cpu';a='ver';V='with';G='mpy';F='build';A=d({M:sys.implementation.name,D:C,F:C,a:C,'port':'stm32'if sys.platform.startswith('pyb')else sys.platform,J:f,b:C,G:C,c:C})
192
+ n='ev3-pybricks';m='pycom';l='pycopy';k='unix';j='win32';i='GENERIC';f='arch';c='cpu';b='ver';Y='with';K='mpy';G='port';F='build';A=d({M:sys.implementation.name,D:C,F:C,b:C,G:sys.platform,J:i,c:C,K:C,f:C})
193
+ if A[G].startswith('pyb'):A[G]='stm32'
194
+ elif A[G]==j:A[G]='windows'
195
+ elif A[G]=='linux':A[G]=k
193
196
  try:A[D]=I.join([W(A)for A in sys.implementation.version])
194
197
  except H:pass
195
- try:Y=sys.implementation._machine if'_machine'in P(sys.implementation)else os.uname().machine;A[J]=Y.strip();A[b]=Y.split(V)[1].strip();A[G]=sys.implementation._mpy if'_mpy'in P(sys.implementation)else sys.implementation.mpy if G in P(sys.implementation)else C
198
+ try:Z=sys.implementation._machine if'_machine'in P(sys.implementation)else os.uname().machine;A[J]=Z.strip();A[c]=Z.split(Y)[1].strip();A[K]=sys.implementation._mpy if'_mpy'in P(sys.implementation)else sys.implementation.mpy if K in P(sys.implementation)else C
196
199
  except(H,Q):pass
197
200
  B.collect()
198
- for N in[A+'/board_info.csv'for A in e]:
199
- if h(N):
200
- K=A[J].strip()
201
- if g(A,K,N):break
202
- if V in K:
203
- K=K.split(V)[0].strip()
204
- if g(A,K,N):break
205
- A[J]=f
201
+ for R in[A+'/board_info.csv'for A in e]:
202
+ if h(R):
203
+ N=A[J].strip()
204
+ if g(A,N,R):break
205
+ if Y in N:
206
+ N=N.split(Y)[0].strip()
207
+ if g(A,N,R):break
208
+ A[J]=i
206
209
  A[J]=A[J].replace(' ',T);B.collect()
207
210
  try:
208
211
  A[F]=U(os.uname()[3])
@@ -210,20 +213,20 @@ def _info():
210
213
  if not A[F]and';'in sys.version:A[F]=U(sys.version.split(';')[1])
211
214
  except(H,Q):pass
212
215
  if A[F]and L(A[F])>5:A[F]=C
213
- if A[D]==C and sys.platform not in('unix','win32'):
214
- try:l=os.uname();A[D]=l.release
216
+ if A[D]==C and sys.platform not in(k,j):
217
+ try:o=os.uname();A[D]=o.release
215
218
  except(Q,H,TypeError):pass
216
- for(m,n,o)in[(i,i,'const'),(j,j,'FAT'),(k,'pybricks.hubs','EV3Brick')]:
217
- try:p=__import__(n,E,E,o);A[M]=m;del p;break
219
+ for(p,q,r)in[(l,l,'const'),(m,m,'FAT'),(n,'pybricks.hubs','EV3Brick')]:
220
+ try:s=__import__(q,E,E,r);A[M]=p;del s;break
218
221
  except(O,S):pass
219
- if A[M]==k:A['release']='2.0.0'
222
+ if A[M]==n:A['release']='2.0.0'
220
223
  if A[M]==X:
221
224
  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]
222
- if G in A and A[G]:
223
- R=int(A[G]);Z=[E,'x86','x64','armv6','armv6m','armv7m','armv7em','armv7emsp','armv7emdp','xtensa','xtensawin'][R>>10]
224
- if Z:A[c]=Z
225
- A[G]='v{}.{}'.format(R&255,R>>8&3)
226
- A[a]=f"v{A[D]}-{A[F]}"if A[F]else f"v{A[D]}";return A
225
+ if K in A and A[K]:
226
+ V=int(A[K]);a=[E,'x86','x64','armv6','armv6m','armv7m','armv7em','armv7emsp','armv7emdp','xtensa','xtensawin'][V>>10]
227
+ if a:A[f]=a
228
+ A[K]='v{}.{}'.format(V&255,V>>8&3)
229
+ A[b]=f"v{A[D]}-{A[F]}"if A[F]else f"v{A[D]}";return A
227
230
  def g(info,board_descr,filename):
228
231
  with R(filename,'r')as C:
229
232
  while 1:
Binary file
@@ -25,10 +25,10 @@ R=len
25
25
  Q=KeyError
26
26
  P=IndexError
27
27
  O=dir
28
- N=print
29
- M=ImportError
30
- L=True
31
- K='family'
28
+ M=print
29
+ N=ImportError
30
+ K=True
31
+ L='family'
32
32
  J='board'
33
33
  I='.'
34
34
  H=AttributeError
@@ -41,10 +41,10 @@ B=''
41
41
  import gc as C,os,sys
42
42
  from ujson import dumps as c
43
43
  try:from machine import reset
44
- except M:pass
44
+ except N:pass
45
45
  try:from collections import OrderedDict as d
46
- except M:from ucollections import OrderedDict as d
47
- __version__='v1.16.0'
46
+ except N:from ucollections import OrderedDict as d
47
+ __version__='v1.16.2'
48
48
  x=2
49
49
  y=2
50
50
  z=[I,'/lib','/sd/lib','/flash/lib','lib']
@@ -57,7 +57,7 @@ class Stubber:
57
57
  except H:pass
58
58
  A._report=[];A.info=_info();C.collect()
59
59
  if B:A._fwid=B.lower()
60
- elif A.info[K]==W:A._fwid='{family}-{ver}-{port}-{board}'.format(**A.info)
60
+ elif A.info[L]==W:A._fwid='{family}-{ver}-{port}-{board}'.format(**A.info)
61
61
  else:A._fwid='{family}-{ver}-{port}'.format(**A.info)
62
62
  A._start_free=C.mem_free()
63
63
  if path:
@@ -65,7 +65,7 @@ class Stubber:
65
65
  else:path=get_root()
66
66
  A.path='{}/stubs/{}'.format(path,A.flat_fwid).replace('//',G)
67
67
  try:e(path+G)
68
- except F:N('error creating stub folder {}'.format(path))
68
+ except F:M('error creating stub folder {}'.format(path))
69
69
  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=[]
70
70
  def get_obj_attributes(L,item_instance):
71
71
  I=item_instance;D=[];J=[]
@@ -100,29 +100,29 @@ class Stubber:
100
100
  if H is E:O=D.replace(I,S)+'.py';H=J.path+G+O
101
101
  else:O=H.split(G)[-1]
102
102
  if G in D:D=D.replace(G,I)
103
- K=E
104
- try:K=__import__(D,E,E,'*');T=C.mem_free()
105
- except M:return A
103
+ L=E
104
+ try:L=__import__(D,E,E,'*');T=C.mem_free()
105
+ except N:return A
106
106
  e(H)
107
- with V(H,'w')as N:P=str(J.info).replace('OrderedDict(',B).replace('})','}');R='"""\nModule: \'{0}\' on {1}\n"""\n# MCU: {2}\n# Stubber: {3}\n'.format(D,J._fwid,P,__version__);N.write(R);N.write('from typing import Any\nfrom _typeshed import Incomplete\n\n');J.write_object_stub(N,K,D,B)
107
+ with V(H,'w')as M:P=str(J.info).replace('OrderedDict(',B).replace('})','}');R='"""\nModule: \'{0}\' on {1}\n"""\n# MCU: {2}\n# Stubber: {3}\n'.format(D,J._fwid,P,__version__);M.write(R);M.write('from typing import Any\nfrom _typeshed import Incomplete\n\n');J.write_object_stub(M,L,D,B)
108
108
  J._report.append('{{"module": "{}", "file": "{}"}}'.format(D,H.replace('\\',G)))
109
109
  if D not in{'os',s,t,'gc'}:
110
- try:del K
110
+ try:del L
111
111
  except(F,Q):pass
112
112
  try:del sys.modules[D]
113
113
  except Q:pass
114
- C.collect();return L
114
+ C.collect();return K
115
115
  def write_object_stub(K,fp,object_expr,obj_name,indent,in_class=0):
116
- d='{0}{1} = {2} # type: {3}\n';c='bound_method';b='Incomplete';P=in_class;O=object_expr;M='Exception';H=fp;D=indent;C.collect()
116
+ d='{0}{1} = {2} # type: {3}\n';c='bound_method';b='Incomplete';P=in_class;O=object_expr;N='Exception';H=fp;D=indent;C.collect()
117
117
  if O in K.problematic:return
118
118
  S,L=K.get_obj_attributes(O)
119
- if L:N(L)
119
+ if L:M(L)
120
120
  for(E,J,G,T,f)in S:
121
- if E in['classmethod','staticmethod','BaseException',M]:continue
121
+ if E in['classmethod','staticmethod','BaseException',N]:continue
122
122
  if E[0].isdigit():continue
123
123
  if G=="<class 'type'>"and R(D)<=y*4:
124
- U=B;V=E.endswith(M)or E.endswith('Error')or E in['KeyboardInterrupt','StopIteration','SystemExit']
125
- if V:U=M
124
+ U=B;V=E.endswith(N)or E.endswith('Error')or E in['KeyboardInterrupt','StopIteration','SystemExit']
125
+ if V:U=N
126
126
  A='\n{}class {}({}):\n'.format(D,E,U)
127
127
  if V:A+=D+' ...\n';H.write(A);return
128
128
  H.write(A);K.write_object_stub(H,T,'{0}.{1}'.format(obj_name,E),D+' ',P+1);A=D+' def __init__(self, *argv, **kwargs) -> None:\n';A+=D+' ...\n\n';H.write(A)
@@ -164,11 +164,11 @@ class Stubber:
164
164
  G=u.format(B.path,filename);C.collect()
165
165
  try:
166
166
  with V(G,'w')as D:
167
- B.write_json_header(D);E=L
167
+ B.write_json_header(D);E=K
168
168
  for H in B._report:B.write_json_node(D,H,E);E=A
169
169
  B.write_json_end(D)
170
170
  I=B._start_free-C.mem_free()
171
- except F:N('Failed to create the report.')
171
+ except F:M('Failed to create the report.')
172
172
  def write_json_header(B,f):A='firmware';f.write('{');f.write(c({A:B.info})[1:-1]);f.write(a);f.write(c({v:{D:__version__},'stubtype':A})[1:-1]);f.write(a);f.write('"modules" :[\n')
173
173
  def write_json_node(A,f,n,first):
174
174
  if not first:f.write(a)
@@ -184,7 +184,7 @@ def e(path):
184
184
  except F as D:
185
185
  if D.args[0]==x:
186
186
  try:os.mkdir(B)
187
- except F as E:N('failed to create folder {}'.format(B));raise E
187
+ except F as E:M('failed to create folder {}'.format(B));raise E
188
188
  C=A+1
189
189
  def T(s):
190
190
  A=' on '
@@ -192,20 +192,23 @@ def T(s):
192
192
  if A in s:s=s.split(A,1)[0]
193
193
  return s.split('-')[1]if'-'in s else B
194
194
  def _info():
195
- i='ev3-pybricks';h='pycopy';e='GENERIC';c='arch';a='cpu';Z='ver';V='with';G='mpy';F='build';A=d({K:sys.implementation.name,D:B,F:B,Z:B,'port':'stm32'if sys.platform.startswith(w)else sys.platform,J:e,a:B,G:B,c:B})
195
+ l='ev3-pybricks';k='pycopy';j='unix';i='win32';h='GENERIC';e='arch';c='cpu';a='ver';X='with';K='mpy';G='port';F='build';A=d({L:sys.implementation.name,D:B,F:B,a:B,G:sys.platform,J:h,c:B,K:B,e:B})
196
+ if A[G].startswith(w):A[G]='stm32'
197
+ elif A[G]==i:A[G]='windows'
198
+ elif A[G]=='linux':A[G]=j
196
199
  try:A[D]=I.join([str(A)for A in sys.implementation.version])
197
200
  except H:pass
198
- try:X=sys.implementation._machine if'_machine'in O(sys.implementation)else os.uname().machine;A[J]=X.strip();A[a]=X.split(V)[1].strip();A[G]=sys.implementation._mpy if'_mpy'in O(sys.implementation)else sys.implementation.mpy if G in O(sys.implementation)else B
201
+ try:Y=sys.implementation._machine if'_machine'in O(sys.implementation)else os.uname().machine;A[J]=Y.strip();A[c]=Y.split(X)[1].strip();A[K]=sys.implementation._mpy if'_mpy'in O(sys.implementation)else sys.implementation.mpy if K in O(sys.implementation)else B
199
202
  except(H,P):pass
200
203
  C.collect()
201
- for N in[A+'/board_info.csv'for A in z]:
202
- if g(N):
203
- L=A[J].strip()
204
- if f(A,L,N):break
205
- if V in L:
206
- L=L.split(V)[0].strip()
207
- if f(A,L,N):break
208
- A[J]=e
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
209
212
  A[J]=A[J].replace(' ',S);C.collect()
210
213
  try:
211
214
  A[F]=T(os.uname()[3])
@@ -213,27 +216,27 @@ def _info():
213
216
  if not A[F]and';'in sys.version:A[F]=T(sys.version.split(';')[1])
214
217
  except(H,P):pass
215
218
  if A[F]and R(A[F])>5:A[F]=B
216
- if A[D]==B and sys.platform not in('unix','win32'):
217
- try:j=os.uname();A[D]=j.release
219
+ if A[D]==B and sys.platform not in(j,i):
220
+ try:m=os.uname();A[D]=m.release
218
221
  except(P,H,TypeError):pass
219
- for(k,l,m)in[(h,h,'const'),(b,b,'FAT'),(i,'pybricks.hubs','EV3Brick')]:
220
- try:n=__import__(l,E,E,m);A[K]=k;del n;break
221
- except(M,Q):pass
222
- if A[K]==i:A['release']='2.0.0'
223
- if A[K]==W:
222
+ for(n,o,p)in[(k,k,'const'),(b,b,'FAT'),(l,'pybricks.hubs','EV3Brick')]:
223
+ try:q=__import__(o,E,E,p);A[L]=n;del q;break
224
+ except(N,Q):pass
225
+ if A[L]==l:A['release']='2.0.0'
226
+ if A[L]==W:
224
227
  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]
225
- if G in A and A[G]:
226
- U=int(A[G]);Y=[E,'x86','x64','armv6','armv6m','armv7m','armv7em','armv7emsp','armv7emdp','xtensa','xtensawin'][U>>10]
227
- if Y:A[c]=Y
228
- A[G]='v{}.{}'.format(U&255,U>>8&3)
229
- A[Z]=f"v{A[D]}-{A[F]}"if A[F]else f"v{A[D]}";return A
228
+ if K in A and A[K]:
229
+ V=int(A[K]);Z=[E,'x86','x64','armv6','armv6m','armv7m','armv7em','armv7emsp','armv7emdp','xtensa','xtensawin'][V>>10]
230
+ if Z:A[e]=Z
231
+ A[K]='v{}.{}'.format(V&255,V>>8&3)
232
+ A[a]=f"v{A[D]}-{A[F]}"if A[F]else f"v{A[D]}";return A
230
233
  def f(info,board_descr,filename):
231
234
  with V(filename,'r')as C:
232
235
  while 1:
233
236
  B=C.readline()
234
237
  if not B:break
235
238
  D,E=B.split(',')[0].strip(),B.split(',')[1].strip()
236
- if D==board_descr:info[J]=E;return L
239
+ if D==board_descr:info[J]=E;return K
237
240
  return A
238
241
  def get_root():
239
242
  try:A=os.getcwd()
@@ -245,7 +248,7 @@ def get_root():
245
248
  return B
246
249
  def g(filename):
247
250
  try:
248
- if os.stat(filename)[0]>>14:return L
251
+ if os.stat(filename)[0]>>14:return K
249
252
  return A
250
253
  except F:return A
251
254
  def h():sys.exit(1)
@@ -259,8 +262,8 @@ def read_path():
259
262
  return path
260
263
  def i():
261
264
  try:B=bytes('abc',encoding='utf8');C=i.__module__;return A
262
- except(j,H):return L
263
- 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','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','flashbdev','framebuf','freesans20','fs_driver','functools','galactic','gc','gfx_pack','gsm','hashlib','heapq','hub75','ili9341','ili9XXX','imagetools','inisetup','interstate75','io','jpegdec','json','lcd160cr','lodepng',t,'lsm6dsox','lv_colors','lv_utils','lvgl','lwip','machine','math','microWebSocket','microWebSrv','microWebTemplate',W,'mip','mip/__init__','motor','mpu6500','mpu9250','neopixel','network','ntptime','onewire','os','pcf85063a','picoexplorer','picographics','picokeypad','picoscroll','picounicorn','picowireless','pimoroni','pimoroni_bus','pimoroni_i2c','plasma','platform',w,b,'pye','qrcode','queue','random','requests','rp2','rtch','samd','select','servo','socket','ssd1306','ssh','ssl','stm','struct',s,'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',D,'websocket','websocket_helper','wipy','writer','xpt2046','ymodem','zephyr','zlib'];C.collect();stubber.create_all_stubs();stubber.report()
265
+ except(j,H):return K
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',t,'lsm6dsox','lv_colors','lv_utils','lvgl','lwip','machine','math','microWebSocket','microWebSrv','microWebTemplate',W,'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',w,b,'pye','qrcode','queue','random','requests','requests/__init__','rp2','rtch','samd','select','servo','socket','ssd1306','ssh','ssl','stm','struct',s,'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',D,'websocket','websocket_helper','wipy','writer','xpt2046','ymodem','zephyr','zlib'];C.collect();stubber.create_all_stubs();stubber.report()
264
267
  if __name__=='__main__'or i():
265
268
  try:A0=logging.getLogger(v);logging.basicConfig(level=logging.INFO)
266
269
  except l:pass
Binary file
stubber/board/info.py ADDED
@@ -0,0 +1,183 @@
1
+ import gc
2
+ import logging
3
+ import os
4
+ import sys
5
+
6
+ LIBS = [".", "/lib", "/sd/lib", "/flash/lib", "lib"]
7
+ # from ujson import dumps
8
+
9
+ try:
10
+ from machine import reset # type: ignore
11
+ except ImportError:
12
+ pass
13
+
14
+ try:
15
+ from collections import OrderedDict
16
+ except ImportError:
17
+ from ucollections import OrderedDict # type: ignore
18
+
19
+
20
+ def _info(): # type:() -> dict[str, str]
21
+ info = OrderedDict(
22
+ {
23
+ "family": sys.implementation.name,
24
+ "version": "",
25
+ "build": "",
26
+ "ver": "",
27
+ "port": "stm32"
28
+ if sys.platform.startswith("pyb")
29
+ else sys.platform, # port: esp32 / win32 / linux / stm32
30
+ "board": "GENERIC",
31
+ "cpu": "",
32
+ "mpy": "",
33
+ "arch": "",
34
+ }
35
+ )
36
+ try:
37
+ info["version"] = ".".join([str(n) for n in sys.implementation.version])
38
+ except AttributeError:
39
+ pass
40
+ try:
41
+ machine = (
42
+ sys.implementation._machine
43
+ if "_machine" in dir(sys.implementation)
44
+ else os.uname().machine
45
+ )
46
+ info["board"] = machine.strip()
47
+ info["cpu"] = machine.split("with")[1].strip()
48
+ info["mpy"] = (
49
+ sys.implementation._mpy
50
+ if "_mpy" in dir(sys.implementation)
51
+ else sys.implementation.mpy
52
+ if "mpy" in dir(sys.implementation)
53
+ else ""
54
+ )
55
+ except (AttributeError, IndexError):
56
+ pass
57
+ gc.collect()
58
+ for filename in [d + "/board_info.csv" for d in LIBS]:
59
+ print("Check file:", filename)
60
+ if file_exists(filename):
61
+ print("Found board info file: {}".format(filename))
62
+ b = info["board"].strip()
63
+ if find_board(info, b, filename):
64
+ break
65
+ if "with" in b:
66
+ b = b.split("with")[0].strip()
67
+ if find_board(info, b, filename):
68
+ break
69
+ info["board"] = "GENERIC"
70
+ break
71
+ info["board"] = info["board"].replace(" ", "_")
72
+ gc.collect()
73
+
74
+ try:
75
+ # extract build from uname().version if available
76
+ info["build"] = _build(os.uname()[3])
77
+ if not info["build"]:
78
+ # extract build from uname().release if available
79
+ info["build"] = _build(os.uname()[2])
80
+ if not info["build"] and ";" in sys.version:
81
+ # extract build from uname().release if available
82
+ info["build"] = _build(sys.version.split(";")[1])
83
+ except (AttributeError, IndexError):
84
+ pass
85
+ # avoid build hashes
86
+ if info["build"] and len(info["build"]) > 5:
87
+ info["build"] = ""
88
+
89
+ if info["version"] == "" and sys.platform not in ("unix", "win32"):
90
+ try:
91
+ u = os.uname()
92
+ info["version"] = u.release
93
+ except (IndexError, AttributeError, TypeError):
94
+ pass
95
+ # detect families
96
+ for fam_name, mod_name, mod_thing in [
97
+ ("pycopy", "pycopy", "const"),
98
+ ("pycom", "pycom", "FAT"),
99
+ ("ev3-pybricks", "pybricks.hubs", "EV3Brick"),
100
+ ]:
101
+ try:
102
+ _t = __import__(mod_name, None, None, (mod_thing))
103
+ info["family"] = fam_name
104
+ del _t
105
+ break
106
+ except (ImportError, KeyError):
107
+ pass
108
+
109
+ if info["family"] == "ev3-pybricks":
110
+ info["release"] = "2.0.0"
111
+
112
+ if info["family"] == "micropython":
113
+ if (
114
+ info["version"]
115
+ and info["version"].endswith(".0")
116
+ and info["version"]
117
+ >= "1.10.0" # versions from 1.10.0 to 1.20.0 do not have a micro .0
118
+ and info["version"] <= "1.19.9"
119
+ ):
120
+ # drop the .0 for newer releases
121
+ info["version"] = info["version"][:-2]
122
+
123
+ # spell-checker: disable
124
+ if "mpy" in info and info["mpy"]: # mpy on some v1.11+ builds
125
+ sys_mpy = int(info["mpy"])
126
+ # .mpy architecture
127
+ arch = [
128
+ None,
129
+ "x86",
130
+ "x64",
131
+ "armv6",
132
+ "armv6m",
133
+ "armv7m",
134
+ "armv7em",
135
+ "armv7emsp",
136
+ "armv7emdp",
137
+ "xtensa",
138
+ "xtensawin",
139
+ ][sys_mpy >> 10]
140
+ if arch:
141
+ info["arch"] = arch
142
+ # .mpy version.minor
143
+ info["mpy"] = "v{}.{}".format(sys_mpy & 0xFF, sys_mpy >> 8 & 3)
144
+ # simple to use version[-build] string
145
+ info["ver"] = f"v{info['version']}-{info['build']}" if info["build"] else f"v{info['version']}"
146
+
147
+ return info
148
+
149
+
150
+ def find_board(info: dict, board_descr: str, filename: str):
151
+ print("Find board '{}' in the provided board_info.csv file".format(board_descr))
152
+ with open(filename, "r") as file:
153
+ # ugly code to make testable in python and micropython
154
+ while 1:
155
+ line = file.readline()
156
+ if not line:
157
+ break
158
+ descr_, board_ = line.split(",")[0].strip(), line.split(",")[1].strip()
159
+ if descr_ == board_descr:
160
+ info["board"] = board_
161
+ return True
162
+ return False
163
+
164
+
165
+ def file_exists(filename: str):
166
+ try:
167
+ if os.stat(filename)[0] >> 14:
168
+ return True
169
+ return False
170
+ except OSError:
171
+ return False
172
+
173
+
174
+ def _build(s):
175
+ # extract a build nr from a string
176
+ if not s:
177
+ return ""
178
+ if " on " in s:
179
+ s = s.split(" on ", 1)[0]
180
+ return s.split("-")[1] if "-" in s else ""
181
+
182
+
183
+ print(f"info: {_info()}")
@@ -45,6 +45,7 @@ aioespnow
45
45
  ak8963
46
46
  apa102
47
47
  apa106
48
+ argparse
48
49
  array
49
50
  asyncio/__init__
50
51
  asyncio/core
@@ -93,6 +94,7 @@ esp
93
94
  esp32
94
95
  espidf
95
96
  espnow
97
+ ffi
96
98
  flashbdev
97
99
  framebuf
98
100
  freesans20
@@ -129,6 +131,7 @@ microWebTemplate
129
131
  micropython
130
132
  mip
131
133
  mip/__init__
134
+ mip/__main__
132
135
  motor
133
136
  mpu6500
134
137
  mpu9250
@@ -156,6 +159,7 @@ qrcode
156
159
  queue
157
160
  random
158
161
  requests
162
+ requests/__init__
159
163
  rp2
160
164
  rtch
161
165
  samd
@@ -168,6 +172,7 @@ ssl
168
172
  stm
169
173
  struct
170
174
  sys
175
+ termios
171
176
  time
172
177
  tpcalib
173
178
  uarray
@@ -1,5 +1,6 @@
1
1
  """Build and packaging defaults for stubber"""
2
2
  from typing import Dict, List
3
+
3
4
  from stubber.utils.config import CONFIG
4
5
  from stubber.utils.versions import clean_version
5
6
 
@@ -96,7 +96,7 @@ def copy_and_merge_docstubs(fw_path: Path, dest_path: Path, docstub_path: Path):
96
96
 
97
97
  # 1 - Copy the stubs to the package, directly in the package folder (no folders)
98
98
  try:
99
- log.trace(f"Copying firmware stubs from {fw_path}")
99
+ log.debug(f"Copying firmware stubs from {fw_path}")
100
100
  shutil.copytree(fw_path, dest_path, symlinks=True, dirs_exist_ok=True)
101
101
  except OSError as e:
102
102
  log.error(f"Error copying stubs from : { fw_path}, {e}")
stubber/rst/lookup.py CHANGED
@@ -512,7 +512,7 @@ CHILD_PARENT_CLASS = {
512
512
  "namedtuple": "tuple",
513
513
  "deque": "stdlib_deque",
514
514
  # ESPNow
515
- "ESPNow": "ESPNowBase,Iterator",
515
+ "ESPNow": "ESPNowBase,Iterator", # causes issue with mypy
516
516
  "AIOESPNow": "ESPNow",
517
517
  # array
518
518
  "array": "List",