micropython-stubber 1.24.2__py3-none-any.whl → 1.24.4.post1__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 (83) hide show
  1. {micropython_stubber-1.24.2.dist-info → micropython_stubber-1.24.4.post1.dist-info}/METADATA +7 -28
  2. micropython_stubber-1.24.4.post1.dist-info/RECORD +107 -0
  3. {micropython_stubber-1.24.2.dist-info → micropython_stubber-1.24.4.post1.dist-info}/WHEEL +1 -1
  4. stubber/__init__.py +1 -1
  5. stubber/board/createstubs_db.py +1 -1
  6. stubber/board/createstubs_mem.py +1 -1
  7. stubber/bulk/mcu_stubber.py +1 -1
  8. stubber/codemod/board.py +1 -1
  9. stubber/codemod/enrich.py +12 -10
  10. stubber/codemod/merge_docstub.py +83 -53
  11. stubber/codemod/visitors/type_helpers.py +143 -41
  12. stubber/commands/enrich_folder_cmd.py +17 -17
  13. stubber/commands/get_docstubs_cmd.py +22 -3
  14. stubber/commands/get_frozen_cmd.py +1 -0
  15. stubber/commands/merge_cmd.py +2 -4
  16. stubber/merge_config.py +5 -39
  17. stubber/minify.py +3 -3
  18. stubber/modcat.py +118 -0
  19. stubber/publish/merge_docstubs.py +21 -3
  20. stubber/publish/stubpackage.py +10 -27
  21. stubber/rst/lookup.py +3 -23
  22. stubber/stubs_from_docs.py +2 -1
  23. stubber/{cst_transformer.py → typing_collector.py} +34 -3
  24. micropython_stubber-1.24.2.dist-info/RECORD +0 -163
  25. mpflash/README.md +0 -220
  26. mpflash/libusb_flash.ipynb +0 -203
  27. mpflash/mpflash/__init__.py +0 -0
  28. mpflash/mpflash/add_firmware.py +0 -98
  29. mpflash/mpflash/ask_input.py +0 -236
  30. mpflash/mpflash/basicgit.py +0 -324
  31. mpflash/mpflash/bootloader/__init__.py +0 -2
  32. mpflash/mpflash/bootloader/activate.py +0 -60
  33. mpflash/mpflash/bootloader/detect.py +0 -82
  34. mpflash/mpflash/bootloader/manual.py +0 -101
  35. mpflash/mpflash/bootloader/micropython.py +0 -12
  36. mpflash/mpflash/bootloader/touch1200.py +0 -36
  37. mpflash/mpflash/cli_download.py +0 -129
  38. mpflash/mpflash/cli_flash.py +0 -224
  39. mpflash/mpflash/cli_group.py +0 -111
  40. mpflash/mpflash/cli_list.py +0 -87
  41. mpflash/mpflash/cli_main.py +0 -39
  42. mpflash/mpflash/common.py +0 -217
  43. mpflash/mpflash/config.py +0 -44
  44. mpflash/mpflash/connected.py +0 -96
  45. mpflash/mpflash/download.py +0 -364
  46. mpflash/mpflash/downloaded.py +0 -138
  47. mpflash/mpflash/errors.py +0 -9
  48. mpflash/mpflash/flash/__init__.py +0 -55
  49. mpflash/mpflash/flash/esp.py +0 -59
  50. mpflash/mpflash/flash/stm32.py +0 -19
  51. mpflash/mpflash/flash/stm32_dfu.py +0 -104
  52. mpflash/mpflash/flash/uf2/__init__.py +0 -104
  53. mpflash/mpflash/flash/uf2/boardid.py +0 -15
  54. mpflash/mpflash/flash/uf2/linux.py +0 -136
  55. mpflash/mpflash/flash/uf2/macos.py +0 -42
  56. mpflash/mpflash/flash/uf2/uf2disk.py +0 -12
  57. mpflash/mpflash/flash/uf2/windows.py +0 -43
  58. mpflash/mpflash/flash/worklist.py +0 -170
  59. mpflash/mpflash/list.py +0 -106
  60. mpflash/mpflash/logger.py +0 -41
  61. mpflash/mpflash/mpboard_id/__init__.py +0 -98
  62. mpflash/mpflash/mpboard_id/add_boards.py +0 -265
  63. mpflash/mpflash/mpboard_id/board.py +0 -37
  64. mpflash/mpflash/mpboard_id/board_id.py +0 -92
  65. mpflash/mpflash/mpboard_id/board_info.zip +0 -0
  66. mpflash/mpflash/mpboard_id/store.py +0 -48
  67. mpflash/mpflash/mpremoteboard/__init__.py +0 -271
  68. mpflash/mpflash/mpremoteboard/mpy_fw_info.py +0 -152
  69. mpflash/mpflash/mpremoteboard/runner.py +0 -140
  70. mpflash/mpflash/vendor/board_database.py +0 -185
  71. mpflash/mpflash/vendor/click_aliases.py +0 -91
  72. mpflash/mpflash/vendor/dfu.py +0 -165
  73. mpflash/mpflash/vendor/pico-universal-flash-nuke/LICENSE.txt +0 -21
  74. mpflash/mpflash/vendor/pico-universal-flash-nuke/universal_flash_nuke.uf2 +0 -0
  75. mpflash/mpflash/vendor/pydfu.py +0 -605
  76. mpflash/mpflash/vendor/readme.md +0 -14
  77. mpflash/mpflash/versions.py +0 -123
  78. mpflash/poetry.lock +0 -2869
  79. mpflash/pyproject.toml +0 -66
  80. mpflash/stm32_udev_rules.md +0 -63
  81. stubber/codemod/test_enrich.py +0 -87
  82. {micropython_stubber-1.24.2.dist-info → micropython_stubber-1.24.4.post1.dist-info}/LICENSE +0 -0
  83. {micropython_stubber-1.24.2.dist-info → micropython_stubber-1.24.4.post1.dist-info}/entry_points.txt +0 -0
