summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xdocs/conf.py193
-rw-r--r--docs/readthedocs/settings/local_settings.py7
-rw-r--r--ports/rp2/modules/rp2.py2
-rw-r--r--ports/stm32/boards/NUCLEO_WB55/rfcore_debug.py9
-rwxr-xr-xshared/memzip/make-memzip.py62
-rw-r--r--tests/misc/rge_sm.py4
-rw-r--r--tools/mpremote/mpremote/transport_serial.py2
-rwxr-xr-xtools/mpy-tool.py10
-rwxr-xr-xtools/pyboard.py2
9 files changed, 160 insertions, 131 deletions
diff --git a/docs/conf.py b/docs/conf.py
index 49ddd22be..728e3c428 100755
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -19,58 +19,56 @@ import os
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
-sys.path.insert(0, os.path.abspath('.'))
+sys.path.insert(0, os.path.abspath("."))
# The MICROPY_VERSION env var should be "vX.Y.Z" (or unset).
-micropy_version = os.getenv('MICROPY_VERSION') or 'latest'
-micropy_all_versions = (os.getenv('MICROPY_ALL_VERSIONS') or 'latest').split(',')
-url_pattern = '%s/en/%%s' % (os.getenv('MICROPY_URL_PREFIX') or '/',)
+micropy_version = os.getenv("MICROPY_VERSION") or "latest"
+micropy_all_versions = (os.getenv("MICROPY_ALL_VERSIONS") or "latest").split(",")
+url_pattern = "%s/en/%%s" % (os.getenv("MICROPY_URL_PREFIX") or "/",)
# The members of the html_context dict are available inside topindex.html
html_context = {
- 'cur_version':micropy_version,
- 'all_versions':[
- (ver, url_pattern % ver) for ver in micropy_all_versions
+ "cur_version": micropy_version,
+ "all_versions": [(ver, url_pattern % ver) for ver in micropy_all_versions],
+ "downloads": [
+ ("PDF", url_pattern % micropy_version + "/micropython-docs.pdf"),
],
- 'downloads':[
- ('PDF', url_pattern % micropy_version + '/micropython-docs.pdf'),
- ],
- 'is_release': micropy_version != 'latest',
+ "is_release": micropy_version != "latest",
}
# -- General configuration ------------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here.
-#needs_sphinx = '1.0'
+# needs_sphinx = '1.0'
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
- 'sphinx.ext.autodoc',
- 'sphinx.ext.doctest',
- 'sphinx.ext.intersphinx',
- 'sphinx.ext.todo',
- 'sphinx.ext.coverage',
- 'sphinxcontrib.jquery',
+ "sphinx.ext.autodoc",
+ "sphinx.ext.doctest",
+ "sphinx.ext.intersphinx",
+ "sphinx.ext.todo",
+ "sphinx.ext.coverage",
+ "sphinxcontrib.jquery",
]
# Add any paths that contain templates here, relative to this directory.
-templates_path = ['templates']
+templates_path = ["templates"]
# The suffix of source filenames.
-source_suffix = '.rst'
+source_suffix = ".rst"
# The encoding of source files.
-#source_encoding = 'utf-8-sig'
+# source_encoding = 'utf-8-sig'
# The master toctree document.
-master_doc = 'index'
+master_doc = "index"
# General information about the project.
-project = 'MicroPython'
-copyright = '- The MicroPython Documentation is Copyright © 2014-2023, Damien P. George, Paul Sokolovsky, and contributors'
+project = "MicroPython"
+copyright = "- The MicroPython Documentation is Copyright © 2014-2023, Damien P. George, Paul Sokolovsky, and contributors"
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
@@ -82,41 +80,41 @@ version = release = micropy_version
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
-#language = None
+# language = None
# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
-#today = ''
+# today = ''
# Else, today_fmt is used as the format for a strftime call.
-#today_fmt = '%B %d, %Y'
+# today_fmt = '%B %d, %Y'
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
-exclude_patterns = ['build', '.venv']
+exclude_patterns = ["build", ".venv"]
# The reST default role (used for this markup: `text`) to use for all
# documents.
-default_role = 'any'
+default_role = "any"
# If true, '()' will be appended to :func: etc. cross-reference text.
-#add_function_parentheses = True
+# add_function_parentheses = True
# If true, the current module name will be prepended to all description
# unit titles (such as .. function::).
-#add_module_names = True
+# add_module_names = True
# If true, sectionauthor and moduleauthor directives will be shown in the
# output. They are ignored by default.
-#show_authors = False
+# show_authors = False
# The name of the Pygments (syntax highlighting) style to use.
-pygments_style = 'sphinx'
+pygments_style = "sphinx"
# A list of ignored prefixes for module index sorting.
-#modindex_common_prefix = []
+# modindex_common_prefix = []
# If true, keep warnings as "system message" paragraphs in the built documents.
-#keep_warnings = False
+# keep_warnings = False
# Global include files. Sphinx docs suggest using rst_epilog in preference
# of rst_prolog, so we follow. Absolute paths below mean "from the base
@@ -128,144 +126,148 @@ rst_epilog = """
# -- Options for HTML output ----------------------------------------------
# on_rtd is whether we are on readthedocs.org
-on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
+on_rtd = os.environ.get("READTHEDOCS", None) == "True"
if not on_rtd: # only import and set the theme if we're building docs locally
try:
import sphinx_rtd_theme
- html_theme = 'sphinx_rtd_theme'
- html_theme_path = [sphinx_rtd_theme.get_html_theme_path(), '.']
+
+ html_theme = "sphinx_rtd_theme"
+ html_theme_path = [sphinx_rtd_theme.get_html_theme_path(), "."]
except:
- html_theme = 'default'
- html_theme_path = ['.']
+ html_theme = "default"
+ html_theme_path = ["."]
else:
- html_theme_path = ['.']
+ html_theme_path = ["."]
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
-#html_theme_options = {}
+# html_theme_options = {}
# Add any paths that contain custom themes here, relative to this directory.
# html_theme_path = ['.']
# The name for this set of Sphinx documents. If None, it defaults to
# "<project> v<release> documentation".
-#html_title = None
+# html_title = None
# A shorter title for the navigation bar. Default is the same as html_title.
-#html_short_title = None
+# html_short_title = None
# The name of an image file (relative to this directory) to place at the top
# of the sidebar.
-#html_logo = '../../logo/trans-logo.png'
+# html_logo = '../../logo/trans-logo.png'
# The name of an image file (within the static path) to use as favicon of the
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
# pixels large.
-html_favicon = 'static/favicon.ico'
+html_favicon = "static/favicon.ico"
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
-html_static_path = ['static']
+html_static_path = ["static"]
# Add a custom CSS file for HTML generation
html_css_files = [
- 'custom.css',
+ "custom.css",
]
# Add any extra paths that contain custom files (such as robots.txt or
# .htaccess) here, relative to this directory. These files are copied
# directly to the root of the documentation.
-#html_extra_path = []
+# html_extra_path = []
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format.
-html_last_updated_fmt = '%d %b %Y'
+html_last_updated_fmt = "%d %b %Y"
# If true, SmartyPants will be used to convert quotes and dashes to
# typographically correct entities.
-#html_use_smartypants = True
+# html_use_smartypants = True
# Custom sidebar templates, maps document names to template names.
-#html_sidebars = {}
+# html_sidebars = {}
# Additional templates that should be rendered to pages, maps page names to
# template names.
html_additional_pages = {"index": "topindex.html"}
# If false, no module index is generated.
-#html_domain_indices = True
+# html_domain_indices = True
# If false, no index is generated.
-#html_use_index = True
+# html_use_index = True
# If true, the index is split into individual pages for each letter.
-#html_split_index = False
+# html_split_index = False
# If true, links to the reST sources are added to the pages.
-#html_show_sourcelink = True
+# html_show_sourcelink = True
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
-#html_show_sphinx = True
+# html_show_sphinx = True
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
-#html_show_copyright = True
+# html_show_copyright = True
# If true, an OpenSearch description file will be output, and all pages will
# contain a <link> tag referring to it. The value of this option must be the
# base URL from which the finished HTML is served.
-#html_use_opensearch = ''
+# html_use_opensearch = ''
# This is the file name suffix for HTML files (e.g. ".xhtml").
-#html_file_suffix = None
+# html_file_suffix = None
# Output file base name for HTML help builder.
-htmlhelp_basename = 'MicroPythondoc'
+htmlhelp_basename = "MicroPythondoc"
# -- Options for LaTeX output ---------------------------------------------
latex_elements = {
-# The paper size ('letterpaper' or 'a4paper').
-#'papersize': 'letterpaper',
-
-# The font size ('10pt', '11pt' or '12pt').
-#'pointsize': '10pt',
-
-# Additional stuff for the LaTeX preamble.
-#'preamble': '',
-# Include 3 levels of headers in PDF ToC
-'preamble': r'\setcounter{tocdepth}{2}',
+ # The paper size ('letterpaper' or 'a4paper').
+ #'papersize': 'letterpaper',
+ # The font size ('10pt', '11pt' or '12pt').
+ #'pointsize': '10pt',
+ # Additional stuff for the LaTeX preamble.
+ #'preamble': '',
+ # Include 3 levels of headers in PDF ToC
+ "preamble": r"\setcounter{tocdepth}{2}",
}
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
- (master_doc, 'MicroPython.tex', 'MicroPython Documentation',
- 'Damien P. George, Paul Sokolovsky, and contributors', 'manual'),
+ (
+ master_doc,
+ "MicroPython.tex",
+ "MicroPython Documentation",
+ "Damien P. George, Paul Sokolovsky, and contributors",
+ "manual",
+ ),
]
# The name of an image file (relative to this directory) to place at the top of
# the title page.
-#latex_logo = None
+# latex_logo = None
# For "manual" documents, if this is true, then toplevel headings are parts,
# not chapters.
-#latex_use_parts = False
+# latex_use_parts = False
# If true, show page references after internal links.
-#latex_show_pagerefs = False
+# latex_show_pagerefs = False
# If true, show URL addresses after external links.
-#latex_show_urls = False
+# latex_show_urls = False
# Documents to append as an appendix to all manuals.
-#latex_appendices = []
+# latex_appendices = []
# If false, no module index is generated.
-#latex_domain_indices = True
+# latex_domain_indices = True
# Enable better Unicode support so that `make latexpdf` doesn't fail
latex_engine = "xelatex"
@@ -275,12 +277,17 @@ latex_engine = "xelatex"
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
- ('index', 'micropython', 'MicroPython Documentation',
- ['Damien P. George, Paul Sokolovsky, and contributors'], 1),
+ (
+ "index",
+ "micropython",
+ "MicroPython Documentation",
+ ["Damien P. George, Paul Sokolovsky, and contributors"],
+ 1,
+ ),
]
# If true, show URL addresses after external links.
-#man_show_urls = False
+# man_show_urls = False
# -- Options for Texinfo output -------------------------------------------
@@ -289,23 +296,29 @@ man_pages = [
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
- (master_doc, 'MicroPython', 'MicroPython Documentation',
- 'Damien P. George, Paul Sokolovsky, and contributors', 'MicroPython', 'One line description of project.',
- 'Miscellaneous'),
+ (
+ master_doc,
+ "MicroPython",
+ "MicroPython Documentation",
+ "Damien P. George, Paul Sokolovsky, and contributors",
+ "MicroPython",
+ "One line description of project.",
+ "Miscellaneous",
+ ),
]
# Documents to append as an appendix to all manuals.
-#texinfo_appendices = []
+# texinfo_appendices = []
# If false, no module index is generated.
-#texinfo_domain_indices = True
+# texinfo_domain_indices = True
# How to display URL addresses: 'footnote', 'no', or 'inline'.
-#texinfo_show_urls = 'footnote'
+# texinfo_show_urls = 'footnote'
# If true, do not generate a @detailmenu in the "Top" node's menu.
-#texinfo_no_detailmenu = False
+# texinfo_no_detailmenu = False
# Example configuration for intersphinx: refer to the Python standard library.
-intersphinx_mapping = {'python': ('https://docs.python.org/3.5', None)}
+intersphinx_mapping = {"python": ("https://docs.python.org/3.5", None)}
diff --git a/docs/readthedocs/settings/local_settings.py b/docs/readthedocs/settings/local_settings.py
index 8d2bac7a7..c6145dcc5 100644
--- a/docs/readthedocs/settings/local_settings.py
+++ b/docs/readthedocs/settings/local_settings.py
@@ -1,9 +1,10 @@
import os
# Directory that the project lives in, aka ../..
-SITE_ROOT = '/'.join(os.path.dirname(__file__).split('/')[0:-2])
+SITE_ROOT = "/".join(os.path.dirname(__file__).split("/")[0:-2])
TEMPLATE_DIRS = (
- "%s/templates/" % SITE_ROOT, # Your custom template directory, before the RTD one to override it.
- "%s/readthedocs/templates/" % SITE_ROOT, # Default RTD template dir
+ "%s/templates/"
+ % SITE_ROOT, # Your custom template directory, before the RTD one to override it.
+ "%s/readthedocs/templates/" % SITE_ROOT, # Default RTD template dir
)
diff --git a/ports/rp2/modules/rp2.py b/ports/rp2/modules/rp2.py
index a34e8e92a..9d13bf1b5 100644
--- a/ports/rp2/modules/rp2.py
+++ b/ports/rp2/modules/rp2.py
@@ -32,7 +32,7 @@ class PIOASMEmit:
autopull=False,
push_thresh=32,
pull_thresh=32,
- fifo_join=0
+ fifo_join=0,
):
# array is a built-in module so importing it here won't require
# scanning the filesystem.
diff --git a/ports/stm32/boards/NUCLEO_WB55/rfcore_debug.py b/ports/stm32/boards/NUCLEO_WB55/rfcore_debug.py
index db533f18d..ccf770c01 100644
--- a/ports/stm32/boards/NUCLEO_WB55/rfcore_debug.py
+++ b/ports/stm32/boards/NUCLEO_WB55/rfcore_debug.py
@@ -114,7 +114,14 @@ def ipcc_init():
SYS_CMD_BUF = get_ipcc_table_word(TABLE_SYS, 0)
SYS_SYS_QUEUE = get_ipcc_table_word(TABLE_SYS, 1)
- global MM_BLE_SPARE_EVT_BUF, MM_SYS_SPARE_EVT_BUF, MM_BLE_POOL, MM_BLE_POOL_SIZE, MM_FREE_BUF_QUEUE, MM_EV_POOL, MM_EV_POOL_SIZE
+ global \
+ MM_BLE_SPARE_EVT_BUF, \
+ MM_SYS_SPARE_EVT_BUF, \
+ MM_BLE_POOL, \
+ MM_BLE_POOL_SIZE, \
+ MM_FREE_BUF_QUEUE, \
+ MM_EV_POOL, \
+ MM_EV_POOL_SIZE
MM_BLE_SPARE_EVT_BUF = get_ipcc_table_word(TABLE_MEM_MANAGER, 0)
MM_SYS_SPARE_EVT_BUF = get_ipcc_table_word(TABLE_MEM_MANAGER, 1)
MM_BLE_POOL = get_ipcc_table_word(TABLE_MEM_MANAGER, 2)
diff --git a/shared/memzip/make-memzip.py b/shared/memzip/make-memzip.py
index cc0df8207..92a5d6168 100755
--- a/shared/memzip/make-memzip.py
+++ b/shared/memzip/make-memzip.py
@@ -15,65 +15,67 @@ import subprocess
import sys
import types
+
def create_zip(zip_filename, zip_dir):
abs_zip_filename = os.path.abspath(zip_filename)
save_cwd = os.getcwd()
os.chdir(zip_dir)
if os.path.exists(abs_zip_filename):
os.remove(abs_zip_filename)
- subprocess.check_call(['zip', '-0', '-r', '-D', abs_zip_filename, '.'])
+ subprocess.check_call(["zip", "-0", "-r", "-D", abs_zip_filename, "."])
os.chdir(save_cwd)
+
def create_c_from_file(c_filename, zip_filename):
- with open(zip_filename, 'rb') as zip_file:
- with open(c_filename, 'wb') as c_file:
- print('#include <stdint.h>', file=c_file)
- print('', file=c_file)
- print('const uint8_t memzip_data[] = {', file=c_file)
+ with open(zip_filename, "rb") as zip_file:
+ with open(c_filename, "wb") as c_file:
+ print("#include <stdint.h>", file=c_file)
+ print("", file=c_file)
+ print("const uint8_t memzip_data[] = {", file=c_file)
while True:
buf = zip_file.read(16)
if not buf:
break
- print(' ', end='', file=c_file)
+ print(" ", end="", file=c_file)
for byte in buf:
if isinstance(byte, types.StringType):
- print(' 0x{:02x},'.format(ord(byte)), end='', file=c_file)
+ print(" 0x{:02x},".format(ord(byte)), end="", file=c_file)
else:
- print(' 0x{:02x},'.format(byte), end='', file=c_file)
- print('', file=c_file)
- print('};', file=c_file)
+ print(" 0x{:02x},".format(byte), end="", file=c_file)
+ print("", file=c_file)
+ print("};", file=c_file)
+
def main():
parser = argparse.ArgumentParser(
- prog='make-memzip.py',
- usage='%(prog)s [options] [command]',
- description='Generates a C source memzip file.'
+ prog="make-memzip.py",
+ usage="%(prog)s [options] [command]",
+ description="Generates a C source memzip file.",
)
parser.add_argument(
- '-z', '--zip-file',
- dest='zip_filename',
- help='Specifies the name of the created zip file.',
- default='memzip_files.zip'
+ "-z",
+ "--zip-file",
+ dest="zip_filename",
+ help="Specifies the name of the created zip file.",
+ default="memzip_files.zip",
)
parser.add_argument(
- '-c', '--c-file',
- dest='c_filename',
- help='Specifies the name of the created C source file.',
- default='memzip_files.c'
- )
- parser.add_argument(
- dest='source_dir',
- default='memzip_files'
+ "-c",
+ "--c-file",
+ dest="c_filename",
+ help="Specifies the name of the created C source file.",
+ default="memzip_files.c",
)
+ parser.add_argument(dest="source_dir", default="memzip_files")
args = parser.parse_args(sys.argv[1:])
- print('args.zip_filename =', args.zip_filename)
- print('args.c_filename =', args.c_filename)
- print('args.source_dir =', args.source_dir)
+ print("args.zip_filename =", args.zip_filename)
+ print("args.c_filename =", args.c_filename)
+ print("args.source_dir =", args.source_dir)
create_zip(args.zip_filename, args.source_dir)
create_c_from_file(args.c_filename, args.zip_filename)
+
if __name__ == "__main__":
main()
-
diff --git a/tests/misc/rge_sm.py b/tests/misc/rge_sm.py
index 00b0a7a02..5e071687c 100644
--- a/tests/misc/rge_sm.py
+++ b/tests/misc/rge_sm.py
@@ -136,6 +136,4 @@ def singleTraj(system, trajStart, h=0.02, tend=1.0):
# phaseDiagram(sysSM, (lambda i, j: [0.354, 0.654, 1.278, 0.8 + 0.2 * i, 0.1 + 0.1 * j]), (lambda a: (a[4], a[5])), h=0.1, tend=math.log(10**17))
# initial conditions at M_Z
-singleTraj(
- sysSM, [0.354, 0.654, 1.278, 0.983, 0.131], h=0.5, tend=math.log(10**17)
-) # true values
+singleTraj(sysSM, [0.354, 0.654, 1.278, 0.983, 0.131], h=0.5, tend=math.log(10**17)) # true values
diff --git a/tools/mpremote/mpremote/transport_serial.py b/tools/mpremote/mpremote/transport_serial.py
index e04f5b4ac..23a379d16 100644
--- a/tools/mpremote/mpremote/transport_serial.py
+++ b/tools/mpremote/mpremote/transport_serial.py
@@ -331,7 +331,7 @@ class SerialTransport(Transport):
def fs_stat(self, src):
try:
self.exec("import os")
- return os.stat_result(self.eval("os.stat(%s)" % (("'%s'" % src)), parse=True))
+ return os.stat_result(self.eval("os.stat(%s)" % ("'%s'" % src), parse=True))
except TransportError as e:
reraise_filesystem_error(e, src)
diff --git a/tools/mpy-tool.py b/tools/mpy-tool.py
index 95b2c492d..8d86c1017 100755
--- a/tools/mpy-tool.py
+++ b/tools/mpy-tool.py
@@ -1454,7 +1454,15 @@ def freeze_mpy(firmware_qstr_idents, compiled_modules):
# As in qstr.c, set so that the first dynamically allocated pool is twice this size; must be <= the len
qstr_pool_alloc = min(len(new), 10)
- global bc_content, const_str_content, const_int_content, const_obj_content, const_table_qstr_content, const_table_ptr_content, raw_code_count, raw_code_content
+ global \
+ bc_content, \
+ const_str_content, \
+ const_int_content, \
+ const_obj_content, \
+ const_table_qstr_content, \
+ const_table_ptr_content, \
+ raw_code_count, \
+ raw_code_content
qstr_content = 0
bc_content = 0
const_str_content = 0
diff --git a/tools/pyboard.py b/tools/pyboard.py
index 723e43c01..c422b64ac 100755
--- a/tools/pyboard.py
+++ b/tools/pyboard.py
@@ -546,7 +546,7 @@ class Pyboard:
def fs_stat(self, src):
try:
self.exec_("import os")
- return os.stat_result(self.eval("os.stat(%s)" % (("'%s'" % src)), parse=True))
+ return os.stat_result(self.eval("os.stat(%s)" % ("'%s'" % src), parse=True))
except PyboardError as e:
raise e.convert(src)