Skip to content

Commit eaab299

Browse files
committed
chore: update VSCode formatter and refactor build script for consistency
1 parent 25a8253 commit eaab299

File tree

2 files changed

+22
-15
lines changed

2 files changed

+22
-15
lines changed

.vscode/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@
102102
"python.analysis.diagnosticMode": "openFilesOnly",
103103
"python.languageServer": "Pylance",
104104
"[python]": {
105-
"editor.defaultFormatter": "ms-python.black-formatter"
105+
"editor.defaultFormatter": "charliermarsh.ruff"
106106
},
107107
"python.formatting.provider": "none",
108108
"python.analysis.supportRestructuredText": true,

publish/micropython-stdlib-stubs/build.py

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""
2-
Update the micropython-stlib-stubs
3-
- based on typeshed
2+
Update the micropython-stlib-stubs
3+
- based on typeshed
44
- merged with (some) micropython documentation.`
55
66
"""
@@ -16,7 +16,7 @@
1616
import rich_click as click
1717
from loguru import logger as log
1818
from mpflash.versions import clean_version, get_stable_mp_version
19-
from stubber.codemod.enrich import enrich_folder, enrich_file
19+
from stubber.codemod.enrich import enrich_file, enrich_folder
2020
from stubber.modcat import STDLIB_ONLY_MODULES
2121
from stubber.utils import do_post_processing
2222
from stubber.utils.config import readconfig
@@ -75,7 +75,6 @@
7575
"json/decoder.pyi",
7676
"json/encoder.pyi",
7777
"json/tool.pyi",
78-
7978
]
8079

8180

@@ -137,10 +136,16 @@
137136
# this is for things such as function or classdefs that extend beyond a single line
138137
CHANGE_LINES = [
139138
("ssl", [("def create_default_context", "def __mpy_has_no_create_default_context")]),
140-
("sys", [
141-
("def atexit(", "def __mpy_has_no_atexit("),
142-
("implementation: _implementation", "implementation: _mp_implementation"),
143-
]),
139+
(
140+
"sys",
141+
[
142+
("def atexit(", "def __mpy_has_no_atexit("),
143+
(
144+
"implementation: _implementation",
145+
"implementation: _mp_implementation",
146+
), # TODO : simplify by merging attribute types.
147+
],
148+
),
144149
]
145150

146151

@@ -283,9 +288,12 @@ def change_lines(folder: Path):
283288
n += 1
284289
f.write(line)
285290

286-
def update_typing_pyi(dist_stdlib_path: Path, ):
291+
292+
def update_typing_pyi(
293+
dist_stdlib_path: Path,
294+
):
287295
"""
288-
patch updates into typing.pyi
296+
patch updates into typing.pyi
289297
- allow IO.write(bytes) overload
290298
"""
291299
tsk = enrich_file(
@@ -369,8 +377,8 @@ def merge_docstubs_into_stdlib(
369377
Boost("io"),
370378
Boost("array"),
371379
# evaluating
372-
# Boost("tls"), # -- MicroPython only - does not exists in stdlib
373-
Boost("socket"), # not available in all boards ...
380+
# Boost("tls"), # -- MicroPython only - does not exists in stdlib
381+
Boost("socket"), # not available in all boards ...
374382
Boost("json"),
375383
Boost("struct"),
376384
Boost("builtins"),
@@ -533,7 +541,7 @@ def update(
533541
# TODO
534542
# clone typeshed if needed and switch to the correct hash
535543
print("in the repos folder run:")
536-
print("git clone https://github.com/python/typeshed.git\n" "cd typeshed\n" "git checkout <commit-hash>")
544+
print("git clone https://github.com/python/typeshed.git\ncd typeshed\ngit checkout <commit-hash>")
537545
log.warning("Not implemented yet")
538546

539547
if typeshed:
@@ -579,5 +587,4 @@ def update(
579587

580588

581589
if __name__ == "__main__":
582-
583590
update()

0 commit comments

Comments
 (0)