micropython-stubber 1.20.0__py3-none-any.whl → 1.20.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.
@@ -18,20 +18,23 @@ HERE = Path(__file__).parent
18
18
  def find_board_id(
19
19
  descr: str, short_descr: str, board_info: Optional[Path] = None, version: str = "stable"
20
20
  ) -> Optional[str]:
21
- # TODO: use the json file instead of the csv and get the cpu
22
- boards = find_board_by_description(
23
- descr=descr,
24
- short_descr=short_descr,
25
- board_info=board_info,
26
- version=clean_version(version),
27
- )
28
- return boards[-1]["board"]
21
+ """Find the MicroPython BOARD_ID based on the description in the firmware"""
22
+ try:
23
+ boards = find_board_id_by_description(
24
+ descr=descr,
25
+ short_descr=short_descr,
26
+ board_info=board_info,
27
+ version=clean_version(version),
28
+ )
29
+ return boards[-1]["board"]
30
+ except MPFlashError:
31
+ return "UNKNOWN_BOARD"
29
32
 
30
33
 
31
34
  @functools.lru_cache(maxsize=20)
32
- def find_board_by_description(*, descr: str, short_descr: str, version="v1.21.0", board_info: Optional[Path] = None):
35
+ def find_board_id_by_description(*, descr: str, short_descr: str, version="v1.21.0", board_info: Optional[Path] = None):
33
36
  """
34
- Find the MicroPython BOARD designator based on the description in the firmware
37
+ Find the MicroPython BOARD_ID based on the description in the firmware
35
38
  using the pre-built board_info.json file
36
39
  """
37
40
  if not board_info:
@@ -52,7 +55,7 @@ def find_board_by_description(*, descr: str, short_descr: str, version="v1.21.0"
52
55
  if not matches and short_descr:
53
56
  matches = [b for b in version_matches if b["description"] == short_descr]
54
57
  if not matches:
55
- raise MPFlashError(f"No board info found for description {descr}")
58
+ raise MPFlashError(f"No board info found for description '{descr}' or '{short_descr}'")
56
59
  return sorted(matches, key=lambda x: x["version"])
57
60
 
58
61
 
@@ -21,6 +21,17 @@ class LogTags:
21
21
  ignore_tags: LogTagList
22
22
 
23
23
 
24
+ DEFAULT_RESET_TAGS = [
25
+ # ESP32 reset causes
26
+ "rst cause:1, boot mode:", # 1 -> hardware watch dog reset
27
+ "rst cause:2, boot mode:", # 2 -> software watch dog reset (From an exception)
28
+ "rst cause:3, boot mode:", # 3 -> software watch dog reset system_restart (Possibly unfed watchdog got angry)
29
+ "rst cause:4, boot mode:", # 4 -> soft restart (Possibly with a restart command)
30
+ "boot.esp32: PRO CPU has been reset by WDT.",
31
+ "rst:0x10 (RTCWDT_RTC_RESET)",
32
+ ]
33
+
34
+
24
35
  def run(
25
36
  cmd: List[str],
26
37
  timeout: int = 60,
@@ -57,18 +68,7 @@ def run(
57
68
  The return code and the output as a list of strings
58
69
  """
59
70
  if not reset_tags:
60
- reset_tags = [
61
- "rst cause:1, boot mode:",
62
- "rst cause:2, boot mode:",
63
- "rst cause:3, boot mode:",
64
- "rst cause:4, boot mode:",
65
- ]
66
- # 0 -> normal startup by power on
67
- # 1 -> hardware watch dog reset
68
- # 2 -> software watch dog reset (From an exception)
69
- # 3 -> software watch dog reset system_restart (Possibly unfed watchdog got angry)
70
- # 4 -> soft restart (Possibly with a restart command)
71
- # 5 -> wake up from deep-sleep
71
+ reset_tags = DEFAULT_RESET_TAGS
72
72
  if not error_tags:
73
73
  error_tags = ["Traceback ", "Error: ", "Exception: ", "ERROR :", "CRIT :"]
74
74
  if not warning_tags:
mpflash/poetry.lock CHANGED
@@ -1,4 +1,4 @@
1
- # This file is automatically @generated by Poetry 1.6.1 and should not be changed by hand.
1
+ # This file is automatically @generated by Poetry 1.8.2 and should not be changed by hand.
2
2
 
3
3
  [[package]]
4
4
  name = "ansicon"
mpflash/pyproject.toml CHANGED
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "mpflash"
3
- version = "0.7.0"
3
+ version = "0.7.4"
4
4
  description = "Flash and download tool for MicroPython firmwares"
5
5
  authors = ["Jos Verlinde <jos_verlinde@hotmail.com>"]
6
6
  license = "MIT"
@@ -25,7 +25,7 @@ loguru = "^0.7.2"
25
25
  esptool = "^4.7.0"
26
26
  jsonlines = "^4.0.0"
27
27
  bincopy = "^20.0.0"
28
- strip-ansi = "^0.1.1"
28
+ # strip-ansi = "^0.1.1"
29
29
  rich-click = "^1.7.3"
30
30
  psutil = "^5.9.8"
31
31
  blkinfo = "^0.2.0"
stubber/__init__.py CHANGED
@@ -1,3 +1,3 @@
1
1
  """get the version"""
2
2
 
3
- __version__ = "1.20.0"
3
+ __version__ = "1.20.1"
@@ -24,7 +24,7 @@ try:
24
24
  except ImportError:
25
25
  from ucollections import OrderedDict # type: ignore
26
26
 
27
- __version__ = "v1.20.0"
27
+ __version__ = "v1.20.1"
28
28
  ENOENT = 2
29
29
  _MAX_CLASS_LEVEL = 2 # Max class nesting
30
30
  LIBS = ["lib", "/lib", "/sd/lib", "/flash/lib", "."]
@@ -596,10 +596,10 @@ def _info(): # type:() -> dict[str, str]
596
596
  if (
597
597
  info["version"]
598
598
  and info["version"].endswith(".0")
599
- and info["version"] >= "1.10.0" # versions from 1.10.0 to 1.20.0 do not have a micro .0
599
+ and info["version"] >= "1.10.0" # versions from 1.10.0 to 1.20.1 do not have a micro .0
600
600
  and info["version"] <= "1.19.9"
601
601
  ):
602
- # versions from 1.10.0 to 1.20.0 do not have a micro .0
602
+ # versions from 1.10.0 to 1.20.1 do not have a micro .0
603
603
  info["version"] = info["version"][:-2]
604
604
 
605
605
  # spell-checker: disable
@@ -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.20.0
21
+ This variant was generated from createstubs.py by micropython-stubber v1.20.1
22
22
  """
23
23
 
24
24
  # Copyright (c) 2019-2024 Jos Verlinde
@@ -43,7 +43,7 @@ try:
43
43
  except ImportError:
44
44
  from ucollections import OrderedDict # type: ignore
45
45
 
46
- __version__ = "v1.20.0"
46
+ __version__ = "v1.20.1"
47
47
  ENOENT = 2
48
48
  _MAX_CLASS_LEVEL = 2 # Max class nesting
49
49
  LIBS = ["lib", "/lib", "/sd/lib", "/flash/lib", "."]
@@ -609,10 +609,10 @@ def _info(): # type:() -> dict[str, str]
609
609
  if (
610
610
  info["version"]
611
611
  and info["version"].endswith(".0")
612
- and info["version"] >= "1.10.0" # versions from 1.10.0 to 1.20.0 do not have a micro .0
612
+ and info["version"] >= "1.10.0" # versions from 1.10.0 to 1.20.1 do not have a micro .0
613
613
  and info["version"] <= "1.19.9"
614
614
  ):
615
- # versions from 1.10.0 to 1.20.0 do not have a micro .0
615
+ # versions from 1.10.0 to 1.20.1 do not have a micro .0
616
616
  info["version"] = info["version"][:-2]
617
617
 
618
618
  # spell-checker: disable