micropython-stubber 1.25.1rc5__py3-none-any.whl → 1.25.1rc6__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: micropython-stubber
3
- Version: 1.25.1rc5
3
+ Version: 1.25.1rc6
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
@@ -25,7 +25,7 @@ Requires-Dist: executing (>=2.0.1,<3.0.0)
25
25
  Requires-Dist: importlib-metadata (>=1,<9) ; python_version < "3.8"
26
26
  Requires-Dist: libcst (>=1.1.0,<2.0.0)
27
27
  Requires-Dist: loguru (>=0.6,<0.8)
28
- Requires-Dist: mpflash (>=1.25.0.rc2)
28
+ Requires-Dist: mpflash (==1.25.0.rc3)
29
29
  Requires-Dist: mpremote (>=1.25.0)
30
30
  Requires-Dist: mpy-cross (>=1.25.0.post2,<2.0.0)
31
31
  Requires-Dist: mypy (>=1.10)
@@ -81,13 +81,13 @@ stubber/publish/pypi.py,sha256=LdvwLfjkkSFBTI4MHyl7Ko_ZWn1SflWxJ9uo2mtPKtc,1272
81
81
  stubber/publish/stubpackage.py,sha256=BOfHqlPNP45cKLI65VANAdO0wO1YN9F1Ks-JbEHUoKQ,47491
82
82
  stubber/rst/__init__.py,sha256=5VcbDCotIICa2xnJDs_gw2sFXpjjGOZZbwCrNKXy1OE,293
83
83
  stubber/rst/classsort.py,sha256=-Uji6LzBbX6voKmiXSuexJXyoQ3fmSDQ7Fuz4j1Kk8E,2655
84
- stubber/rst/lookup.py,sha256=8nnU8MZPMEUKhuZ_tbtV_eh6C7K4A1RN1wemsCodTtw,26003
84
+ stubber/rst/lookup.py,sha256=2s3ZT1pNKddL9cUrIsHzP5yGBi0sIYBikYoMlP9kbKY,26132
85
85
  stubber/rst/output_dict.py,sha256=cpBXRtUD-uh0EgjWIBiRrMLBmIAEXjoJFSOAg-qJQiU,14755
86
- stubber/rst/reader.py,sha256=sNZwEpSG8esBrPvD-gVjtku828XfLNst-earA3XBN1c,35426
86
+ stubber/rst/reader.py,sha256=kCjQpL4QbVyChUQcXO_T1rwaZjE3WUcq9UksQmRq0U8,35408
87
87
  stubber/rst/report_return.py,sha256=p0JfJs_WTWTtRZREcQeqUgDW-_TP2VuuX7k7-c49y5E,3024
88
88
  stubber/rst/rst_utils.py,sha256=-F6J09-WQBzI5419ItzOlm4gUKxF4BMru2OyXx-M6ko,18314
89
89
  stubber/stubber.py,sha256=GxLfHIzDyfFvgiTqMj9DB3tq7I3EnEUNbdoCtYr8gHM,1640
90
- stubber/stubs_from_docs.py,sha256=c19yVRAu7Kv0Vlpoa15obGIzhekisJuIyYwX1lug6-c,3563
90
+ stubber/stubs_from_docs.py,sha256=Z8BFBuUQ1su4MUZTXiHRC4y80c8m9EDHTE7FxD2KUco,3700
91
91
  stubber/tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
92
92
  stubber/tools/manifestfile.py,sha256=YzPMc7PNciLOBpoc4xgUZ38t88C1C8b4fjG0qfWd6K8,25749
93
93
  stubber/tools/readme.md,sha256=uI0higcFUtjSLKobn7NK2LoqZ0BqcbftXSDgNjbsnzo,284
@@ -103,8 +103,8 @@ stubber/utils/repos.py,sha256=kI2VcbKS1sNzFRr8mUDMdKYOYRvxpFIwy7JRyQ5Nxuk,7147
103
103
  stubber/utils/stubmaker.py,sha256=gB6n41o13WcShnSzc_lyoTFplotaPSQ3hekoLJvd2BU,5236
104
104
  stubber/utils/typed_config_toml.py,sha256=ZR7eo-whyL4nhFXj6xs7E121sLuE-ivlUDevII4K2xg,2653
105
105
  stubber/variants.py,sha256=NnwUP-aiGUPAn15BeRRFcBWQUOzAFFnN2oL4u9zio-s,3792
