aboutsummaryrefslogtreecommitdiff
path: root/flang/docs
diff options
context:
space:
mode:
authorTobias Hieta <tobias@hieta.se>2023-05-17 16:59:41 +0200
committerTobias Hieta <tobias@hieta.se>2023-05-25 11:17:05 +0200
commitf98ee40f4b5d7474fc67e82824bf6abbaedb7b1c (patch)
tree98a310ca2d529f568804993c98d6a301f9f2886e /flang/docs
parent35ea4e2dbf32b338c14a2facfc603812e78c8239 (diff)
downloadllvm-f98ee40f4b5d7474fc67e82824bf6abbaedb7b1c.zip
llvm-f98ee40f4b5d7474fc67e82824bf6abbaedb7b1c.tar.gz
llvm-f98ee40f4b5d7474fc67e82824bf6abbaedb7b1c.tar.bz2
[NFC][Py Reformat] Reformat python files in the rest of the dirs
This is an ongoing series of commits that are reformatting our Python code. This catches the last of the python files to reformat. Since they where so few I bunched them together. Reformatting is done with `black`. If you end up having problems merging this commit because you have made changes to a python file, the best way to handle that is to run git checkout --ours <yourfile> and then reformat it with black. If you run into any problems, post to discourse about it and we will try to help. RFC Thread below: https://discourse.llvm.org/t/rfc-document-and-standardize-python-code-style Reviewed By: jhenderson, #libc, Mordante, sivachandra Differential Revision: https://reviews.llvm.org/D150784
Diffstat (limited to 'flang/docs')
-rw-r--r--flang/docs/FIR/CreateFIRLangRef.py10
-rw-r--r--flang/docs/conf.py214
2 files changed, 114 insertions, 110 deletions
diff --git a/flang/docs/FIR/CreateFIRLangRef.py b/flang/docs/FIR/CreateFIRLangRef.py
index d616717..b607736 100644
--- a/flang/docs/FIR/CreateFIRLangRef.py
+++ b/flang/docs/FIR/CreateFIRLangRef.py
@@ -4,16 +4,16 @@
import os
# These paths are relative to flang/docs in the build directory, not source, as that's where this tool is executed.
-HEADER_PATH = os.path.join('Source', 'FIR', 'FIRLangRef_Header.md')
-DOCS_PATH = os.path.join('Dialect', 'FIRLangRef.md')
-OUTPUT_PATH = os.path.join('Source', 'FIRLangRef.md')
+HEADER_PATH = os.path.join("Source", "FIR", "FIRLangRef_Header.md")
+DOCS_PATH = os.path.join("Dialect", "FIRLangRef.md")
+OUTPUT_PATH = os.path.join("Source", "FIRLangRef.md")
# 1. Writes line 1 from docs to output, (comment line that the file is autogenerated)
# 2. Adds a new line
# 3. Writes the entire header to the output file
# 4. Writes the remainder of docs to the output file
-with open(OUTPUT_PATH, 'w') as output:
- with open(HEADER_PATH, 'r') as header, open(DOCS_PATH, 'r') as docs:
+with open(OUTPUT_PATH, "w") as output:
+ with open(HEADER_PATH, "r") as header, open(DOCS_PATH, "r") as docs:
output.write(docs.readline())
output.write("\n")
output.write(header.read())
diff --git a/flang/docs/conf.py b/flang/docs/conf.py
index 7ad2915..117cd1f 100644
--- a/flang/docs/conf.py
+++ b/flang/docs/conf.py
@@ -16,76 +16,79 @@ from recommonmark.parser import CommonMarkParser
# 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('.'))
# -- General configuration -----------------------------------------------------
# https://github.com/readthedocs/recommonmark/issues/177
-#Method used to remove the warning message.
+# Method used to remove the warning message.
class CustomCommonMarkParser(CommonMarkParser):
def visit_document(self, node):
pass
# 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.todo', 'sphinx.ext.mathjax', 'sphinx.ext.intersphinx']
+extensions = ["sphinx.ext.todo", "sphinx.ext.mathjax", "sphinx.ext.intersphinx"]
# 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': 'restructuredtext',
+ ".rst": "restructuredtext",
}
try:
- import recommonmark
+ import recommonmark
except ImportError:
- # manpages do not use any .md sources
- if not tags.has('builder-man'):
- raise
+ # manpages do not use any .md sources
+ if not tags.has("builder-man"):
+ raise
else:
- import sphinx
- if sphinx.version_info >= (3, 0):
- # This requires 0.5 or later.
- extensions.append('recommonmark')
- else:
- source_parsers = {'.md': CustomCommonMarkParser}
- source_suffix['.md'] = 'markdown'
- extensions.append('sphinx_markdown_tables')
-
- # Setup AutoStructify for inline .rst toctrees in index.md
- from recommonmark.transform import AutoStructify
-
- # Stolen from https://github.com/readthedocs/recommonmark/issues/93
- # Monkey patch to fix recommonmark 0.4 doc reference issues.
- from recommonmark.states import DummyStateMachine
- orig_run_role = DummyStateMachine.run_role
- def run_role(self, name, options=None, content=None):
- if name == 'doc':
- name = 'any'
- return orig_run_role(self, name, options, content)
- DummyStateMachine.run_role = run_role
-
- def setup(app):
- # Disable inline math to avoid
- # https://github.com/readthedocs/recommonmark/issues/120 in Extensions.md
- app.add_config_value('recommonmark_config', {
- 'enable_inline_math': False
- }, True)
- app.add_transform(AutoStructify)
+ import sphinx
+
+ if sphinx.version_info >= (3, 0):
+ # This requires 0.5 or later.
+ extensions.append("recommonmark")
+ else:
+ source_parsers = {".md": CustomCommonMarkParser}
+ source_suffix[".md"] = "markdown"
+ extensions.append("sphinx_markdown_tables")
+
+ # Setup AutoStructify for inline .rst toctrees in index.md
+ from recommonmark.transform import AutoStructify
+
+ # Stolen from https://github.com/readthedocs/recommonmark/issues/93
+ # Monkey patch to fix recommonmark 0.4 doc reference issues.
+ from recommonmark.states import DummyStateMachine
+
+ orig_run_role = DummyStateMachine.run_role
+
+ def run_role(self, name, options=None, content=None):
+ if name == "doc":
+ name = "any"
+ return orig_run_role(self, name, options, content)
+
+ DummyStateMachine.run_role = run_role
+
+ def setup(app):
+ # Disable inline math to avoid
+ # https://github.com/readthedocs/recommonmark/issues/120 in Extensions.md
+ app.add_config_value("recommonmark_config", {"enable_inline_math": False}, True)
+ app.add_transform(AutoStructify)
+
# 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 = u'Flang'
-copyright = u'2017-%d, The Flang Team' % date.today().year
+project = "Flang"
+copyright = "2017-%d, The Flang Team" % date.today().year
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
@@ -94,138 +97,136 @@ copyright = u'2017-%d, The Flang Team' % date.today().year
# everytime a new release comes out.
#
# The short version.
-#version = '0'
+# version = '0'
# The full version, including alpha/beta/rc tags.
-#release = '0'
+# release = '0'
# 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', 'analyzer']
+exclude_patterns = ["_build", "analyzer"]
# The reST default role (used for this markup: `text`) to use for all documents.
-#default_role = None
+# default_role = None
# 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 = 'friendly'
+pygments_style = "friendly"
# A list of ignored prefixes for module index sorting.
-#modindex_common_prefix = []
+# modindex_common_prefix = []
# -- Options for HTML output ---------------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
-html_theme = 'llvm-theme'
+html_theme = "llvm-theme"
# 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 = { "nosidebar": False }
+html_theme_options = {"nosidebar": False}
# Add any paths that contain custom themes here, relative to this directory.
html_theme_path = ["_themes"]
# Add any paths that contain custom themes here, relative to this directory.
-#html_theme_path = []
+# html_theme_path = []
# The name for this set of Sphinx documents. If None, it defaults to
# "<project> v<release> documentation".
-html_title = 'The Flang Compiler'
+html_title = "The Flang Compiler"
# 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 = None
+# html_logo = None
# 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 = None
+# html_favicon = None
# 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"]
html_context = {
- 'css_files': [
- '_static/llvm.css'
- ],
- }
+ "css_files": ["_static/llvm.css"],
+}
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format.
-html_last_updated_fmt = '%b %d, %Y'
+html_last_updated_fmt = "%b %d, %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 = {
- '**': [
- 'indexsidebar.html',
- 'searchbox.html',
+ "**": [
+ "indexsidebar.html",
+ "searchbox.html",
]
}
# Additional templates that should be rendered to pages, maps page names to
# template names.
-#html_additional_pages = {}
+# html_additional_pages = {}
# 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 = 'Flangdoc'
+htmlhelp_basename = "Flangdoc"
# If true, the reST sources are included in the HTML build as
# _sources/name. The default is True.
@@ -234,42 +235,39 @@ html_copy_source = False
# -- 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': '',
+ # The paper size ('letterpaper' or 'a4paper').
+ #'papersize': 'letterpaper',
+ # The font size ('10pt', '11pt' or '12pt').
+ #'pointsize': '10pt',
+ # Additional stuff for the LaTeX preamble.
+ #'preamble': '',
}
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass [howto/manual]).
latex_documents = [
- ('Overview', 'Flang.tex', u'Flang Documentation',
- u'The Flang Team', 'manual'),
+ ("Overview", "Flang.tex", "Flang Documentation", "The Flang Team", "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
# -- Options for manual page output --------------------------------------------
@@ -279,7 +277,7 @@ latex_documents = [
man_pages = []
# If true, show URL addresses after external links.
-#man_show_urls = False
+# man_show_urls = False
# -- Options for Texinfo output ------------------------------------------------
@@ -288,16 +286,22 @@ man_pages = []
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
- ('Overview', 'Flang', u'Flang Documentation',
- u'The Flang Team', 'Flang', 'A Fortran front end for LLVM.',
- 'Miscellaneous'),
+ (
+ "Overview",
+ "Flang",
+ "Flang Documentation",
+ "The Flang Team",
+ "Flang",
+ "A Fortran front end for LLVM.",
+ "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'