Skip to content

Commit

Permalink
fix busio example; update some scripts for Python 3.12
Browse files Browse the repository at this point in the history
  • Loading branch information
dhalbert committed Nov 7, 2023
1 parent 9e9dff4 commit bfb8304
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
6 changes: 3 additions & 3 deletions docs/shared_bindings_matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ def build_module_map():
search_identifier = ADDITIONAL_MODULES[module]
else:
search_identifier = "CIRCUITPY_" + module.lstrip("_").upper()
re_pattern = f"{re.escape(search_identifier)}\s*\??=\s*(.+)"
re_pattern = fr"{re.escape(search_identifier)}\s*\??=\s*(.+)"
find_config = re.findall(re_pattern, configs)
if not find_config:
continue
Expand Down Expand Up @@ -242,12 +242,12 @@ def get_repository_url(directory):
with open(readme, "r") as fp:
for line in fp.readlines():
if m := re.match(
"\s+:target:\s+(http\S+(docs.circuitpython|readthedocs)\S+)\s*",
r"\s+:target:\s+(http\S+(docs.circuitpython|readthedocs)\S+)\s*",
line,
):
path = m.group(1)
break
if m := re.search("<(http[^>]+)>", line):
if m := re.search(r"<(http[^>]+)>", line):
path = m.group(1)
break
if path is None:
Expand Down
9 changes: 6 additions & 3 deletions shared-bindings/busio/__init__.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,15 @@
//| from board import *
//|
//| i2c = busio.I2C(SCL, SDA)
//| i2c.try_lock()
//| print(i2c.scan())
//| i2c.unlock()
//| i2c.deinit()
//|
//| This example will initialize the the device, run
//| :py:meth:`~busio.I2C.scan` and then :py:meth:`~busio.I2C.deinit` the
//| hardware. The last step is optional because CircuitPython automatically
//| This example will initialize the the device, lock the I2C bus, run
//| :py:meth:`~busio.I2C.scan`, unlock the bus,
//| and then :py:meth:`~busio.I2C.deinit` the hardware.
//| The last step is optional because CircuitPython automatically
//| resets hardware after a program finishes.
//|
//| Note that drivers will typically handle communication if provided the bus
Expand Down
2 changes: 1 addition & 1 deletion tools/build_release_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@
# Flush so we will see something before 10 minutes has passed.
print(flush=True)

if (not build_all) and (language is LANGUAGE_FIRST) and (exit_status is 0):
if (not build_all) and (language == LANGUAGE_FIRST) and (exit_status == 0):
try:
with open(
f"../ports/{board_info['port']}/{build_dir}/firmware.size.json", "r"
Expand Down

0 comments on commit bfb8304

Please sign in to comment.