106
- micropython_stubber-1.25.1rc5.dist-info/entry_points.txt,sha256=JoR8NWh8t6pbDyn0WOMCIfRfDQAOGxqbOgJWuxv3Cxw,116
107
- micropython_stubber-1.25.1rc5.dist-info/LICENSE,sha256=Fx9qrL45ayRXgH6QzttboqZEjKXms0w1t_b_nkOqYCU,1572
108
- micropython_stubber-1.25.1rc5.dist-info/METADATA,sha256=W9XaHw71AKTiNNxyP7MZlrGt4o7gL-JHYTKWop_8vsM,19991
109
- micropython_stubber-1.25.1rc5.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
110
- micropython_stubber-1.25.1rc5.dist-info/RECORD,,
106
+ micropython_stubber-1.25.1rc6.dist-info/entry_points.txt,sha256=JoR8NWh8t6pbDyn0WOMCIfRfDQAOGxqbOgJWuxv3Cxw,116
107
+ micropython_stubber-1.25.1rc6.dist-info/LICENSE,sha256=Fx9qrL45ayRXgH6QzttboqZEjKXms0w1t_b_nkOqYCU,1572
108
+ micropython_stubber-1.25.1rc6.dist-info/METADATA,sha256=qA_2AM7mz93FfhRoTIEMoi0M8yvgtqo0oh5ne7l2rFk,19991
109
+ micropython_stubber-1.25.1rc6.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
110
+ micropython_stubber-1.25.1rc6.dist-info/RECORD,,
stubber/rst/lookup.py CHANGED
@@ -445,6 +445,12 @@ PARAM_FIXES = [
445
445
  "(ip, subnet, gateway, dns):Optional[Any]=None",
446
446
  "configtuple: Optional[Tuple]",
447
447
  ),
448
+ # network.ipconfig
449
+ Fix(
450
+ "param=value",
451
+ "param:Optional[str]=None",
452
+ name="ipconfig",
453
+ ),
448
454
  # framebuffer
449
455
  # unresolvable parameter defaults # FrameBuffer: def __init__
450
456
  Fix(
stubber/rst/reader.py CHANGED
@@ -69,10 +69,19 @@ from typing import List, Optional, Tuple
69
69
 
70
70
  from mpflash.logger import log
71
71
  from mpflash.versions import V_PREVIEW
72
- from stubber.rst import (CHILD_PARENT_CLASS, MODULE_GLUE, PARAM_FIXES,
73
- PARAM_RE_FIXES, RST_DOC_FIXES, TYPING_IMPORT,
74
- ClassSourceDict, FunctionSourceDict, ModuleSourceDict,
75
- return_type_from_context)
72
+
73
+ from stubber.rst import (
74
+ CHILD_PARENT_CLASS,
75
+ MODULE_GLUE,
76
+ PARAM_FIXES,
77
+ PARAM_RE_FIXES,
78
+ RST_DOC_FIXES,
79
+ TYPING_IMPORT,
80
+ ClassSourceDict,
81
+ FunctionSourceDict,
82
+ ModuleSourceDict,
83
+ return_type_from_context,
84
+ )
76
85
  from stubber.rst.lookup import Fix
77
86
  from stubber.utils.config import CONFIG
78
87
 
@@ -496,8 +505,8 @@ class RSTParser(RSTReader):
496
505
  self.read_file(file_path)
497
506
  self.parse()
498
507
  # reset this file to done
499
- self.rst_text = []
500
- self.line_no = 1
508
+ # self.rst_text = []
509
+ # self.line_no = 1
501
510
 
502
511
  def parse_module(self):
503
512
  "parse a module tag and set the module's docstring"
@@ -78,23 +78,11 @@ def get_rst_sources(rst_path: Path, pattern: str) -> List[Path]:
78
78
  def make_docstubs(
79
79
  dst_path: Path, v_tag: str, release: str, suffix: str, files: List[Path], clean_rst: bool
80
80
  ):
81
- """Create the docstubs"""
81
+ """Create docstubs from the list of rst files"""
82
82
 
83
83
  for file in files:
84
- reader = RSTWriter(v_tag)
85
- reader.clean_rst = clean_rst
86
- reader.source_release = release
87
- log.debug(f"Reading: {file}")
88
- reader.read_file(file)
89
- reader.parse()
90
- # Destination = "module.__init__.pyi"
91
- if "." in file.stem:
92
- target = dst_path / f"{(file.stem).replace('.', '/')}{suffix}"
93
- else:
94
- target = dst_path / file.stem / f"__init__{suffix}"
95
- # fname = (dst_path / file.name).with_suffix(suffix)
96
- reader.write_file(target)
97
- del reader
84
+ make_docstub(file, dst_path, v_tag, release, suffix, clean_rst)
85
+
98
86
  for name in U_MODULES:
99
87
  # create a file "umodule.pyi" for each module
100
88
  # and add a line : from module import *
@@ -107,3 +95,28 @@ def make_docstubs(
107
95
  f.write("# Allow the use of micro-module notation \n\n")
108
96
  f.write(f"from {name} import * # type: ignore\n")
109
97
  f.flush()
98
+
99
+
100
+ def make_docstub(
101
+ file: Path,
102
+ dst_path: Path,
103
+ v_tag: str,
104
+ release: str,
105
+ suffix: str,
106
+ clean_rst: bool,
107
+ ):
108
+ """Create a docstub from a single rst file"""
109
+ reader = RSTWriter(v_tag)
110
+ reader.clean_rst = clean_rst
111
+ reader.source_release = release
112
+ log.debug(f"Reading: {file}")
113
+ reader.read_file(file)
114
+ reader.parse()
115
+
116
+ if "." in file.stem:
117
+ target = dst_path / f"{(file.stem).replace('.', '/')}{suffix}"
118
+ else:
119
+ target = dst_path / file.stem / f"__init__{suffix}"
120
+
121
+ reader.write_file(target)
122
+ del reader