micropython-stubber 1.24.1__py3-none-any.whl → 1.24.4__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 (90) hide show
  1. {micropython_stubber-1.24.1.dist-info → micropython_stubber-1.24.4.dist-info}/METADATA +9 -29
  2. micropython_stubber-1.24.4.dist-info/RECORD +107 -0
  3. {micropython_stubber-1.24.1.dist-info → micropython_stubber-1.24.4.dist-info}/WHEEL +1 -1
  4. stubber/__init__.py +1 -1
  5. stubber/board/createstubs.py +44 -38
  6. stubber/board/createstubs_db.py +17 -12
  7. stubber/board/createstubs_db_min.py +63 -63
  8. stubber/board/createstubs_db_mpy.mpy +0 -0
  9. stubber/board/createstubs_mem.py +17 -12
  10. stubber/board/createstubs_mem_min.py +99 -99
  11. stubber/board/createstubs_mem_mpy.mpy +0 -0
  12. stubber/board/createstubs_min.py +111 -112
  13. stubber/board/createstubs_mpy.mpy +0 -0
  14. stubber/board/modulelist.txt +27 -27
  15. stubber/codemod/board.py +1 -1
  16. stubber/codemod/enrich.py +13 -13
  17. stubber/codemod/merge_docstub.py +83 -53
  18. stubber/codemod/visitors/type_helpers.py +143 -41
  19. stubber/commands/enrich_folder_cmd.py +17 -17
  20. stubber/commands/get_docstubs_cmd.py +27 -9
  21. stubber/commands/get_frozen_cmd.py +1 -0
  22. stubber/commands/merge_cmd.py +2 -4
  23. stubber/merge_config.py +5 -36
  24. stubber/minify.py +3 -3
  25. stubber/modcat.py +118 -0
  26. stubber/publish/merge_docstubs.py +22 -5
  27. stubber/publish/stubpackage.py +33 -28
  28. stubber/rst/lookup.py +6 -23
  29. stubber/rst/reader.py +8 -13
  30. stubber/stubs_from_docs.py +2 -1
  31. stubber/tools/manifestfile.py +2 -1
  32. stubber/{cst_transformer.py → typing_collector.py} +36 -4
  33. micropython_stubber-1.24.1.dist-info/RECORD +0 -161
  34. mpflash/README.md +0 -220
  35. mpflash/libusb_flash.ipynb +0 -203
  36. mpflash/mpflash/__init__.py +0 -0
  37. mpflash/mpflash/add_firmware.py +0 -98
  38. mpflash/mpflash/ask_input.py +0 -236
  39. mpflash/mpflash/basicgit.py +0 -324
  40. mpflash/mpflash/bootloader/__init__.py +0 -2
  41. mpflash/mpflash/bootloader/activate.py +0 -60
  42. mpflash/mpflash/bootloader/detect.py +0 -82
  43. mpflash/mpflash/bootloader/manual.py +0 -101
  44. mpflash/mpflash/bootloader/micropython.py +0 -12
  45. mpflash/mpflash/bootloader/touch1200.py +0 -36
  46. mpflash/mpflash/cli_download.py +0 -129
  47. mpflash/mpflash/cli_flash.py +0 -224
  48. mpflash/mpflash/cli_group.py +0 -111
  49. mpflash/mpflash/cli_list.py +0 -87
  50. mpflash/mpflash/cli_main.py +0 -39
  51. mpflash/mpflash/common.py +0 -217
  52. mpflash/mpflash/config.py +0 -44
  53. mpflash/mpflash/connected.py +0 -96
  54. mpflash/mpflash/download.py +0 -364
  55. mpflash/mpflash/downloaded.py +0 -138
  56. mpflash/mpflash/errors.py +0 -9
  57. mpflash/mpflash/flash/__init__.py +0 -55
  58. mpflash/mpflash/flash/esp.py +0 -59
  59. mpflash/mpflash/flash/stm32.py +0 -19
  60. mpflash/mpflash/flash/stm32_dfu.py +0 -104
  61. mpflash/mpflash/flash/uf2/__init__.py +0 -88
  62. mpflash/mpflash/flash/uf2/boardid.py +0 -15
  63. mpflash/mpflash/flash/uf2/linux.py +0 -136
  64. mpflash/mpflash/flash/uf2/macos.py +0 -42
  65. mpflash/mpflash/flash/uf2/uf2disk.py +0 -12
  66. mpflash/mpflash/flash/uf2/windows.py +0 -43
  67. mpflash/mpflash/flash/worklist.py +0 -170
  68. mpflash/mpflash/list.py +0 -106
  69. mpflash/mpflash/logger.py +0 -41
  70. mpflash/mpflash/mpboard_id/__init__.py +0 -98
  71. mpflash/mpflash/mpboard_id/add_boards.py +0 -262
  72. mpflash/mpflash/mpboard_id/board.py +0 -37
  73. mpflash/mpflash/mpboard_id/board_id.py +0 -90
  74. mpflash/mpflash/mpboard_id/board_info.zip +0 -0
  75. mpflash/mpflash/mpboard_id/store.py +0 -48
  76. mpflash/mpflash/mpremoteboard/__init__.py +0 -271
  77. mpflash/mpflash/mpremoteboard/mpy_fw_info.py +0 -152
  78. mpflash/mpflash/mpremoteboard/runner.py +0 -140
  79. mpflash/mpflash/vendor/board_database.py +0 -185
  80. mpflash/mpflash/vendor/click_aliases.py +0 -91
  81. mpflash/mpflash/vendor/dfu.py +0 -165
  82. mpflash/mpflash/vendor/pydfu.py +0 -605
  83. mpflash/mpflash/vendor/readme.md +0 -12
  84. mpflash/mpflash/versions.py +0 -123
  85. mpflash/poetry.lock +0 -2603
  86. mpflash/pyproject.toml +0 -66
  87. mpflash/stm32_udev_rules.md +0 -63
  88. stubber/codemod/test_enrich.py +0 -87
  89. {micropython_stubber-1.24.1.dist-info → micropython_stubber-1.24.4.dist-info}/LICENSE +0 -0
  90. {micropython_stubber-1.24.1.dist-info → micropython_stubber-1.24.4.dist-info}/entry_points.txt +0 -0
@@ -1,15 +1,14 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: micropython-stubber
3
- Version: 1.24.1
3
+ Version: 1.24.4
4
4
  Summary: Tooling to create and maintain stubs for MicroPython
5
5
  License: MIT
6
6
  Keywords: MicroPython,stubs,vscode,pyright,linting,static type check
7
7
  Author: Jos Verlinde
8
8
  Author-email: jos_verlinde@hotmail.com
9
- Requires-Python: >=3.9,<4.0
9
+ Requires-Python: >=3.9.2,<4.0
10
10
  Classifier: License :: OSI Approved :: MIT License