@@ -1,123 +0,0 @@
1
- """
2
- Version handling for mpflash and micropython-stubber
3
- """
4
-
5
- from pathlib import Path
6
-
7
- from cache_to_disk import NoCacheCondition, cache_to_disk
8
- from loguru import logger as log
9
- from packaging.version import Version, parse
10
-
11
- import mpflash.basicgit as git
12
- from mpflash.common import GH_CLIENT
13
-
14
- OLDEST_VERSION = "1.16"
15
- "This is the oldest MicroPython version to build the stubs on"
16
-
17
- V_PREVIEW = "preview"
18
- "Latest preview version"
19
-
20
- SET_PREVIEW = {"preview", "latest", "master"}
21
-
22
-
23
- def clean_version(
24
- version: str,
25
- *,
26
- build: bool = False,
27
- patch: bool = False,
28
- commit: bool = False,
29
- drop_v: bool = False,
30
- flat: bool = False,
31
- ): # sourcery skip: assign-if-exp
32
- "Clean up and transform the many flavours of versions"
33
- # 'v1.13.0-103-gb137d064e' --> 'v1.13-103'
34
- if version in {"", "-"}:
35
- return version
36
- if version.lower() == "stable":
37
- _v = get_stable_mp_version()
38
- if not _v:
39
- log.warning("Could not determine the latest stable version")
40
- return "stable"
41
- version = _v
42
- log.trace(f"Using latest stable version: {version}")
43
- is_preview = "-preview" in version
44
- nibbles = version.split("-")
45
- ver_ = nibbles[0].lower().lstrip("v")
46
- if not patch and ver_ >= "1.10.0" and ver_ < "1.20.0" and ver_.endswith(".0"):
47
- # remove the last ".0" - but only for versions between 1.10 and 1.20 (because)
48
- nibbles[0] = nibbles[0][:-2]
49
- if len(nibbles) == 1:
50
- version = nibbles[0]
51
- elif build and not is_preview:
52
- # HACK: this is not always right, but good enough most of the time
53
- version = "-".join(nibbles) if commit else "-".join(nibbles[:-1])
54
- elif is_preview:
55
- version = "-".join((nibbles[0], V_PREVIEW))
56
- else:
57
- version = V_PREVIEW
58
- if flat:
59
- version = version.strip().replace(".", "_").replace("-", "_")
60
- else:
61
- version = version.strip().replace("_preview", "-preview").replace("_", ".")
62
-
63
- if drop_v:
64
- version = version.lstrip("v")
65
- elif not version.startswith("v") and version.lower() not in SET_PREVIEW:
66
- version = "v" + version
67
- if version in SET_PREVIEW:
68
- version = V_PREVIEW
69
- return version
70
-
71
-
72
- def is_version(version: str):
73
- """Check if the version is a valid version string"""
74
- return Version._regex.search(version) is not None
75
-
76
-
77
- @cache_to_disk(n_days_to_cache=1)
78
- def micropython_versions(minver: str = "v1.20", reverse: bool = False, cache_it=True):
79
- """Get the list of micropython versions from github tags"""
80
-
81
- try:
82
- gh_client = GH_CLIENT
83
- repo = gh_client.get_repo("micropython/micropython")
84
- tags = [tag.name for tag in repo.get_tags() if parse(tag.name) >= parse(minver)]
85
- versions = [v for v in tags if not v.endswith(V_PREVIEW)]
86
- # Only keep the last preview
87
- preview = sorted([v for v in tags if v.endswith(V_PREVIEW)], reverse=True)[0]
88
- versions.append(preview)
89
- except Exception as e:
90
- log.error(e)
91
- versions = []
92
- # returns - but does not cache
93
- raise NoCacheCondition(function_value=versions)
94
- # remove any duplicates and sort
95
- versions = sorted(list(set(versions)), reverse=reverse, key=lambda s: (not is_version(s), s))
96
- if cache_it:
97
- return versions
98
- # returns - but does not cache
99
- raise NoCacheCondition(function_value=versions)
100
-
101
-
102
- def get_stable_mp_version(cache_it=True) -> str:
103
- # read the versions from the git tags
104
- all_versions = micropython_versions(minver=OLDEST_VERSION, cache_it=cache_it)
105
- versions = [v for v in all_versions if not v.endswith(V_PREVIEW)]
106
- return versions[-1] if versions else ""
107
-
108
-
109
- def get_preview_mp_version(cache_it=True) -> str:
110
- # read the versions from the git tags
111
- all_versions = micropython_versions(minver=OLDEST_VERSION, cache_it=cache_it)
112
- versions = [v for v in all_versions if v.endswith(V_PREVIEW)]
113
- return versions[0] if versions else ""
114
-
115
-
116
- # Do not cache , same path will have different versions checked out
117
- def checkedout_version(path: Path, flat: bool = False) -> str:
118
- """Get the checked-out version of the repo"""
119
- version = git.get_local_tag(path.as_posix())
120
- if not version:
121
- raise ValueError("No valid Tag found")
122
- version = clean_version(version, flat=flat, drop_v=False)
123
- return version