micropython-stubber 1.23.3__py3-none-any.whl → 1.24.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {micropython_stubber-1.23.3.dist-info → micropython_stubber-1.24.1.dist-info}/METADATA +29 -11
- {micropython_stubber-1.23.3.dist-info → micropython_stubber-1.24.1.dist-info}/RECORD +68 -65
- {micropython_stubber-1.23.3.dist-info → micropython_stubber-1.24.1.dist-info}/WHEEL +1 -1
- mpflash/README.md +2 -2
- mpflash/mpflash/basicgit.py +22 -2
- mpflash/mpflash/common.py +23 -13
- mpflash/mpflash/downloaded.py +10 -2
- mpflash/mpflash/flash/esp.py +1 -1
- mpflash/mpflash/mpboard_id/__init__.py +9 -4
- mpflash/mpflash/mpboard_id/add_boards.py +25 -14
- mpflash/mpflash/mpboard_id/board.py +2 -2
- mpflash/mpflash/mpboard_id/board_id.py +10 -6
- mpflash/mpflash/mpboard_id/board_info.zip +0 -0
- mpflash/mpflash/mpremoteboard/__init__.py +13 -8
- mpflash/mpflash/vendor/board_database.py +185 -0
- mpflash/mpflash/vendor/readme.md +10 -1
- mpflash/mpflash/versions.py +28 -40
- mpflash/poetry.lock +1147 -231
- mpflash/pyproject.toml +4 -3
- stubber/__init__.py +1 -1
- stubber/board/createstubs.py +76 -34
- stubber/board/createstubs_db.py +34 -25
- stubber/board/createstubs_db_min.py +90 -83
- stubber/board/createstubs_db_mpy.mpy +0 -0
- stubber/board/createstubs_mem.py +34 -25
- stubber/board/createstubs_mem_min.py +123 -116
- stubber/board/createstubs_mem_mpy.mpy +0 -0
- stubber/board/createstubs_min.py +154 -145
- stubber/board/createstubs_mpy.mpy +0 -0
- stubber/board/modulelist.txt +16 -0
- stubber/codemod/enrich.py +301 -86
- stubber/codemod/merge_docstub.py +251 -66
- stubber/codemod/test_enrich.py +87 -0
- stubber/codemod/visitors/type_helpers.py +182 -0
- stubber/commands/build_cmd.py +16 -3
- stubber/commands/clone_cmd.py +3 -3
- stubber/commands/config_cmd.py +4 -2
- stubber/commands/enrich_folder_cmd.py +33 -21
- stubber/commands/get_core_cmd.py +1 -2
- stubber/commands/get_docstubs_cmd.py +60 -6
- stubber/commands/get_frozen_cmd.py +15 -12
- stubber/commands/get_mcu_cmd.py +3 -3
- stubber/commands/merge_cmd.py +1 -2
- stubber/commands/publish_cmd.py +19 -4
- stubber/commands/stub_cmd.py +3 -3
- stubber/commands/switch_cmd.py +3 -5
- stubber/commands/variants_cmd.py +3 -3
- stubber/cst_transformer.py +52 -17
- stubber/freeze/common.py +27 -11
- stubber/freeze/freeze_manifest_2.py +8 -1
- stubber/freeze/get_frozen.py +4 -1
- stubber/merge_config.py +111 -0
- stubber/minify.py +1 -2
- stubber/publish/database.py +51 -10
- stubber/publish/merge_docstubs.py +38 -17
- stubber/publish/package.py +32 -18
- stubber/publish/publish.py +8 -8
- stubber/publish/stubpackage.py +117 -50
- stubber/rst/lookup.py +205 -41
- stubber/rst/reader.py +106 -59
- stubber/rst/rst_utils.py +24 -11
- stubber/stubber.py +1 -1
- stubber/stubs_from_docs.py +31 -13
- stubber/update_module_list.py +2 -2
- stubber/utils/config.py +33 -13
- stubber/utils/post.py +9 -6
- stubber/publish/missing_class_methods.py +0 -51
- {micropython_stubber-1.23.3.dist-info → micropython_stubber-1.24.1.dist-info}/LICENSE +0 -0
- {micropython_stubber-1.23.3.dist-info → micropython_stubber-1.24.1.dist-info}/entry_points.txt +0 -0
stubber/utils/post.py
CHANGED
@@ -52,10 +52,13 @@ def run_autoflake(path: Path, capture_output: bool = False, process_pyi: bool =
|
|
52
52
|
return -1
|
53
53
|
log.info(f"Running autoflake on: {path}")
|
54
54
|
# create a list of files to be formatted
|
55
|
-
files: List[
|
56
|
-
files.extend(
|
55
|
+
files: List[Path] = []
|
56
|
+
files.extend(path.rglob("*.py"))
|
57
57
|
if process_pyi:
|
58
|
-
files.extend(
|
58
|
+
files.extend(path.rglob("*.pyi"))
|
59
|
+
|
60
|
+
# do not process umodules as that would remove all imports
|
61
|
+
files = [f for f in files if not f.name.startswith("u")]
|
59
62
|
|
60
63
|
# build an argument list
|
61
64
|
autoflake_args = {
|
@@ -75,6 +78,6 @@ def run_autoflake(path: Path, capture_output: bool = False, process_pyi: bool =
|
|
75
78
|
}
|
76
79
|
# format the files
|
77
80
|
exit_status = 0
|
78
|
-
for
|
79
|
-
log.debug(f"Running autoflake on: {
|
80
|
-
exit_status |= autoflake.fix_file(
|
81
|
+
for f in files:
|
82
|
+
log.debug(f"Running autoflake on: {f}")
|
83
|
+
exit_status |= autoflake.fix_file(str(f), args=autoflake_args)
|
@@ -1,51 +0,0 @@
|
|
1
|
-
"""
|
2
|
-
Add missing methods to classes in the stubs that are documented in the docstubs
|
3
|
-
|
4
|
-
"""
|
5
|
-
|
6
|
-
from pathlib import Path
|
7
|
-
|
8
|
-
import libcst as cst
|
9
|
-
from mpflash.logger import log
|
10
|
-
|
11
|
-
from mpflash.versions import clean_version
|
12
|
-
from stubber.codemod.add_method import CallAdder, CallFinder
|
13
|
-
from stubber.utils.config import CONFIG
|
14
|
-
from stubber.utils.post import run_black
|
15
|
-
|
16
|
-
|
17
|
-
def add_machine_pin_call(merged_path: Path, version: str):
|
18
|
-
"""
|
19
|
-
Add the __call__ method to the machine.Pin and pyb.Pin class
|
20
|
-
in all pyb and machine/umachine stubs
|
21
|
-
"""
|
22
|
-
# TODO: this should be done in the merge_docstubs.py to avoid needing to run black twice
|
23
|
-
# and to avoid having to parse the file twice
|
24
|
-
|
25
|
-
# first find the __call__ method in the default stubs
|
26
|
-
mod_path = (
|
27
|
-
CONFIG.stub_path / f"micropython-{clean_version(version, flat=True)}-docstubs/machine.pyi"
|
28
|
-
)
|
29
|
-
if not mod_path.exists():
|
30
|
-
log.error(f"no docstubs found for {version}")
|
31
|
-
return False
|
32
|
-
log.trace(f"Parsing {mod_path} for __call__ method")
|
33
|
-
source = mod_path.read_text(encoding="utf-8")
|
34
|
-
module = cst.parse_module(source)
|
35
|
-
|
36
|
-
call_finder = CallFinder()
|
37
|
-
module.visit(call_finder)
|
38
|
-
|
39
|
-
if call_finder.call_meth is None:
|
40
|
-
log.error("no __call__ method found")
|
41
|
-
return False
|
42
|
-
|
43
|
-
# then use the CallAdder to add the __call__ method to all machine and pyb stubs
|
44
|
-
mod_paths = [f for f in merged_path.rglob("*.*") if f.stem in {"machine", "umachine", "pyb"}]
|
45
|
-
for mod_path in mod_paths:
|
46
|
-
source = mod_path.read_text(encoding="utf-8")
|
47
|
-
machine_module = cst.parse_module(source)
|
48
|
-
new_module = machine_module.visit(CallAdder(call_finder.call_meth))
|
49
|
-
mod_path.write_text(new_module.code, encoding="utf-8")
|
50
|
-
run_black(mod_path)
|
51
|
-
return True
|
File without changes
|
{micropython_stubber-1.23.3.dist-info → micropython_stubber-1.24.1.dist-info}/entry_points.txt
RENAMED
File without changes
|