11
11
  Classifier: Programming Language :: Python :: 3
12
- Classifier: Programming Language :: Python :: 3.9
13
12
  Classifier: Programming Language :: Python :: 3.10
14
13
  Classifier: Programming Language :: Python :: 3.11
15
14
  Classifier: Programming Language :: Python :: 3.12
@@ -26,13 +25,14 @@ Requires-Dist: executing (>=2.0.1,<3.0.0)
26
25
  Requires-Dist: importlib-metadata (>=1,<9) ; python_version < "3.8"
27
26
  Requires-Dist: libcst (>=1.1.0,<2.0.0)
28
27
  Requires-Dist: loguru (>=0.6,<0.8)
29
- Requires-Dist: mpflash (>=1.24.6)
28
+ Requires-Dist: mpflash (>=1.24.7)
30
29
  Requires-Dist: mpremote (>=1.24.1)
31
30
  Requires-Dist: mypy (>=1.10)
32
31
  Requires-Dist: mypy-gitlab-code-quality (>=1.1.0,<2.0.0)
33
32
  Requires-Dist: packaging (>=24.2,<25.0)
34
33
  Requires-Dist: pipx (>=1.1.0,<2.0.0)
35
34
  Requires-Dist: poetry (>=2.0.1,<3.0.0)
35
+ Requires-Dist: pydeps (==3.0.1)
36
36
  Requires-Dist: pygithub (>=2.1.1,<3.0.0)
37
37
  Requires-Dist: pypi-simple (>=1.0.0,<2.0.0)
38
38
  Requires-Dist: pyright (>=1.1.341)
