Skip to content

Commit bb1b172

Browse files
authored
Merge pull request #8 from tannewt/fix_register_in_docs
Mock micropython ourselves so const passes values through unchanged.
2 parents becfa16 + cc20be6 commit bb1b172

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

docs/conf.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,13 @@
1818
# Uncomment the below if you use native CircuitPython modules such as
1919
# digitalio, micropython and busio. List the modules you use. Without it, the
2020
# autodoc module docs will fail to generate with a warning.
21-
autodoc_mock_imports = ["digitalio", "adafruit_register", "adafruit_bus_device", "micropython"]
21+
autodoc_mock_imports = ["digitalio", "adafruit_register", "adafruit_bus_device"]
22+
23+
# Mock out micropython ourselves so that we can make const a lambda.
24+
import imp
25+
m = imp.new_module("micropython")
26+
m.const = lambda x: x
27+
sys.modules["micropython"] = m
2228

2329
intersphinx_mapping = {'python': ('https://docs.python.org/3.4', None),'BusDevice': ('https://circuitpython.readthedocs.io/projects/busdevice/en/latest/', None),'CircuitPython': ('https://circuitpython.readthedocs.io/en/latest/', None)}
2430

0 commit comments

Comments
 (0)