micropython-stubber 1.13.7__py3-none-any.whl → 1.13.8__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {micropython_stubber-1.13.7.dist-info → micropython_stubber-1.13.8.dist-info}/METADATA +1 -1
- {micropython_stubber-1.13.7.dist-info → micropython_stubber-1.13.8.dist-info}/RECORD +31 -31
- stubber/__init__.py +3 -2
- stubber/basicgit.py +10 -7
- stubber/board/createstubs.py +4 -3
- stubber/board/createstubs_db.py +5 -4
- stubber/board/createstubs_db_min.py +33 -33
- stubber/board/createstubs_db_mpy.mpy +0 -0
- stubber/board/createstubs_info.py +906 -0
- stubber/board/createstubs_lvgl.py +5 -4
- stubber/board/createstubs_lvgl_min.py +41 -41
- stubber/board/createstubs_lvgl_mpy.mpy +0 -0
- stubber/board/createstubs_mem.py +5 -4
- stubber/board/createstubs_mem_min.py +48 -48
- stubber/board/createstubs_mem_mpy.mpy +0 -0
- stubber/board/createstubs_min.py +41 -41
- stubber/board/createstubs_mpy.mpy +0 -0
- stubber/codemod/board.py +1 -1
- stubber/commands/cli.py +1 -1
- stubber/commands/switch_cmd.py +8 -1
- stubber/data/micropython_tags.csv +1 -1
- stubber/get_cpython.py +3 -1
- stubber/publish/enums.py +8 -0
- stubber/publish/publish.py +5 -3
- stubber/publish/stubpacker.py +7 -7
- stubber/rst/lookup.py +1 -1
- stubber/utils/manifest.py +1 -1
- stubber/utils/repos.py +22 -9
- stubber/utils/my_version.py +0 -15
- {micropython_stubber-1.13.7.dist-info → micropython_stubber-1.13.8.dist-info}/LICENSE +0 -0
- {micropython_stubber-1.13.7.dist-info → micropython_stubber-1.13.8.dist-info}/WHEEL +0 -0
- {micropython_stubber-1.13.7.dist-info → micropython_stubber-1.13.8.dist-info}/entry_points.txt +0 -0
@@ -1,19 +1,20 @@
|
|
1
|
-
stubber/__init__.py,sha256=
|
2
|
-
stubber/basicgit.py,sha256=
|
1
|
+
stubber/__init__.py,sha256=JRCdynXL1MbEpAqT_xiySSNiLzCJmJWh1LtNpWfeNsU,51
|
2
|
+
stubber/basicgit.py,sha256=uyfC_ZqfG5z8tIyBJV_8fZR8SWeuzx3X-p5juGHaGA4,9378
|
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=
|
6
|
-
stubber/board/createstubs_db.py,sha256=
|
7
|
-
stubber/board/createstubs_db_min.py,sha256=
|
8
|
-
stubber/board/createstubs_db_mpy.mpy,sha256
|
9
|
-
stubber/board/
|
10
|
-
stubber/board/
|
11
|
-
stubber/board/
|
12
|
-
stubber/board/
|
13
|
-
stubber/board/
|
14
|
-
stubber/board/
|
15
|
-
stubber/board/
|
16
|
-
stubber/board/
|
5
|
+
stubber/board/createstubs.py,sha256=N5M7DifXHOE45ILJUUeC5-YubrFMxvqh8Wpyfrf8USg,29835
|
6
|
+
stubber/board/createstubs_db.py,sha256=1HziaTETEKXYgbctkAkBgp_rVzAf-QUPg_JupSOOmQA,28153
|
7
|
+
stubber/board/createstubs_db_min.py,sha256=px3Y0dRgutpnT7febH6vfAmurVB6Zcp25wHu4LqmEhg,10215
|
8
|
+
stubber/board/createstubs_db_mpy.mpy,sha256=-1_7dJ1eCLsBk52pkVlvKt---zqbWqU0RtjYL0bSfts,8319
|
9
|
+
stubber/board/createstubs_info.py,sha256=tn2ChcwDtWtJqPiRN6-mCcLrGqp6nlt9O14lkLoAGAA,30393
|
10
|
+
stubber/board/createstubs_lvgl.py,sha256=jYYBQBTCcLEgDvLRLxRXZQx46cysH7kTd-8W9Qlqmkc,25362
|
11
|
+
stubber/board/createstubs_lvgl_min.py,sha256=HHvNN0IBa3_ldksVcyEe44iYlReU3e2N8X5E4j4y-d0,9570
|
12
|
+
stubber/board/createstubs_lvgl_mpy.mpy,sha256=W79bWuFOSg5OtgfIzI2pI6bNxiCSRqMq15m9yXX2lWY,7867
|
13
|
+
stubber/board/createstubs_mem.py,sha256=l79yKQfiR3QZZVT8cKFjYeWYfwDwV3zQGB_U3QPEwZo,26021
|
14
|
+
stubber/board/createstubs_mem_min.py,sha256=NZoh4ZIzuanUt4Uo11a7PfPDOE9J2Z8hgKjvurDOkGE,9591
|
15
|
+
stubber/board/createstubs_mem_mpy.mpy,sha256=Py7SIsmLTZwr7us3-rdquFS0j9H82hmUMeNj0HXWMm8,7815
|
16
|
+
stubber/board/createstubs_min.py,sha256=KThoeEf-ZnNEI5q58WDVqgcfrci5v2mLxHltrwx7VLI,11942
|
17
|
+
stubber/board/createstubs_mpy.mpy,sha256=L0tZA1WZTA0p9pAz695AnB8hzRmChO67LK1-3x-l74c,10636
|
17
18
|
stubber/board/logging.py,sha256=rdneoAwZg84uiWBJWYIp0gMcT2oU9Lu-1WIu1LqT_9w,2218
|
18
19
|
stubber/board/main.py,sha256=f6V3tdt6sPZVLuwemT-NLuK9GySfW2c2J6PJMOOWQQw,413
|
19
20
|
stubber/board/modulelist.txt,sha256=kCeBci5poDcvORUzTadOoYkcMgTiZIxB-dDNNyuWYIw,2564
|
@@ -25,14 +26,14 @@ stubber/codemod/_partials/lvgl_main.py,sha256=eAZt-nRNg7fxLmqFpt5SDd_IDtcbAY9Xz7
|
|
25
26
|
stubber/codemod/_partials/modules_reader.py,sha256=O52VDtuJcrCfU8pTp0IY_HvC2piOWXNh23sck9F_Fak,1644
|
26
27
|
stubber/codemod/add_comment.py,sha256=CZMjtKO9aarZo1E60QXo80CLJAH05z_ylK6Vvjvb0ls,1965
|
27
28
|
stubber/codemod/add_method.py,sha256=QXy3mCjCWKI2TNIwi-kSl35dCus7uiXDf_Q869ELBDQ,2607
|
28
|
-
stubber/codemod/board.py,sha256=
|
29
|
+
stubber/codemod/board.py,sha256=ldtkBa9vhnh-P1y8uIv1I_uu8PXNQp5xd8Dmx023WlQ,11790
|
29
30
|
stubber/codemod/enrich.py,sha256=IMKSikIdc2z5Ro_e648hW1p7VctPhMHY2Mhgz13hSRw,4433
|
30
31
|
stubber/codemod/merge_docstub.py,sha256=NuojRB73Ase3_Mp4aolYX2CvXHGexVi1wup21S4x0TY,7740
|
31
32
|
stubber/codemod/modify_list.py,sha256=-nd2L_uNsxbJ_yCmvcy8OMyHmBQEdikBL-t2cZ8dNt0,2105
|
32
33
|
stubber/codemod/utils.py,sha256=itARwbMps9UlzMaf4F3wJLJXJvtD-HYq1T1xw96zmR8,2459
|
33
34
|
stubber/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
34
35
|
stubber/commands/build_cmd.py,sha256=AV92d3xXHltozxf6NkWt81VOCLMaqh8n4IF54k86t48,2194
|
35
|
-
stubber/commands/cli.py,sha256=
|
36
|
+
stubber/commands/cli.py,sha256=pHtViupghgqKMxbyk5_Zz-qHx6i-BGdnTqRO-kngH2E,1850
|
36
37
|
stubber/commands/clone_cmd.py,sha256=Yutrkmt0FYF5XY2XFIbA7iUkFkT6FypDSLby790PMn0,2646
|
37
38
|
stubber/commands/config_cmd.py,sha256=Rmus8FoWtq9_3r6PC2r1rxuY54tar8-MeLiR_kUPkc0,920
|
38
39
|
stubber/commands/enrich_folder_cmd.py,sha256=Xlwkzdc9AOI3e29BSgrfQWO3tx4GKpDa7fofkRXTScI,1522
|
@@ -44,13 +45,13 @@ stubber/commands/merge_cmd.py,sha256=9rpc64depPxirvR4MYh8WNp6OuemD444olYdrDAu-OI
|
|
44
45
|
stubber/commands/minify_cmd.py,sha256=PFFTezbPaXZ9vugQJ-s3zzbIuVm-PpFqDAPriKVTKgw,2272
|
45
46
|
stubber/commands/publish_cmd.py,sha256=Vlt0B_sPCUaCx5J4KscGCgyCnQw7HfPWjijm03zXOmg,2714
|
46
47
|
stubber/commands/stub_cmd.py,sha256=MZWyQ2wVoQrjGTp7EwN1Kt_YeVkDUgo4ID-ckPWJbjw,1161
|
47
|
-
stubber/commands/switch_cmd.py,sha256=
|
48
|
+
stubber/commands/switch_cmd.py,sha256=QsOgIzY8XOjmYTBtTdh7gC7wFeSBFO7vPL4N7AxTr_0,1678
|
48
49
|
stubber/commands/upd_fallback_cmd.py,sha256=5d6lIFa1mTo-2O-gDZKwHOZAo5bvX5mp4iaTIfBSaQc,1056
|
49
50
|
stubber/commands/upd_module_list_cmd.py,sha256=zok5tsiDXnwVIcK4jEpfaKfnv4iERDBFdsCTCJOHoC0,471
|
50
51
|
stubber/commands/variants_cmd.py,sha256=xCnR6vMQ-Q1zETn82reOhUQMQotXWt9y5dRBR7ewE2U,1313
|
51
52
|
stubber/cst_transformer.py,sha256=57ILkYBYWKQmq9Iz2VuP5_L4oksC9ofQVV4Gw-3veqU,6367
|
52
53
|
stubber/data/board_info.json,sha256=PWGBw5qo1vCR6OA5ebdOZ7LgDC5Mm2LVux90IVq6Kz8,46308
|
53
|
-
stubber/data/micropython_tags.csv,sha256=
|
54
|
+
stubber/data/micropython_tags.csv,sha256=HQnzPN7jLmgKX3QvobsPMZa-xMb0exglriFziBjaRz8,1909
|
54
55
|
stubber/data/requirements-core-micropython.txt,sha256=6RQWWbLh8YVcD_l1-hjg6wX_Fm1LmNEwy5NExKJIkeg,1317
|
55
56
|
stubber/data/requirements-core-pycopy.txt,sha256=tW71l6FIuoQY1tuxkDgeN4Uw8IIp0YrlhhaaqSGSOA8,1051
|
56
57
|
stubber/downloader.py,sha256=UbrvPg8xaX5xcdAaFUe2pdDBor5clyTl3yzh7r7FLdc,1206
|
@@ -59,23 +60,23 @@ stubber/freeze/common.py,sha256=QKVZIzOG07VFroXCaSkCuuuuf8jzzsfEgR2xhhzsBAU,2638
|
|
59
60
|
stubber/freeze/freeze_folder.py,sha256=aj7VflacbWK8n7-qyTsYIcTJ07afKj18pf1A0ENPRFs,2465
|
60
61
|
stubber/freeze/freeze_manifest_2.py,sha256=Vdrs2A5vvDDZ4WamcHG9sleKqNYGwIJ5yNQXpPlTb7E,4020
|
61
62
|
stubber/freeze/get_frozen.py,sha256=5sU70m9HiTkbLCvTQMKDa13NLywijqThw6BuF3A71FE,4937
|
62
|
-
stubber/get_cpython.py,sha256=
|
63
|
+
stubber/get_cpython.py,sha256=YYpVLNUZ9LN0qPcfc7KwYAM8wNJ1iy4u7HYRYwwfrA8,3777
|
63
64
|
stubber/get_lobo.py,sha256=M-6rF_DxbM4uHYWvvEPUG-ECcmKsEuHDVTjPTuGJcP0,1773
|
64
65
|
stubber/minify.py,sha256=hFwbJFu0tPTnCcTYd-xpZBzTzNqH-mPQOYdCPpYJ17E,12795
|
65
66
|
stubber/publish/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
66
67
|
stubber/publish/bump.py,sha256=k69CID3nURPckyepABG-5u3U_VMiYADqZ2Oxl8x_zC0,3271
|
67
68
|
stubber/publish/candidates.py,sha256=jDKo4DENfmT0HomvbLqXmGyqoaOHbtK9VQYKoXYMAbc,10644
|
68
69
|
stubber/publish/database.py,sha256=CLy5oiLasA-YzTTXi9d01qLAyk7NpugCDUOa5R9Ac2g,623
|
69
|
-
stubber/publish/enums.py,sha256=
|
70
|
+
stubber/publish/enums.py,sha256=YI_0q3Iz3v1YqDuHgbuj7x6FBS5y5w3G1UdgpCGunNs,954
|
70
71
|
stubber/publish/merge_docstubs.py,sha256=XKRLJ7vywibLH9RTRv-bZaQr-tWHikR1nQiwmoBlRwQ,6688
|
71
72
|
stubber/publish/missing_class_methods.py,sha256=8i4Znit5vOaGjuXlFn_BYBIEt7G45i0l0gbj1hWKgb8,1771
|
72
73
|
stubber/publish/package.py,sha256=ihhJrS2eqparkv1DfosSTivPqWoGlKKKOFnI8A5tbCg,6026
|
73
|
-
stubber/publish/publish.py,sha256=
|
74
|
+
stubber/publish/publish.py,sha256=El9MyWuzxmODmXN7Md78F1ZIIhzPOxF0_HkRZQU7VMk,3384
|
74
75
|
stubber/publish/pypi.py,sha256=Mu1F7Xx4e0NPWK1_Erck6QGEfdY8w67EBeWFi6JiAzk,1240
|
75
|
-
stubber/publish/stubpacker.py,sha256=
|
76
|
+
stubber/publish/stubpacker.py,sha256=M93vEgeAYfY3zd00-8u3YFb2wNizfboj0bo0GrXAI3c,33492
|
76
77
|
stubber/rst/__init__.py,sha256=5VcbDCotIICa2xnJDs_gw2sFXpjjGOZZbwCrNKXy1OE,293
|
77
78
|
stubber/rst/classsort.py,sha256=YCmF4QEYXqZ1Yu2FZb1iPQBrVkq-mrZaBaRcSUlC7ZE,2655
|
78
|
-
stubber/rst/lookup.py,sha256=
|
79
|
+
stubber/rst/lookup.py,sha256=Lh7NpnY78ZqmAnK40RJ83jmpvpgu_RBSmB4SnHPAKv8,15325
|
79
80
|
stubber/rst/output_dict.py,sha256=qGR8MaRlHN-7Ux81gEOsgJNiL5CgBc3ZeG6wiTvUHuU,11604
|
80
81
|
stubber/rst/reader.py,sha256=KtNiYW9vEvuW-6UasbhwkYbncXqmPcwLPccFE-lXzhQ,29967
|
81
82
|
stubber/rst/report_return.py,sha256=WZJSbgjsjxFeCeY-vLms56gv_x3TubaGXGQ8--d8RqI,2814
|
@@ -90,16 +91,15 @@ stubber/update_module_list.py,sha256=p3SP5LbaN-283PmSeqF9swalYxL_c0X9bETd52gZtqA
|
|
90
91
|
stubber/utils/__init__.py,sha256=tAmo9fjxIkMsmH4ZkgNB05zODEO_WjHDLXZFKk3SS3U,205
|
91
92
|
stubber/utils/config.py,sha256=pz5H_z8e5mifwnBkeV5Ep4alAX9E5nRLlTv29t4uK-Q,4554
|
92
93
|
stubber/utils/makeversionhdr.py,sha256=ZRpClirIzNK4saZHPaDuEpXhBRI_Ow_yZOxeNM3D_Ro,1908
|
93
|
-
stubber/utils/manifest.py,sha256=
|
94
|
-
stubber/utils/my_version.py,sha256=hotMzq8ISOGjqbAQXQRiS_uqVOXtasGHA0jxO0knJfk,393
|
94
|
+
stubber/utils/manifest.py,sha256=XBYCkxtYVAdUcch1784eHPAXlXfyfjco4WnRXxBHZYA,3273
|
95
95
|
stubber/utils/post.py,sha256=Uq9HZn6hNZUABpQs7a7PM3zz0ncwzDJTqKbFKsywsDY,2662
|
96
|
-
stubber/utils/repos.py,sha256=
|
96
|
+
stubber/utils/repos.py,sha256=aOulXGGoxwTjhfYdBN-nvSpERDPEU-AJ7pNfzgNSeAQ,5200
|
97
97
|
stubber/utils/stubmaker.py,sha256=jX4DvPzgv3wWNnUVaXjpTitRNZZ9QbcvmnDsI0lshGc,4355
|
98
98
|
stubber/utils/typed_config_toml.py,sha256=ikifCIZGNhS_uqsfp6IwIpxdtZqbLtywprjWG_Q0y8o,2629
|
99
99
|
stubber/utils/versions.py,sha256=iEWmYksKgiM2x0JN41y_tbO8jg-VWJpAqsSS50GvCMA,1856
|
100
100
|
stubber/variants.py,sha256=7iWqIGLc0LCzozh96NQcxg9f8vhlV7exWXhsG2MpeuA,3602
|
101
|
-
micropython_stubber-1.13.
|
102
|
-
micropython_stubber-1.13.
|
103
|
-
micropython_stubber-1.13.
|
104
|
-
micropython_stubber-1.13.
|
105
|
-
micropython_stubber-1.13.
|
101
|
+
micropython_stubber-1.13.8.dist-info/entry_points.txt,sha256=NQi_M36fgq5k6giSuASas3LrpF6CVdkzfvJC0ja73_g,55
|
102
|
+
micropython_stubber-1.13.8.dist-info/LICENSE,sha256=2zsOXlYgl9W7_XGXcncAXIYfvSVlyNcVBycC6hhlKhA,1542
|
103
|
+
micropython_stubber-1.13.8.dist-info/METADATA,sha256=cXV4oFvXXWI1lF-CLb9c5eoIiiP3mhZUaERz1Hx26r4,16589
|
104
|
+
micropython_stubber-1.13.8.dist-info/WHEEL,sha256=vVCvjcmxuUltf8cYhJ0sJMRDLr1XsPuxEId8YDzbyCY,88
|
105
|
+
micropython_stubber-1.13.8.dist-info/RECORD,,
|
stubber/__init__.py
CHANGED
stubber/basicgit.py
CHANGED
@@ -3,18 +3,16 @@ Simple Git module, where needed via powershell
|
|
3
3
|
|
4
4
|
Some of the functions are based on the gitpython module
|
5
5
|
"""
|
6
|
+
import os
|
6
7
|
import subprocess
|
7
8
|
from pathlib import Path
|
8
9
|
from typing import List, Optional, Union
|
9
10
|
|
11
|
+
import cachetools.func
|
12
|
+
from github import Github
|
10
13
|
from loguru import logger as log
|
11
14
|
from packaging.version import parse
|
12
15
|
|
13
|
-
from github import Github
|
14
|
-
import cachetools.func
|
15
|
-
import os
|
16
|
-
|
17
|
-
|
18
16
|
# Token with no permissions
|
19
17
|
PAT_NO_ACCESS = "github_pat" + "_11AAHPVFQ0IwtAmfc3cD5Z" + "_xOVII22ErRzzZ7xwwxRcNotUu4krMMbjinQcsMxjnWkYFBIDRWFlZMaHSqq"
|
20
18
|
PAT = os.environ.get("GITHUB_TOKEN") or PAT_NO_ACCESS
|
@@ -122,9 +120,14 @@ def get_tags(repo: str, minver: Optional[str] = None) -> List[str]:
|
|
122
120
|
"""
|
123
121
|
Get list of tag of a repote github repo
|
124
122
|
"""
|
125
|
-
if not repo or not isinstance(repo, str) or "/" not in repo:
|
123
|
+
if not repo or not isinstance(repo, str) or "/" not in repo: # type: ignore
|
124
|
+
return []
|
125
|
+
try:
|
126
|
+
gh_repo = GH_CLIENT.get_repo(repo)
|
127
|
+
except ConnectionError as e:
|
128
|
+
# TODO: unable to capture the exeption
|
129
|
+
log.warning(f"Unable to get tags - {e}")
|
126
130
|
return []
|
127
|
-
gh_repo = GH_CLIENT.get_repo(repo)
|
128
131
|
tags = [tag.name for tag in gh_repo.get_tags()]
|
129
132
|
if minver:
|
130
133
|
tags = [tag for tag in tags if parse(tag) >= parse(minver)]
|
stubber/board/createstubs.py
CHANGED
@@ -20,7 +20,7 @@ try:
|
|
20
20
|
except ImportError:
|
21
21
|
from ucollections import OrderedDict # type: ignore
|
22
22
|
|
23
|
-
__version__ = "v1.13.
|
23
|
+
__version__ = "v1.13.8"
|
24
24
|
ENOENT = 2
|
25
25
|
_MAX_CLASS_LEVEL = 2 # Max class nesting
|
26
26
|
LIBS = [".", "/lib", "/sd/lib", "/flash/lib", "lib"]
|
@@ -90,7 +90,7 @@ class Stubber:
|
|
90
90
|
_errors = []
|
91
91
|
self._log.debug("get attributes {} {}".format(repr(item_instance), item_instance))
|
92
92
|
for name in dir(item_instance):
|
93
|
-
if name.startswith("_"):
|
93
|
+
if name.startswith("_") and not name in self.modules:
|
94
94
|
continue
|
95
95
|
self._log.debug("get attribute {}".format(name))
|
96
96
|
try:
|
@@ -117,7 +117,8 @@ class Stubber:
|
|
117
117
|
reset()
|
118
118
|
|
119
119
|
# remove internal __
|
120
|
-
_result = sorted([i for i in _result if not (i[0].startswith("_"))], key=lambda x: x[4])
|
120
|
+
# _result = sorted([i for i in _result if not (i[0].startswith("_"))], key=lambda x: x[4])
|
121
|
+
_result = sorted([i for i in _result if not (i[0].startswith("__"))], key=lambda x: x[4])
|
121
122
|
gc.collect()
|
122
123
|
return _result, _errors
|
123
124
|
|
stubber/board/createstubs_db.py
CHANGED
@@ -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.13.
|
21
|
+
This variant was generated from createstubs.py by micropython-stubber v1.13.8
|
22
22
|
"""
|
23
23
|
# Copyright (c) 2019-2023 Jos Verlinde
|
24
24
|
# pylint: disable= invalid-name, missing-function-docstring, import-outside-toplevel, logging-not-lazy
|
@@ -39,7 +39,7 @@ try:
|
|
39
39
|
except ImportError:
|
40
40
|
from ucollections import OrderedDict # type: ignore
|
41
41
|
|
42
|
-
__version__ = "v1.13.
|
42
|
+
__version__ = "v1.13.8"
|
43
43
|
ENOENT = 2
|
44
44
|
_MAX_CLASS_LEVEL = 2 # Max class nesting
|
45
45
|
LIBS = [".", "/lib", "/sd/lib", "/flash/lib", "lib"]
|
@@ -109,7 +109,7 @@ class Stubber:
|
|
109
109
|
_errors = []
|
110
110
|
self._log.debug("get attributes {} {}".format(repr(item_instance), item_instance))
|
111
111
|
for name in dir(item_instance):
|
112
|
-
if name.startswith("_"):
|
112
|
+
if name.startswith("_") and not name in self.modules:
|
113
113
|
continue
|
114
114
|
self._log.debug("get attribute {}".format(name))
|
115
115
|
try:
|
@@ -136,7 +136,8 @@ class Stubber:
|
|
136
136
|
reset()
|
137
137
|
|
138
138
|
# remove internal __
|
139
|
-
_result = sorted([i for i in _result if not (i[0].startswith("_"))], key=lambda x: x[4])
|
139
|
+
# _result = sorted([i for i in _result if not (i[0].startswith("_"))], key=lambda x: x[4])
|
140
|
+
_result = sorted([i for i in _result if not (i[0].startswith("__"))], key=lambda x: x[4])
|
140
141
|
gc.collect()
|
141
142
|
return _result, _errors
|
142
143
|
|
@@ -16,11 +16,11 @@ Y='list'
|
|
16
16
|
X='tuple'
|
17
17
|
W='micropython'
|
18
18
|
V=repr
|
19
|
-
T=
|
20
|
-
S=
|
21
|
-
R=
|
22
|
-
Q=
|
23
|
-
P=
|
19
|
+
T='_'
|
20
|
+
S=KeyError
|
21
|
+
R=IndexError
|
22
|
+
Q=dir
|
23
|
+
P=ImportError
|
24
24
|
O='family'
|
25
25
|
N=True
|
26
26
|
M='.'
|
@@ -38,10 +38,10 @@ C=''
|
|
38
38
|
import gc as B,sys,uos as os
|
39
39
|
from ujson import dumps as b
|
40
40
|
try:from machine import reset
|
41
|
-
except
|
41
|
+
except P:pass
|
42
42
|
try:from collections import OrderedDict as c
|
43
|
-
except
|
44
|
-
__version__='v1.13.
|
43
|
+
except P:from ucollections import OrderedDict as c
|
44
|
+
__version__='v1.13.8'
|
45
45
|
v=2
|
46
46
|
w=2
|
47
47
|
d=[M,'/lib','/sd/lib','/flash/lib','lib']
|
@@ -65,21 +65,21 @@ class Stubber:
|
|
65
65
|
except A:I('error creating stub folder {}'.format(path))
|
66
66
|
C.problematic=['upip','upysh','webrepl_setup','http_client','http_client_ssl','http_server','http_server_ssl'];C.excluded=['webrepl','_webrepl','port_diag','example_sub_led.py','example_pub_button.py'];C.modules=[]
|
67
67
|
def get_obj_attributes(L,item_instance):
|
68
|
-
I=item_instance;
|
69
|
-
for
|
70
|
-
if
|
68
|
+
I=item_instance;D=[];J=[]
|
69
|
+
for A in Q(I):
|
70
|
+
if A.startswith(T)and not A in L.modules:continue
|
71
71
|
try:
|
72
|
-
E=getattr(I,
|
72
|
+
E=getattr(I,A)
|
73
73
|
try:F=V(type(E)).split("'")[1]
|
74
|
-
except
|
74
|
+
except R:F=C
|
75
75
|
if F in{o,p,q,r,X,Y,Z}:G=1
|
76
76
|
elif F in{s,t}:G=2
|
77
77
|
elif F in'class':G=3
|
78
78
|
else:G=4
|
79
|
-
|
80
|
-
except H as K:J.append("Couldn't get attribute '{}' from object '{}', Err: {}".format(
|
79
|
+
D.append((A,V(E),V(type(E)),E,G))
|
80
|
+
except H as K:J.append("Couldn't get attribute '{}' from object '{}', Err: {}".format(A,I,K))
|
81
81
|
except k as K:sleep(1);reset()
|
82
|
-
|
82
|
+
D=l([A for A in D if not A[0].startswith('__')],key=lambda x:x[4]);B.collect();return D,J
|
83
83
|
def add_modules(A,modules):A.modules=l(set(A.modules)|set(modules))
|
84
84
|
def create_all_stubs(A):
|
85
85
|
B.collect()
|
@@ -94,27 +94,27 @@ class Stubber:
|
|
94
94
|
B.collect();return E
|
95
95
|
def create_module_stub(K,module_name,file_name=E):
|
96
96
|
H=file_name;D=module_name
|
97
|
-
if H is E:L=D.replace(M,
|
97
|
+
if H is E:L=D.replace(M,T)+'.py';H=K.path+G+L
|
98
98
|
else:L=H.split(G)[-1]
|
99
99
|
if G in D:D=D.replace(G,M)
|
100
100
|
O=E
|
101
|
-
try:O=__import__(D,E,E,'*');
|
102
|
-
except
|
101
|
+
try:O=__import__(D,E,E,'*');R=B.mem_free();I('Stub module: {:<25} to file: {:<70} mem:{:>5}'.format(D,L,R))
|
102
|
+
except P:return F
|
103
103
|
e(H)
|
104
|
-
with J(H,'w')as
|
104
|
+
with J(H,'w')as Q:U='"""\nModule: \'{0}\' on {1}\n"""\n# MCU: {2}\n# Stubber: {3}\n'.format(D,K._fwid,K.info,__version__);Q.write(U);Q.write('from typing import Any\n\n');K.write_object_stub(Q,O,D,C)
|
105
105
|
K._report.append('{{"module": "{}", "file": "{}"}}'.format(D,H.replace('\\',G)))
|
106
106
|
if D not in{'os','sys','logging','gc'}:
|
107
107
|
try:del O
|
108
|
-
except (A,
|
108
|
+
except (A,S):pass
|
109
109
|
try:del sys.modules[D]
|
110
|
-
except
|
110
|
+
except S:pass
|
111
111
|
B.collect();return N
|
112
112
|
def write_object_stub(M,fp,object_expr,obj_name,indent,in_class=0):
|
113
113
|
d='{0}{1} = {2} # type: {3}\n';c='bound_method';b='Any';Q=in_class;P=object_expr;O='Exception';H=fp;E=indent;B.collect()
|
114
114
|
if P in M.problematic:return
|
115
115
|
R,N=M.get_obj_attributes(P)
|
116
116
|
if N:I(N)
|
117
|
-
for (F,K,G,
|
117
|
+
for (F,K,G,T,f) in R:
|
118
118
|
if F in['classmethod','staticmethod','BaseException',O]:continue
|
119
119
|
if F[0].isdigit():continue
|
120
120
|
if G=="<class 'type'>"and L(E)<=w*4:
|
@@ -122,7 +122,7 @@ class Stubber:
|
|
122
122
|
if V:U=O
|
123
123
|
D='\n{}class {}({}):\n'.format(E,F,U)
|
124
124
|
if V:D+=E+' ...\n';H.write(D);return
|
125
|
-
H.write(D);M.write_object_stub(H,
|
125
|
+
H.write(D);M.write_object_stub(H,T,'{0}.{1}'.format(obj_name,F),E+' ',Q+1);D=E+' def __init__(self, *argv, **kwargs) -> None:\n';D+=E+' ...\n\n';H.write(D)
|
126
126
|
elif t in G or s in G:
|
127
127
|
W=b;a=C
|
128
128
|
if Q>0:a='self, '
|
@@ -140,12 +140,12 @@ class Stubber:
|
|
140
140
|
H.write(D)
|
141
141
|
else:H.write("# all other, type = '{0}'\n".format(G));H.write(E+F+' # type: Any\n')
|
142
142
|
del R;del N
|
143
|
-
try:del F,K,G,
|
144
|
-
except (A,
|
143
|
+
try:del F,K,G,T
|
144
|
+
except (A,S,m):pass
|
145
145
|
@property
|
146
146
|
def flat_fwid(self):
|
147
147
|
A=self._fwid;B=' .()/\\:$'
|
148
|
-
for C in B:A=A.replace(C,
|
148
|
+
for C in B:A=A.replace(C,T)
|
149
149
|
return A
|
150
150
|
def clean(C,path=E):
|
151
151
|
if path is E:path=C.path
|
@@ -193,8 +193,8 @@ def _info():
|
|
193
193
|
j='ev3-pybricks';i='pycom';h='pycopy';e='GENERIC';b='arch';a='cpu';Z='ver';V='with';G='mpy';F='build';A=c({O:sys.implementation.name,D:C,F:C,Z:C,n:'stm32'if sys.platform.startswith('pyb')else sys.platform,K:e,a:C,G:C,b:C})
|
194
194
|
try:A[D]=M.join([str(A)for A in sys.implementation.version])
|
195
195
|
except H:pass
|
196
|
-
try:X=sys.implementation._machine if'_machine'in
|
197
|
-
except (H,
|
196
|
+
try:X=sys.implementation._machine if'_machine'in Q(sys.implementation)else os.uname().machine;A[K]=X.strip();A[a]=X.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
|
197
|
+
except (H,R):pass
|
198
198
|
B.collect()
|
199
199
|
for J in [A+'/board_info.csv'for A in d]:
|
200
200
|
if g(J):
|
@@ -204,19 +204,19 @@ def _info():
|
|
204
204
|
I=I.split(V)[0].strip()
|
205
205
|
if f(A,I,J):break
|
206
206
|
A[K]=e
|
207
|
-
A[K]=A[K].replace(' ',
|
207
|
+
A[K]=A[K].replace(' ',T);B.collect()
|
208
208
|
try:
|
209
209
|
A[F]=U(os.uname()[3])
|
210
210
|
if not A[F]:A[F]=U(os.uname()[2])
|
211
211
|
if not A[F]and';'in sys.version:A[F]=U(sys.version.split(';')[1])
|
212
|
-
except (H,
|
212
|
+
except (H,R):pass
|
213
213
|
if A[F]and L(A[F])>5:A[F]=C
|
214
214
|
if A[D]==C and sys.platform not in('unix','win32'):
|
215
215
|
try:k=os.uname();A[D]=k.release
|
216
|
-
except (
|
216
|
+
except (R,H,TypeError):pass
|
217
217
|
for (l,m,o) in [(h,h,'const'),(i,i,'FAT'),(j,'pybricks.hubs','EV3Brick')]:
|
218
218
|
try:p=__import__(m,E,E,o);A[O]=l;del p;break
|
219
|
-
except (
|
219
|
+
except (P,S):pass
|
220
220
|
if A[O]==j:A['release']='2.0.0'
|
221
221
|
if A[O]==W:
|
222
222
|
if A[D]and A[D].endswith('.0')and A[D]>='1.10.0'and A[D]<='1.19.9':A[D]=A[D][:-2]
|
Binary file
|