@@ -59,7 +59,6 @@ Description-Content-Type: text/markdown
59
59
  [![All Contributors](https://img.shields.io/badge/all_contributors-19-green.svg?style=flat-square)](#Contributions)
60
60
  <!-- break -->
61
61
  [![pytest stubber](https://github.com/Josverl/micropython-stubber/actions/workflows/pytest.yml/badge.svg)](https://github.com/Josverl/micropython-stubber/actions/workflows/pytest.yml)
62
- [![pytest mpflash](https://github.com/Josverl/micropython-stubber/actions/workflows/pytest_mpflash.yml/badge.svg)](https://github.com/Josverl/micropython-stubber/actions/workflows/pytest_mpflash.yml)
63
62
  [![Documentation Status](https://readthedocs.org/projects/micropython-stubber/badge/?version=latest)](https://micropython-stubber.readthedocs.io/en/latest/?badge=latest "Document build status badge")
64
63
  <!-- break -->
65
64
  [![Open in VSCode](https://img.shields.io/static/v1?logo=visualstudiocode&label=&message=Open%20in%20Visual%20Studio%20Code&labelColor=2c2c32&color=007acc&logoColor=007acc
@@ -115,11 +114,8 @@ For more details how to use the stubs please refer to [the documentation on RTD]
115
114
  1. The sister-repo [**MicroPython-stubs**][stubs-repo] contains [all stubs][all-stubs] I have collected with the help of others, and which can be used directly.
116
115
  That repo also contains examples configuration files that can be easily adopted to your setup.
117
116
 
118
- 2. A second repo [micropy-stubs repo][stubs-repo2] maintained by BradenM, also contains stubs, but in a structure only used and distributed by the [micropy-cli](#using-micropy-cli) tool.
119
- You should use micropy-cli to consume stubs from that repo.
120
-
121
- The (stretch) goal is to create a VSCode add-in to simplify the configuration, and allow easy switching between different firmwares and versions.
122
-
117
+ 2. Micropython-stubber uses [MPFlash](https://github.com/Josverl/mpflash?tab=readme-ov-file) in some of its operations.
118
+ mpflash was formerly hosted in this repo, but has been moved to its own repo.
123
119
 
124
120
  ## Install and basic usage of the stubber tool
125
121
 
@@ -172,7 +168,7 @@ for more info see [**Renaming a branch**](https://docs.github.com/en/repositorie
172
168
 
173
169
  ## Licensing
174
170
 
175
- Both `MicroPython-Stubber` and `mpflash` are licensed under the MIT license, and all contributions should follow this [LICENSE](LICENSE).
171
+ `MicroPython-Stubber` is licensed under the MIT license, and all contributions should follow this [LICENSE](LICENSE).
176
172
 
177
173
 
178
174
  # Contributions
@@ -180,6 +176,7 @@ Both `MicroPython-Stubber` and `mpflash` are licensed under the MIT license, and
180
176
  <!--
181
177
  To add via the cli run the following command:
182
178
  npx all-contributors-cli add user things
179
+ npx all-contributors-cli generate
183
180
 
184
181
  - bug
185
182
  - tool
@@ -199,7 +196,7 @@ npx all-contributors-cli add user things
199
196
  <table>
200
197
  <tbody>
201
198
  <tr>
202
- <td align="center" valign="top" width="14.28%"><a href="https://github.com/Josverl"><img src="https://avatars2.githubusercontent.com/u/981654?v=4?s=100" width="100px;" alt="Jos Verlinde"/><br /><sub><b>Jos Verlinde</b></sub></a><br /><a href="https://github.com/Josverl/micropython-stubber/commits?author=josverl" title="Code">💻</a> <a href="#research-josverl" title="Research">🔬</a> <a href="#ideas-josverl" title="Ideas, Planning, & Feedback">🤔</a> <a href="#content-josverl" title="Content">🖋</a> <a href="#stubs-josverl" title="MicroPython stubs">🖍️</a> <a href="#test-josverl" title="Test">✅</a> <a href="#mpflash-josverl" title="mpflash">💥</a></td>
199
+ <td align="center" valign="top" width="14.28%"><a href="https://github.com/Josverl"><img src="https://avatars2.githubusercontent.com/u/981654?v=4?s=100" width="100px;" alt="Jos Verlinde"/><br /><sub><b>Jos Verlinde</b></sub></a><br /><a href="https://github.com/Josverl/micropython-stubber/commits?author=josverl" title="Code">💻</a> <a href="#research-josverl" title="Research">🔬</a> <a href="#ideas-josverl" title="Ideas, Planning, & Feedback">🤔</a> <a href="#content-josverl" title="Content">🖋</a> <a href="#stubs-josverl" title="MicroPython stubs">🖍️</a> <a href="#test-josverl" title="Test">✅</a></td>
203
200
  <td align="center" valign="top" width="14.28%"><a href="https://thonny.org/"><img src="https://avatars1.githubusercontent.com/u/46202078?v=4?s=100" width="100px;" alt="Thonny, Python IDE for beginners"/><br /><sub><b>Thonny, Python IDE for beginners</b></sub></a><br /><a href="#ideas-thonny" title="Ideas, Planning, & Feedback">🤔</a> <a href="#research-thonny" title="Research">🔬</a></td>
204
201
  <td align="center" valign="top" width="14.28%"><a href="https://micropython.org/"><img src="https://avatars1.githubusercontent.com/u/6298560?v=4?s=100" width="100px;" alt="MicroPython"/><br /><sub><b>MicroPython</b></sub></a><br /><a href="#data-micropython" title="Data">🔣</a> <a href="#stubs-micropython" title="MicroPython stubs">🖍️</a></td>
205
202
  <td align="center" valign="top" width="14.28%"><a href="https://github.com/microsoft/pyright"><img src="https://avatars.githubusercontent.com/u/6154722?v=4?s=100" width="100px;" alt="pyright"/><br /><sub><b>pyright</b></sub></a><br /><a href="#tool-pyright" title="Tools">🔧</a></td>
@@ -228,23 +225,6 @@ npx all-contributors-cli add user things
228
225
  <tr>
229
226
  <td align="center" valign="top" width="14.28%"><a href="https://github.com/yegorLitvinov"><img src="https://avatars.githubusercontent.com/u/20367310?v=4?s=100" width="100px;" alt="Egor Litvinov"/><br /><sub><b>Egor Litvinov</b></sub></a><br /><a href="https://github.com/Josverl/micropython-stubber/issues?q=author%3AyegorLitvinov" title="Bug reports">🐛</a></td>
230
227
  <td align="center" valign="top" width="14.28%"><a href="https://github.com/samskiter"><img src="https://avatars.githubusercontent.com/u/1271643?v=4?s=100" width="100px;" alt="Sam Duke"/><br /><sub><b>Sam Duke</b></sub></a><br /><a href="https://github.com/Josverl/micropython-stubber/commits?author=samskiter" title="Code">💻</a></td>
231
- <td align="center" valign="top" width="14.28%"><a href="https://github.com/shariltumin"><img src="https://avatars.githubusercontent.com/u/186120?v=4?s=100" width="100px;" alt="shariltumin"/><br /><sub><b>shariltumin</b></sub></a><br /><a href="#mpflash-shariltumin" title="mpflash">💥</a> <a href="#test-shariltumin" title="Test">✅</a></td>
232
- <td align="center" valign="top" width="14.28%"><a href="https://github.com/mattytrentini"><img src="https://avatars.githubusercontent.com/u/194201?v=4?s=100" width="100px;" alt="Matt Trentini"/><br /><sub><b>Matt Trentini</b></sub></a><br /><a href="#mpflash-mattytrentini" title="mpflash">💥</a> <a href="#test-mattytrentini" title="Test">✅</a></td>
233
- <td align="center" valign="top" width="14.28%"><a href="http://scruss.com/blog/"><img src="https://avatars.githubusercontent.com/u/425706?v=4?s=100" width="100px;" alt="Stewart Russell"/><br /><sub><b>Stewart Russell</b></sub></a><br /><a href="#mpflash-scruss" title="mpflash">💥</a> <a href="#test-scruss" title="Test">✅</a></td>
234
- <td align="center" valign="top" width="14.28%"><a href="https://www.gitlab.com/alelec"><img src="https://avatars.githubusercontent.com/u/3318786?v=4?s=100" width="100px;" alt="Andrew Leech"/><br /><sub><b>Andrew Leech</b></sub></a><br /><a href="#mpflash-andrewleech" title="mpflash">💥</a> <a href="#test-andrewleech" title="Test">✅</a></td>
235
- <td align="center" valign="top" width="14.28%"><a href="https://github.com/wovo"><img src="https://avatars.githubusercontent.com/u/9039468?v=4?s=100" width="100px;" alt="Wouter van Ooijen"/><br /><sub><b>Wouter van Ooijen</b></sub></a><br /><a href="#mpflash-wovo" title="mpflash">💥</a> <a href="#test-wovo" title="Test">✅</a></td>
236
- </tr>
237
- <tr>
238
- <td align="center" valign="top" width="14.28%"><a href="https://github.com/shaneapowell"><img src="https://avatars.githubusercontent.com/u/12113620?v=4?s=100" width="100px;" alt="Shane Powell"/><br /><sub><b>Shane Powell</b></sub></a><br /><a href="#mpflash-shaneapowell" title="mpflash">💥</a> <a href="#test-shaneapowell" title="Test">✅</a></td>
239
- <td align="center" valign="top" width="14.28%"><a href="https://github.com/robert-hh"><img src="https://avatars.githubusercontent.com/u/12476868?v=4?s=100" width="100px;" alt="Robert Hammelrath"/><br /><sub><b>Robert Hammelrath</b></sub></a><br /><a href="#mpflash-robert-hh" title="mpflash">💥</a> <a href="#test-robert-hh" title="Test">✅</a></td>
240
- <td align="center" valign="top" width="14.28%"><a href="https://github.com/beetlegigg"><img src="https://avatars.githubusercontent.com/u/34552737?v=4?s=100" width="100px;" alt="Bg"/><br /><sub><b>Bg</b></sub></a><br /><a href="#mpflash-beetlegigg" title="mpflash">💥</a> <a href="#test-beetlegigg" title="Test">✅</a></td>
241
- <td align="center" valign="top" width="14.28%"><a href="https://github.com/rkompass"><img src="https://avatars.githubusercontent.com/u/90282516?v=4?s=100" width="100px;" alt="Raul Kompaß"/><br /><sub><b>Raul Kompaß</b></sub></a><br /><a href="#mpflash-rkompass" title="mpflash">💥</a> <a href="#test-rkompass" title="Test">✅</a></td>
242
- <td align="center" valign="top" width="14.28%"><a href="https://github.com/garryp4"><img src="https://avatars.githubusercontent.com/u/96994876?v=4?s=100" width="100px;" alt="garryp4"/><br /><sub><b>garryp4</b></sub></a><br /><a href="#mpflash-garryp4" title="mpflash">💥</a> <a href="#test-garryp4" title="Test">✅</a></td>
243
- <td align="center" valign="top" width="14.28%"><a href="https://github.com/shanepowell-ast"><img src="https://avatars.githubusercontent.com/u/102747617?v=4?s=100" width="100px;" alt="Shane Powell"/><br /><sub><b>Shane Powell</b></sub></a><br /><a href="#mpflash-shanepowell-ast" title="mpflash">💥</a> <a href="#test-shanepowell-ast" title="Test">✅</a></td>
244
- <td align="center" valign="top" width="14.28%"><a href="https://andypiper.org/"><img src="https://avatars.githubusercontent.com/u/552452?v=4?s=100" width="100px;" alt="Andy Piper"/><br /><sub><b>Andy Piper</b></sub></a><br /><a href="#mpflash-andypiper" title="mpflash">💥</a> <a href="#test-andypiper" title="Test">✅</a></td>
245
- </tr>
246
- <tr>
247
- <td align="center" valign="top" width="14.28%"><a href="https://github.com/DavesCodeMusings"><img src="https://avatars.githubusercontent.com/u/61114342?v=4?s=100" width="100px;" alt="David Horton"/><br /><sub><b>David Horton</b></sub></a><br /><a href="#mpflash-DavesCodeMusings" title="mpflash">💥</a> <a href="#test-DavesCodeMusings" title="Test">✅</a></td>
248
228
  <td align="center" valign="top" width="14.28%"><a href="https://github.com/hlovatt"><img src="https://avatars.githubusercontent.com/u/8424169?v=4?s=100" width="100px;" alt="Howard Lovatt"/><br /><sub><b>Howard Lovatt</b></sub></a><br /><a href="#stubs-hlovatt" title="MicroPython stubs">🖍️</a> <a href="#research-hlovatt" title="Research">🔬</a></td>
249
229
  <td align="center" valign="top" width="14.28%"><a href="https://virtualwolf.org/"><img src="https://avatars.githubusercontent.com/u/1644623?v=4?s=100" width="100px;" alt="VirtualWolf"/><br /><sub><b>VirtualWolf</b></sub></a><br /><a href="#test-VirtualWolf" title="Test">✅</a></td>
250
230
  <td align="center" valign="top" width="14.28%"><a href="https://github.com/lukaskremla"><img src="https://avatars.githubusercontent.com/u/155779787?v=4?s=100" width="100px;" alt="Lukas Kremla"/><br /><sub><b>Lukas Kremla</b></sub></a><br /><a href="#test-lukaskremla" title="Test">✅</a></td>
@@ -0,0 +1,107 @@
1
+ stubber/__init__.py,sha256=lRYnHA4DwmdNy9mE4Lz5m-QROVtFlsF22Vk74kEGcC8,49
2
+ stubber/board/board_info.csv,sha256=K2VSmfR013fN-oJWkQUmiQ19w09dVwJHDquPy6QmMhY,8627
3
+ stubber/board/boot.py,sha256=XjWlKErU5nI1HJSugXIP_3hlwgRQboE6sJrpcbSygnk,1120
4
+ stubber/board/createstubs.py,sha256=w_n9qm7o26Be_r2vOLiRgGq87Ty5Ei7wc8hG4CiPQl0,34187
5
+ stubber/board/createstubs_db.py,sha256=_SuvM2PvxKdDmByTkiUzP2hpu34KTqMAWDelGT9qcV0,31075
6
+ stubber/board/createstubs_db_min.py,sha256=1VHZcuGYPhO3xysjJCGDSM3jbFn87pSZOLeVVYeaQQI,11850
7
+ stubber/board/createstubs_db_mpy.mpy,sha256=9GQDfLlJHPepAYibiDUTK0S92YJtHDrU-r_fel86bjs,9890
8
+ stubber/board/createstubs_lvgl.py,sha256=CTe7eq1ACRK_JJxavaqDD8znn29nSWJiHHTZ_ps6EhM,27217
9
+ stubber/board/createstubs_lvgl_min.py,sha256=jLkWYmeboI2A8feMC7pT7cYWttLejQTuX7WAEZCylhw,27207
10
+ stubber/board/createstubs_lvgl_mpy.mpy,sha256=ex-nlq2V5e8anQBJvRWEEc-FzU7nlwg5NSrZ8vOadIA,9267
11
+ stubber/board/createstubs_mem.py,sha256=liTGFKc35mxZgUa7NT2Usk6mJmgnIbwP52hnQgrW6ig,29411
12
+ stubber/board/createstubs_mem_min.py,sha256=4Lx-ssDzcMVit_GXLGGuSOIiDp0z08ihyqkE-mtZ9io,11396
13
+ stubber/board/createstubs_mem_mpy.mpy,sha256=vnS3xs7NTz76AWtgQgCLGFbhM-Txx2SaetcZMpCZfX8,9469
14
+ stubber/board/createstubs_min.py,sha256=co3dloHX2LnCuztTzmxHdwAJAgQAZqTPUM-L8dp7dl0,14138
15
+ stubber/board/createstubs_mpy.mpy,sha256=dEWIQfFG4hMo87u7JeWbBWglC__-Kv8goYklzIK7DWI,12805
16
+ stubber/board/fw_info.py,sha256=6AQbN3jtQgllqWQYl4e-63KeEtV08EXk8_JnM6XBkvo,4554
17
+ stubber/board/info.py,sha256=b7SOPZHVsVhaayKCwVkFZlYu0BW-UFI7LuG1Eop9480,5629
18
+ stubber/board/main.py,sha256=f6V3tdt6sPZVLuwemT-NLuK9GySfW2c2J6PJMOOWQQw,413
19
+ stubber/board/modulelist.txt,sha256=rZ6sn8CXjVYRKCcM0rlurfiIwsDuWhzSPOleAmoxCCI,2945
20
+ stubber/board/pyrightconfig.json,sha256=6oHS4aDOfwKBAFeUPsCGJzEXpUgBZsPaF0M4P-N26D4,1376
21
+ stubber/bulk/mcu_stubber.py,sha256=_DLUf0SlYZRIAPRsHInIbQYwTmWF9U9-nFfWQ9D3k3w,15731
22
+ stubber/codemod/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
23
+ stubber/codemod/_partials/__init__.py,sha256=LVJ-QkEKlc5IqOZ-bYrNXWRd9J5eolsTR_kRTyS9p6w,1430
24
+ stubber/codemod/_partials/db_main.py,sha256=ZKzxV0LOEyHu1zcsBr4xRf9i1a4Jyh808sdbmcmkrWE,4003
25
+ stubber/codemod/_partials/lvgl_main.py,sha256=9BAJP6P1R2SQVbNya2ujes35eATa56D_Ri2_PjeRBq0,1964
26
+ stubber/codemod/_partials/modules_reader.py,sha256=dJj-H0ncUWVtilSyohQ-dyiUZOjQObds_-llwy_LkYU,2046
27
+ stubber/codemod/add_comment.py,sha256=CZMjtKO9aarZo1E60QXo80CLJAH05z_ylK6Vvjvb0ls,1965
28
+ stubber/codemod/add_method.py,sha256=fZH-RGi_pzFpi3tF_0AMDbA9A94dlgXMrc3ItpY3Ylw,2609
29
+ stubber/codemod/board.py,sha256=dP24t9RO_klQZS7Yqiwt7Rh85B76s6GC2r4B7tVzEn0,11882
30
+ stubber/codemod/enrich.py,sha256=YB-tXo_UjeVboG2uPAG8d1g81STdhWL4NvCfZ6YPduk,12928
31
+ stubber/codemod/merge_docstub.py,sha256=4G5MwF1FhgJ2UR__vDtKo96uSNwvdy1q3OkYl78yuic,23352
32
+ stubber/codemod/modify_list.py,sha256=xrpFBKug273D9E02owUheZD418BvsIHIZCFj4YDjTxU,2118
33
+ stubber/codemod/utils.py,sha256=3hk7pwyS4KZxewrWLwbOrdA5ympbum-kfL0ZN-M7rlo,2459
34
+ stubber/codemod/visitors/type_helpers.py,sha256=UdYKsKDTqzHmPNBuWK1lY0sboXrm7RIY0B4FHLtWo3s,10572
35
+ stubber/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
36
+ stubber/commands/build_cmd.py,sha256=Zseci4EHxJuiiy7YS-ucmMokDrVLe4j6fPs-PSbwq1k,2813
37
+ stubber/commands/cli.py,sha256=HY4CqB0PPTmzew2sABNsHeNKDPblcGzzbmvtF46oVsU,1556
38
+ stubber/commands/clone_cmd.py,sha256=QyKnU3calhVx-rhlfzbeZbqgBFFTzfoYeKHNH9qmfgM,2781
39
+ stubber/commands/config_cmd.py,sha256=e8heX27MXfazLxMVtgjK4dsLCWhsoCfdeYGVoH3rqtA,1211
40
+ stubber/commands/enrich_folder_cmd.py,sha256=LDdSAfDlsAQAddYT9Rp3bFiF6maqA457AmMyWNXdXtg,2236
41
+ stubber/commands/get_core_cmd.py,sha256=Ua_10gdwOX9ceHY4SLV36esdTWbCwGtQ593A-qR_pgg,2323
42
+ stubber/commands/get_docstubs_cmd.py,sha256=OQAZn29pDmUDLbpOOyja0IGIxRCKAskY7UGcX90hAkQ,5179
43
+ stubber/commands/get_frozen_cmd.py,sha256=KgcOj-YjxChQcxCvEa-Rqq6_RW8RQteefAdYjoKEAZE,4251
44
+ stubber/commands/get_mcu_cmd.py,sha256=CTQVIoGqBx6gwUp1aH1gOysVFEZbeqMvpPb2WJA4EVQ,2807
45
+ stubber/commands/merge_cmd.py,sha256=0tKgvBiYjleXac0z5vDMxzvAgiZQUF0DafPqoIueKS8,1641
46
+ stubber/commands/publish_cmd.py,sha256=eo052T3k0YW6m0gJJ3hoZbchd0whMr74z3MudHKthIQ,3275
47
+ stubber/commands/stub_cmd.py,sha256=eqhZJ2cyt1-jPxSaywUP8Sn4hPbdCnMQp5TSnZji6gk,1216
48
+ stubber/commands/switch_cmd.py,sha256=yeK9rNkIl8WicheUGHnK5u7YrV5iR1KBEILVUfbOQtA,1866
49
+ stubber/commands/variants_cmd.py,sha256=Q7DjPElEfSHhDxAlvtiGHWv9e47QPSLYMIs0ScfI7AA,1296
50
+ stubber/data/board_info.csv,sha256=K2VSmfR013fN-oJWkQUmiQ19w09dVwJHDquPy6QmMhY,8627
51
+ stubber/data/board_info.json,sha256=jyvBN5seoxx7Z7B3UpvMn7H8xWCpmG4VtFSPb8PjmZI,58939
52
+ stubber/data/micropython_tags.csv,sha256=HQnzPN7jLmgKX3QvobsPMZa-xMb0exglriFziBjaRz8,1909
53
+ stubber/data/requirements-core-micropython.txt,sha256=6RQWWbLh8YVcD_l1-hjg6wX_Fm1LmNEwy5NExKJIkeg,1317
54
+ stubber/data/requirements-core-pycopy.txt,sha256=tW71l6FIuoQY1tuxkDgeN4Uw8IIp0YrlhhaaqSGSOA8,1051
55
+ stubber/downloader.py,sha256=L0ZgXv-0JfPgPpzDqP66q8Guu0QiN_vgWuB_t_lKmRA,1206
56
+ stubber/freeze/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
57
+ stubber/freeze/common.py,sha256=GA8DaEBsWLTNvVCWZMmtI9i9Ih5aVzK5DfNWMoCbFa4,3306
58
+ stubber/freeze/freeze_folder.py,sha256=49rSh6LHbVweDM6QCoe8Pku0gyEOzz7nOtaivyJ56LE,2490
59
+ stubber/freeze/freeze_manifest_2.py,sha256=BNjjw30WhdI8I_L3rBRRGyoCDCk8O3-MZcM0AScSZBI,4455
60
+ stubber/freeze/get_frozen.py,sha256=ojxUO-Fiy-Tn49Tv_puQrBtZ0dxQEmWj2HfWmHmGODQ,5355
61
+ stubber/get_cpython.py,sha256=Qnug4TlytwrqBRXCNGnRIMGW63zVcQL_8Ua93eTbrc8,3885
62
+ stubber/get_lobo.py,sha256=jyysWbeEwNuZZtkTudJP1QbyVvh-TwFom5cE7iCi9lE,1776
63
+ stubber/merge_config.py,sha256=NCHgpt67uR_yFaiXCtkvZIKqzold2aG7kYUzgvCg2xk,2855
64
+ stubber/minify.py,sha256=z-acX9CNvHbir-xquD-JpAmGfZnaFHJayPJu64-Rj2M,15096
65
+ stubber/modcat.py,sha256=tKB-8l56SuTWoIn8zEtnu5VuPf25ZIggB9x_qNYeiDI,3752
66
+ stubber/publish/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
67
+ stubber/publish/bump.py,sha256=qSb1DpaIxgyoH3YcPU1XKyDKgqkomxSm0WWf1sAVh0Y,3262
68
+ stubber/publish/candidates.py,sha256=w_OzjVU9euaWGf1lC3p5FuwpP1YDXjjGoczFE41QAik,10820
69
+ stubber/publish/database.py,sha256=8wCr19i_6x00spvHlfzlz5nRcfhTgEPeNUnHHRZ967Q,1851
70
+ stubber/publish/defaults.py,sha256=naAyHN_k8OFQfqRnXlPU3HNA0IZll-NA5GuJEvDEG_k,1532
71
+ stubber/publish/enums.py,sha256=Z_x798ArtxyjQIRRY43GDGNB9BD4uPfpeGsXYdj31w0,780
72
+ stubber/publish/helpers.py,sha256=909umfKUHBMBoVnAanop1vKx8loCrWntlfiiG6z89lY,716
73
+ stubber/publish/merge_docstubs.py,sha256=jlMQ3q6DqnLEJ_BvfgtXpTSlD6_XDpn697HG4fi3lRk,6513
74
+ stubber/publish/package.py,sha256=XbPRw5aTgS53ptPmSpGlEsiIGHKWloG2-cgN2PxSaw8,5374
75
+ stubber/publish/pathnames.py,sha256=vORgygaOJJAjlI3cLhNTHfowdewSDsv7zck5evPe1cY,1803
76
+ stubber/publish/publish.py,sha256=fG95ANcdZibwWW_ZoqjhPpolswb17IOi-gTIpNPwjKc,3989
77
+ stubber/publish/pypi.py,sha256=LdvwLfjkkSFBTI4MHyl7Ko_ZWn1SflWxJ9uo2mtPKtc,1272
78
+ stubber/publish/stubpackage.py,sha256=-0hJhOTBfSRc3k4-pUd2LHa_t7J5HwvWHMldubeUzo4,47596
79
+ stubber/rst/__init__.py,sha256=5VcbDCotIICa2xnJDs_gw2sFXpjjGOZZbwCrNKXy1OE,293
80
+ stubber/rst/classsort.py,sha256=-Uji6LzBbX6voKmiXSuexJXyoQ3fmSDQ7Fuz4j1Kk8E,2655
81
+ stubber/rst/lookup.py,sha256=8nnU8MZPMEUKhuZ_tbtV_eh6C7K4A1RN1wemsCodTtw,26003
82
+ stubber/rst/output_dict.py,sha256=cpBXRtUD-uh0EgjWIBiRrMLBmIAEXjoJFSOAg-qJQiU,14755
83
+ stubber/rst/reader.py,sha256=sNZwEpSG8esBrPvD-gVjtku828XfLNst-earA3XBN1c,35426
84
+ stubber/rst/report_return.py,sha256=p0JfJs_WTWTtRZREcQeqUgDW-_TP2VuuX7k7-c49y5E,3024
85
+ stubber/rst/rst_utils.py,sha256=-F6J09-WQBzI5419ItzOlm4gUKxF4BMru2OyXx-M6ko,18314
86
+ stubber/stubber.py,sha256=GxLfHIzDyfFvgiTqMj9DB3tq7I3EnEUNbdoCtYr8gHM,1640
87
+ stubber/stubs_from_docs.py,sha256=uxOCIWKxCAIfYpFBdIB0ZCghbJEJVgRGdW78deHAU54,3563
88
+ stubber/tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
89
+ stubber/tools/manifestfile.py,sha256=YzPMc7PNciLOBpoc4xgUZ38t88C1C8b4fjG0qfWd6K8,25749
90
+ stubber/tools/readme.md,sha256=uI0higcFUtjSLKobn7NK2LoqZ0BqcbftXSDgNjbsnzo,284
91
+ stubber/typing_collector.py,sha256=YyNgxqgbWC_KQVO7ixUf_3XTFz6OhriboHK1RVX8_eY,9180
92
+ stubber/update_fallback.py,sha256=mFxFvcLWl-5IX9BdRuo_WMa538Wtomo2sE14jKbW7-0,4913
93
+ stubber/update_module_list.py,sha256=OEAOnFxB8Ywakw0pxiiTrIplWmoJ9r3Cdn07EpVDmNY,4038
94
+ stubber/utils/__init__.py,sha256=73LiuTInDABhDhnDixU8ojlkVUjR5e3Uv8QNaeBMG0E,234
95
+ stubber/utils/config.py,sha256=wPmSSut9PWjLFzr_8jj7IwkrVsL4mq17X8DGOeRqXGw,5544
96
+ stubber/utils/makeversionhdr.py,sha256=dO8sWLAY_ifT1IJJ1-JJ2z_thvfqJnK3c1_bHF_UI28,1953
97
+ stubber/utils/manifest.py,sha256=KEeFwVCke2XlUv8-g9S10DaoHzISZDxZn0G4LrHn2vA,3239
98
+ stubber/utils/post.py,sha256=lHGPO_q-ZQgx03P0vEwZDVr0pCNt5-gY-DXW62DBeQM,2926
99
+ stubber/utils/repos.py,sha256=piUZwtHBXXJ-XPhvw_qXYqO-fy1ktZsb9-7CAwNo2YQ,5896
100
+ stubber/utils/stubmaker.py,sha256=pO8Bo9JuHo6eeJGJz4hO2PzVJojNYFdJPdVtlgjKkBI,5236
101
+ stubber/utils/typed_config_toml.py,sha256=ZR7eo-whyL4nhFXj6xs7E121sLuE-ivlUDevII4K2xg,2653
102
+ stubber/variants.py,sha256=NnwUP-aiGUPAn15BeRRFcBWQUOzAFFnN2oL4u9zio-s,3792
103
+ micropython_stubber-1.24.4.dist-info/entry_points.txt,sha256=JoR8NWh8t6pbDyn0WOMCIfRfDQAOGxqbOgJWuxv3Cxw,116
104
+ micropython_stubber-1.24.4.dist-info/LICENSE,sha256=Fx9qrL45ayRXgH6QzttboqZEjKXms0w1t_b_nkOqYCU,1572
105
+ micropython_stubber-1.24.4.dist-info/METADATA,sha256=hW8u3xr5kRDcjoTsF9lZa5fw28XnI3LeHg1PKBbl47Q,19979
106
+ micropython_stubber-1.24.4.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
107
+ micropython_stubber-1.24.4.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: poetry-core 2.0.1
2
+ Generator: poetry-core 2.1.1
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
stubber/__init__.py CHANGED
@@ -1,3 +1,3 @@
1
1
  """get the version"""
2
2
 
3
- __version__ = "1.24.0"
3
+ __version__ = "1.24.3"
@@ -25,7 +25,8 @@ except ImportError:
25
25
  from ucollections import OrderedDict # type: ignore
26
26
 
27
27
  __version__ = "v1.24.0"
28
- ENOENT = 2
28
+ ENOENT = 2 # on most ports
29
+ ENOMESSAGE = 44 # on pyscript
29
30
  _MAX_CLASS_LEVEL = 2 # Max class nesting
30
31
  LIBS = ["lib", "/lib", "/sd/lib", "/flash/lib", "."]
31
32
 
@@ -72,7 +73,7 @@ logging.basicConfig(level=logging.INFO)
72
73
  class Stubber:
73
74
  "Generate stubs for modules in firmware"
74
75
 
75
- def __init__(self, path: str = None, firmware_id: str = None): # type: ignore
76
+ def __init__(self, path: str = "", firmware_id: str = ""): # type: ignore
76
77
  try:
77
78
  if os.uname().release == "1.13.0" and os.uname().version < "v1.13-103": # type: ignore
78
79
  raise NotImplementedError("MicroPython 1.13.0 cannot be stubbed")
@@ -240,7 +241,7 @@ class Stubber:
240
241
  )
241
242
  fp.write(s)
242
243
  fp.write(
243
- "from __future__ import annotations\nfrom typing import Any, Generator\nfrom _typeshed import Incomplete\n\n"
244
+ "from __future__ import annotations\nfrom typing import Any, Final, Generator\nfrom _typeshed import Incomplete\n\n"
244
245
  )
245
246
  self.write_object_stub(fp, new_module, module_name, "")
246
247
 
@@ -366,14 +367,18 @@ class Stubber:
366
367
  s = "{0}{1}: {3} = {2}\n".format(indent, item_name, ev[t], t)
367
368
  else:
368
369
  # something else
369
- if t in ("object", "set", "frozenset", "Pin", "generator"): # "FileIO"
370
+ if t in ("object", "set", "frozenset", "Pin"): # "FileIO"
370
371
  # https://docs.python.org/3/tutorial/classes.html#item_instance-objects
371
372
  # use these types for the attribute
372
- if t == "generator":
373
- t = "Generator"
374
373
  s = "{0}{1}: {2} ## = {4}\n".format(
375
374
  indent, item_name, t, item_type_txt, item_repr
376
375
  )
376
+ elif t == "generator":
377
+ # either a normal or async Generator function
378
+ t = "Generator"
379
+ s = "{0}def {1}(*args, **kwargs) -> Generator: ## = {4}\n{0} ...\n\n".format(
380
+ indent, item_name, t, item_type_txt, item_repr
381
+ )
377
382
  else:
378
383
  # Requires Python 3.6 syntax, which is OK for the stubs/pyi
379
384
  t = "Incomplete"
@@ -410,9 +415,9 @@ class Stubber:
410
415
  s = s.replace(c, "_")
411
416
  return s
412
417
 
413
- def clean(self, path: str = None): # type: ignore
418
+ def clean(self, path: str = ""): # type: ignore
414
419
  "Remove all files from the stub folder"
415
- if path is None:
420
+ if not path:
416
421
  path = self.path
417
422
  log.info("Clean/remove files in folder: {}".format(path))
418
423
  try:
@@ -495,7 +500,7 @@ def ensure_folder(path: str):
495
500
  _ = os.stat(p)
496
501
  except OSError as e:
497
502
  # folder does not exist
498
- if e.args[0] == ENOENT:
503
+ if e.args[0] in [ENOENT, ENOMESSAGE] :
499
504
  try:
500
505
  log.debug("Create folder {}".format(p))
501
506
  os.mkdir(p)
@@ -506,6 +511,7 @@ def ensure_folder(path: str):
506
511
  start = i + 1
507
512
 
508
513
 
514
+
509
515
  def _build(s):
510
516
  # extract build from sys.version or os.uname().version if available
511
517
  # sys.version: 'MicroPython v1.24.0-preview.6.g3d0b6276f'
@@ -727,11 +733,11 @@ def is_micropython() -> bool:
727
733
 
728
734
  # b) https://docs.micropython.org/en/latest/genrst/builtin_types.html#bytes-with-keywords-not-implemented
729
735
  # Micropython: NotImplementedError
730
- b = bytes("abc", encoding="utf8") # type: ignore # lgtm [py/unused-local-variable]
736
+ b = bytes("abc", encoding="utf8") # type: ignore
731
737
 
732
738
  # c) https://docs.micropython.org/en/latest/genrst/core_language.html#function-objects-do-not-have-the-module-attribute
733
739
  # Micropython: AttributeError
734
- c = is_micropython.__module__ # type: ignore # lgtm [py/unused-local-variable]
740
+ c = is_micropython.__module__ # type: ignore
735
741
  return False
736
742
  except (NotImplementedError, AttributeError):
737
743
  return True
@@ -749,36 +755,14 @@ def main():
749
755
  # modules to stub : 131
750
756
  stubber.modules = [
751
757
  "WM8960",
752
- "_OTA",
753
758
  "_asyncio",
754
759
  "_boot_fat",
755
- "_coap",
756
760
  "_espnow",
757
- "_flash_control_OTA",
758
- "_main_pybytes",
759
- "_mqtt",
760
- "_mqtt_core",
761
- "_msg_handl",
762
761
  "_onewire",
763
- "_periodical_pin",
764
- "_pybytes",
765
- "_pybytes_ca",
766
- "_pybytes_config",
767
- "_pybytes_config_reader",
768
- "_pybytes_connection",
769
- "_pybytes_constants",
770
- "_pybytes_debug",
771
- "_pybytes_library",
772
- "_pybytes_machine_learning",
773
- "_pybytes_main",
774
- "_pybytes_protocol",
775
- "_pybytes_pyconfig",
776
- "_pybytes_pymesh_config",
777
762
  "_rp2",
778
- "_terminal",
779
763
  "_thread",
780
764
  "_uasyncio",
781
- "_urequest",
765
+ "abc",
782
766
  "adcfft",
783
767
  "aioble/__init__",
784
768
  "aioble/central",
@@ -801,6 +785,7 @@ def main():
801
785
  "asyncio/funcs",
802
786
  "asyncio/lock",
803
787
  "asyncio/stream",
788
+ "base64",
804
789
  "binascii",
805
790
  "bluetooth",
806
791
  "breakout_as7262",
@@ -830,9 +815,13 @@ def main():
830
815
  "cc3200",
831
816
  "cmath",
832
817
  "collections",
818
+ "collections/__init__",
819
+ "collections/defaultdict",
820
+ "copy",
833
821
  "crypto",
834
822
  "cryptolib",
835
823
  "curl",
824
+ "datetime",
836
825
  "deflate",
837
826
  "dht",
838
827
  "display",
@@ -848,6 +837,7 @@ def main():
848
837
  "espnow",
849
838
  "ffi",
850
839
  "flashbdev",
840
+ "fnmatch",
851
841
  "framebuf",
852
842
  "freesans20",
853
843
  "fs_driver",
@@ -856,20 +846,26 @@ def main():
856
846
  "gc",
857
847
  "gfx_pack",
858
848
  "gsm",
849
+ "gzip",
859
850
  "hashlib",
860
851
  "heapq",
852
+ "hmac",
853
+ "html/__init__",
861
854
  "hub75",
862
855
  "ili9341",
863
856
  "ili9XXX",
864
857
  "imagetools",
865
858
  "inisetup",
859
+ "inspect",
866
860
  "interstate75",
867
861
  "io",
862
+ "itertools",
868
863
  "jpegdec",
869
864
  "js",
870
865
  "jsffi",
871
866
  "json",
872
867
  "lcd160cr",
868
+ "locale",
873
869
  "lodepng",
874
870
  "logging",
875
871
  "lsm6dsox",
@@ -897,7 +893,11 @@ def main():
897
893
  "ntptime",
898
894
  "onewire",
899
895
  "openamp",
896
+ "operator",
900
897
  "os",
898
+ "os/__init__",
899
+ "os/path",
900
+ "pathlib",
901
901
  "pcf85063a",
902
902
  "pic16bit",
903
903
  "picoexplorer",
@@ -913,11 +913,12 @@ def main():
913
913
  "platform",
914
914
  "powerpc",
915
915
  "pyb",
916
- "pycom",
917
916
  "pye",
917
+ "pyscript",
918
+ "pyscript/__init__",
919
+ "pyscript/fs",
918
920
  "qemu",
919
921
  "qrcode",
920
- "queue",
921
922
  "random",
922
923
  "renesas",
923
924
  "renesas-ra",
@@ -932,14 +933,19 @@ def main():
932
933
  "ssd1306",
933
934
  "ssh",
934
935
  "ssl",
936
+ "stat",
935
937
  "stm",
936
938
  "stm32",
939
+ "string",
937
940
  "struct",
938
941
  "sys",
942
+ "tarfile/__init__",
943
+ "tarfile/write",
939
944
  "termios",
940
945
  "time",
941
946
  "tls",
942
947
  "tpcalib",
948
+ "types",
943
949
  "uarray",
944
950
  "uasyncio/__init__",
945
951
  "uasyncio/core",
@@ -951,7 +957,6 @@ def main():
951
957
  "ubinascii",
952
958
  "ubluetooth",
953
959
  "ucollections",
954
- "ucrypto",
955
960
  "ucryptolib",
956
961
  "uctypes",
957
962
  "uerrno",
@@ -974,10 +979,10 @@ def main():
974
979
  "umqtt/__init__",
975
980
  "umqtt/robust",
976
981
  "umqtt/simple",
982
+ "unittest/__init__",
977
983
  "unix",
978
984
  "uos",
979
985
  "uplatform",
980
- "uqueue",
981
986
  "urandom",
982
987
  "ure",
983
988
  "urequests",
@@ -996,6 +1001,7 @@ def main():
996
1001
  "utelnetserver",
997
1002
  "utime",
998
1003
  "utimeq",
1004
+ "uu",
999
1005
  "uwebsocket",
1000
1006
  "uzlib",
1001
1007
  "version",
@@ -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.24.0
21
+ This variant was generated from createstubs.py by micropython-stubber v1.24.3
22
22
  """
23
23
 
24
24
  # Copyright (c) 2019-2024 Jos Verlinde
@@ -44,7 +44,8 @@ except ImportError:
44
44
  from ucollections import OrderedDict # type: ignore
45
45
 
46
46
  __version__ = "v1.24.0"
47
- ENOENT = 2
47
+ ENOENT = 2 # on most ports
48
+ ENOMESSAGE = 44 # on pyscript
48
49
  _MAX_CLASS_LEVEL = 2 # Max class nesting
49
50
  LIBS = ["lib", "/lib", "/sd/lib", "/flash/lib", "."]
50
51
 
@@ -91,7 +92,7 @@ logging.basicConfig(level=logging.INFO)
91
92
  class Stubber:
92
93
  "Generate stubs for modules in firmware"
93
94
 
94
- def __init__(self, path: str = None, firmware_id: str = None): # type: ignore
95
+ def __init__(self, path: str = "", firmware_id: str = ""): # type: ignore
95
96
  try:
96
97
  if os.uname().release == "1.13.0" and os.uname().version < "v1.13-103": # type: ignore
97
98
  raise NotImplementedError("MicroPython 1.13.0 cannot be stubbed")
@@ -250,7 +251,7 @@ class Stubber:
250
251
  info_ = str(self.info).replace("OrderedDict(", "").replace("})", "}")
251
252
  s = '"""\nModule: \'{0}\' on {1}\n"""\n# MCU: {2}\n# Stubber: {3}\n'.format(module_name, self._fwid, info_, __version__)
252
253
  fp.write(s)
253
- fp.write("from __future__ import annotations\nfrom typing import Any, Generator\nfrom _typeshed import Incomplete\n\n")
254
+ fp.write("from __future__ import annotations\nfrom typing import Any, Final, Generator\nfrom _typeshed import Incomplete\n\n")
254
255
  self.write_object_stub(fp, new_module, module_name, "")
255
256
 
256
257
  self.report_add(module_name, file_name)
@@ -369,12 +370,16 @@ class Stubber:
369
370
  s = "{0}{1}: {3} = {2}\n".format(indent, item_name, ev[t], t)
370
371
  else:
371
372
  # something else
372
- if t in ("object", "set", "frozenset", "Pin", "generator"): # "FileIO"
373
+ if t in ("object", "set", "frozenset", "Pin"): # "FileIO"
373
374
  # https://docs.python.org/3/tutorial/classes.html#item_instance-objects
374
375
  # use these types for the attribute
375
- if t == "generator":
376
- t = "Generator"
377
376
  s = "{0}{1}: {2} ## = {4}\n".format(indent, item_name, t, item_type_txt, item_repr)
377
+ elif t == "generator":
378
+ # either a normal or async Generator function
379
+ t = "Generator"
380
+ s = "{0}def {1}(*args, **kwargs) -> Generator: ## = {4}\n{0} ...\n\n".format(
381
+ indent, item_name, t, item_type_txt, item_repr
382
+ )
378
383
  else:
379
384
  # Requires Python 3.6 syntax, which is OK for the stubs/pyi
380
385
  t = "Incomplete"
@@ -409,9 +414,9 @@ class Stubber:
409
414
  s = s.replace(c, "_")
410
415
  return s
411
416
 
412
- def clean(self, path: str = None): # type: ignore
417
+ def clean(self, path: str = ""): # type: ignore
413
418
  "Remove all files from the stub folder"
414
- if path is None:
419
+ if not path:
415
420
  path = self.path
416
421
  log.info("Clean/remove files in folder: {}".format(path))
417
422
  try:
@@ -492,7 +497,7 @@ def ensure_folder(path: str):
492
497
  _ = os.stat(p)
493
498
  except OSError as e:
494
499
  # folder does not exist
495
- if e.args[0] == ENOENT:
500
+ if e.args[0] in [ENOENT, ENOMESSAGE]:
496
501
  try:
497
502
  log.debug("Create folder {}".format(p))
498
503
  os.mkdir(p)
@@ -721,11 +726,11 @@ def is_micropython() -> bool:
721
726
 
722
727
  # b) https://docs.micropython.org/en/latest/genrst/builtin_types.html#bytes-with-keywords-not-implemented
723
728
  # Micropython: NotImplementedError
724
- b = bytes("abc", encoding="utf8") # type: ignore # lgtm [py/unused-local-variable]
729
+ b = bytes("abc", encoding="utf8") # type: ignore
725
730
 
726
731
  # c) https://docs.micropython.org/en/latest/genrst/core_language.html#function-objects-do-not-have-the-module-attribute
727
732
  # Micropython: AttributeError
728
- c = is_micropython.__module__ # type: ignore # lgtm [py/unused-local-variable]
733
+ c = is_micropython.__module__ # type: ignore
729
734
  return False
730
735
  except (NotImplementedError, AttributeError):
731
736
  return True