Skip to content

Commit 7bfaa0f

Browse files
committed
[NFC][Py Reformat] Reformat python files in libcxx/libcxxabi
This is an ongoing series of commits that are reformatting our Python code. 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: #libc, kwk, Mordante Differential Revision: https://reviews.llvm.org/D150763
1 parent 2ba1428 commit 7bfaa0f

File tree

65 files changed

+4164
-3063
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+4164
-3063
lines changed

libcxx/benchmarks/lit.cfg.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,21 @@
33
import os
44
import site
55

6-
site.addsitedir(os.path.join(os.path.dirname(os.path.dirname(__file__)), 'utils'))
6+
site.addsitedir(os.path.join(os.path.dirname(os.path.dirname(__file__)), "utils"))
77
from libcxx.test.googlebenchmark import GoogleBenchmark
88

99
# Tell pylint that we know config and lit_config exist somewhere.
10-
if 'PYLINT_IMPORT' in os.environ:
10+
if "PYLINT_IMPORT" in os.environ:
1111
config = object()
1212
lit_config = object()
1313

1414
# name: The name of this test suite.
15-
config.name = 'libc++ benchmarks'
15+
config.name = "libc++ benchmarks"
1616
config.suffixes = []
1717

18-
config.test_exec_root = os.path.join(config.libcxx_obj_root, 'benchmarks')
18+
config.test_exec_root = os.path.join(config.libcxx_obj_root, "benchmarks")
1919
config.test_source_root = config.test_exec_root
2020

21-
config.test_format = GoogleBenchmark(test_sub_dirs='.',
22-
test_suffix='.libcxx.out',
23-
benchmark_args=config.benchmark_args)
21+
config.test_format = GoogleBenchmark(
22+
test_sub_dirs=".", test_suffix=".libcxx.out", benchmark_args=config.benchmark_args
23+
)

libcxx/docs/conf.py

Lines changed: 67 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -16,106 +16,106 @@
1616
# If extensions (or modules to document with autodoc) are in another directory,
1717
# add these directories to sys.path here. If the directory is relative to the
1818
# documentation root, use os.path.abspath to make it absolute, like shown here.
19-
#sys.path.insert(0, os.path.abspath('.'))
19+
# sys.path.insert(0, os.path.abspath('.'))
2020

2121
# -- General configuration -----------------------------------------------------
2222

2323
# If your documentation needs a minimal Sphinx version, state it here.
24-
#needs_sphinx = '1.0'
24+
# needs_sphinx = '1.0'
2525

2626
# Add any Sphinx extension module names here, as strings. They can be extensions
2727
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
28-
extensions = ['sphinx.ext.intersphinx', 'sphinx.ext.todo']
28+
extensions = ["sphinx.ext.intersphinx", "sphinx.ext.todo"]
2929

3030
# Add any paths that contain templates here, relative to this directory.
31-
templates_path = ['_templates']
31+
templates_path = ["_templates"]
3232

3333
# The suffix of source filenames.
34-
source_suffix = '.rst'
34+
source_suffix = ".rst"
3535

3636
# The encoding of source files.
37-
#source_encoding = 'utf-8-sig'
37+
# source_encoding = 'utf-8-sig'
3838

3939
# The master toctree document.
40-
master_doc = 'index'
40+
master_doc = "index"
4141

4242
# General information about the project.
43-
project = u'libc++'
44-
copyright = u'2011-%d, LLVM Project' % date.today().year
43+
project = "libc++"
44+
copyright = "2011-%d, LLVM Project" % date.today().year
4545

4646
# The version info for the project you're documenting, acts as replacement for
4747
# |version| and |release|, also used in various other places throughout the
4848
# built documents.
4949
#
5050
# The short X.Y version.
51-
version = '17.0'
51+
version = "17.0"
5252
# The full version, including alpha/beta/rc tags.
53-
release = '17.0'
53+
release = "17.0"
5454

5555
# The language for content autogenerated by Sphinx. Refer to documentation
5656
# for a list of supported languages.
57-
#language = None
57+
# language = None
5858

5959
# There are two options for replacing |today|: either, you set today to some
6060
# non-false value, then it is used:
61-
#today = ''
61+
# today = ''
6262
# Else, today_fmt is used as the format for a strftime call.
63-
today_fmt = '%Y-%m-%d'
63+
today_fmt = "%Y-%m-%d"
6464

6565
# List of patterns, relative to source directory, that match files and
6666
# directories to ignore when looking for source files.
67-
exclude_patterns = ['_build', 'Helpers']
67+
exclude_patterns = ["_build", "Helpers"]
6868

6969
# The reST default role (used for this markup: `text`) to use for all documents.
70-
#default_role = None
70+
# default_role = None
7171

7272
# If true, '()' will be appended to :func: etc. cross-reference text.
73-
#add_function_parentheses = True
73+
# add_function_parentheses = True
7474

7575
# If true, the current module name will be prepended to all description
7676
# unit titles (such as .. function::).
77-
#add_module_names = True
77+
# add_module_names = True
7878

7979
# If true, sectionauthor and moduleauthor directives will be shown in the
8080
# output. They are ignored by default.
8181
show_authors = True
8282

8383
# The name of the Pygments (syntax highlighting) style to use.
84-
pygments_style = 'friendly'
84+
pygments_style = "friendly"
8585

8686
# A list of ignored prefixes for module index sorting.
87-
#modindex_common_prefix = []
87+
# modindex_common_prefix = []
8888

8989

9090
# -- Options for HTML output ---------------------------------------------------
9191

9292
# The theme to use for HTML and HTML Help pages. See the documentation for
9393
# a list of builtin themes.
94-
html_theme = 'haiku'
94+
html_theme = "haiku"
9595

9696
# Theme options are theme-specific and customize the look and feel of a theme
9797
# further. For a list of options available for each theme, see the
9898
# documentation.
99-
#html_theme_options = {}
99+
# html_theme_options = {}
100100

101101
# Add any paths that contain custom themes here, relative to this directory.
102-
#html_theme_path = []
102+
# html_theme_path = []
103103

104104
# The name for this set of Sphinx documents. If None, it defaults to
105105
# "<project> v<release> documentation".
106-
#html_title = None
106+
# html_title = None
107107

108108
# A shorter title for the navigation bar. Default is the same as html_title.
109-
#html_short_title = None
109+
# html_short_title = None
110110

111111
# The name of an image file (relative to this directory) to place at the top
112112
# of the sidebar.
113-
#html_logo = None
113+
# html_logo = None
114114

115115
# The name of an image file (within the static path) to use as favicon of the
116116
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
117117
# pixels large.
118-
#html_favicon = None
118+
# html_favicon = None
119119

120120
# Add any paths that contain custom static files (such as style sheets) here,
121121
# relative to this directory. They are copied after the builtin static files,
@@ -124,101 +124,95 @@
124124

125125
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
126126
# using the given strftime format.
127-
#html_last_updated_fmt = '%b %d, %Y'
127+
# html_last_updated_fmt = '%b %d, %Y'
128128

129129
# If true, SmartyPants will be used to convert quotes and dashes to
130130
# typographically correct entities.
131-
#html_use_smartypants = True
131+
# html_use_smartypants = True
132132

133133
# Custom sidebar templates, maps document names to template names.
134-
#html_sidebars = {}
134+
# html_sidebars = {}
135135

136136
# Additional templates that should be rendered to pages, maps page names to
137137
# template names.
138-
#html_additional_pages = {}
138+
# html_additional_pages = {}
139139

140140
# If false, no module index is generated.
141-
#html_domain_indices = True
141+
# html_domain_indices = True
142142

143143
# If false, no index is generated.
144-
#html_use_index = True
144+
# html_use_index = True
145145

146146
# If true, the index is split into individual pages for each letter.
147-
#html_split_index = False
147+
# html_split_index = False
148148

149149
# If true, links to the reST sources are added to the pages.
150-
#html_show_sourcelink = True
150+
# html_show_sourcelink = True
151151

152152
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
153-
#html_show_sphinx = True
153+
# html_show_sphinx = True
154154

155155
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
156-
#html_show_copyright = True
156+
# html_show_copyright = True
157157

158158
# If true, an OpenSearch description file will be output, and all pages will
159159
# contain a <link> tag referring to it. The value of this option must be the
160160
# base URL from which the finished HTML is served.
161-
#html_use_opensearch = ''
161+
# html_use_opensearch = ''
162162

163163
# This is the file name suffix for HTML files (e.g. ".xhtml").
164-
#html_file_suffix = None
164+
# html_file_suffix = None
165165

166166
# Output file base name for HTML help builder.
167-
htmlhelp_basename = 'libcxxdoc'
167+
htmlhelp_basename = "libcxxdoc"
168168

169169

170170
# -- Options for LaTeX output --------------------------------------------------
171171

172172
latex_elements = {
173-
# The paper size ('letterpaper' or 'a4paper').
174-
#'papersize': 'letterpaper',
175-
176-
# The font size ('10pt', '11pt' or '12pt').
177-
#'pointsize': '10pt',
178-
179-
# Additional stuff for the LaTeX preamble.
180-
#'preamble': '',
173+
# The paper size ('letterpaper' or 'a4paper').
174+
#'papersize': 'letterpaper',
175+
# The font size ('10pt', '11pt' or '12pt').
176+
#'pointsize': '10pt',
177+
# Additional stuff for the LaTeX preamble.
178+
#'preamble': '',
181179
}
182180

183181
# Grouping the document tree into LaTeX files. List of tuples
184182
# (source start file, target name, title, author, documentclass [howto/manual]).
185183
latex_documents = [
186-
('contents', 'libcxx.tex', u'libcxx Documentation',
187-
u'LLVM project', 'manual'),
184+
("contents", "libcxx.tex", "libcxx Documentation", "LLVM project", "manual"),
188185
]
189186

190187
# The name of an image file (relative to this directory) to place at the top of
191188
# the title page.
192-
#latex_logo = None
189+
# latex_logo = None
193190

194191
# For "manual" documents, if this is true, then toplevel headings are parts,
195192
# not chapters.
196-
#latex_use_parts = False
193+
# latex_use_parts = False
197194

198195
# If true, show page references after internal links.
199-
#latex_show_pagerefs = False
196+
# latex_show_pagerefs = False
200197

201198
# If true, show URL addresses after external links.
202-
#latex_show_urls = False
199+
# latex_show_urls = False
203200

204201
# Documents to append as an appendix to all manuals.
205-
#latex_appendices = []
202+
# latex_appendices = []
206203

207204
# If false, no module index is generated.
208-
#latex_domain_indices = True
205+
# latex_domain_indices = True
209206

210207

211208
# -- Options for manual page output --------------------------------------------
212209

213210
# One entry per manual page. List of tuples
214211
# (source start file, name, description, authors, manual section).
215-
man_pages = [
216-
('contents', 'libc++', u'libc++ Documentation',
217-
[u'LLVM project'], 1)
218-
]
212+
man_pages = [("contents", "libc++", "libc++ Documentation", ["LLVM project"], 1)]
219213

220214
# If true, show URL addresses after external links.
221-
#man_show_urls = False
215+
# man_show_urls = False
222216

223217

224218
# -- Options for Texinfo output ------------------------------------------------
@@ -227,19 +221,25 @@
227221
# (source start file, target name, title, author,
228222
# dir menu entry, description, category)
229223
texinfo_documents = [
230-
('contents', 'libc++', u'libc++ Documentation',
231-
u'LLVM project', 'libc++', 'One line description of project.',
232-
'Miscellaneous'),
224+
(
225+
"contents",
226+
"libc++",
227+
"libc++ Documentation",
228+
"LLVM project",
229+
"libc++",
230+
"One line description of project.",
231+
"Miscellaneous",
232+
),
233233
]
234234

235235
# Documents to append as an appendix to all manuals.
236-
#texinfo_appendices = []
236+
# texinfo_appendices = []
237237

238238
# If false, no module index is generated.
239-
#texinfo_domain_indices = True
239+
# texinfo_domain_indices = True
240240

241241
# How to display URL addresses: 'footnote', 'no', or 'inline'.
242-
#texinfo_show_urls = 'footnote'
242+
# texinfo_show_urls = 'footnote'
243243

244244

245245
# FIXME: Define intersphinx configuration.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# Disable all of the experimental tests if the correct feature is not available.
2-
if 'c++experimental' not in config.available_features:
3-
config.unsupported = True
2+
if "c++experimental" not in config.available_features:
3+
config.unsupported = True

libcxx/test/libcxx/gdb/gdb_pretty_printer_test.py

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
#===----------------------------------------------------------------------===##
1+
# ===----------------------------------------------------------------------===##
22
#
33
# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
44
# See https://llvm.org/LICENSE.txt for license information.
55
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
66
#
7-
#===----------------------------------------------------------------------===##
7+
# ===----------------------------------------------------------------------===##
88
"""Commands used to automate testing gdb pretty printers.
99
1010
This script is part of a larger framework to test gdb pretty printers. It
@@ -31,10 +31,8 @@
3131

3232

3333
class CheckResult(gdb.Command):
34-
3534
def __init__(self):
36-
super(CheckResult, self).__init__(
37-
"print_and_compare", gdb.COMMAND_DATA)
35+
super(CheckResult, self).__init__("print_and_compare", gdb.COMMAND_DATA)
3836

3937
def invoke(self, arg, from_tty):
4038
global has_run_tests
@@ -55,7 +53,7 @@ def invoke(self, arg, from_tty):
5553
value_str = self._get_value_string(compare_frame, testcase_frame)
5654

5755
# Ignore the convenience variable name and newline
58-
value = value_str[value_str.find("= ") + 2:-1]
56+
value = value_str[value_str.find("= ") + 2 : -1]
5957
gdb.newest_frame().select()
6058
expectation_val = compare_frame.read_var("expectation")
6159
check_literal = expectation_val.string(encoding="utf-8")
@@ -66,16 +64,14 @@ def invoke(self, arg, from_tty):
6664

6765
if test_fails:
6866
global test_failures
69-
print("FAIL: " + test_loc.symtab.filename +
70-
":" + str(test_loc.line))
67+
print("FAIL: " + test_loc.symtab.filename + ":" + str(test_loc.line))
7168
print("GDB printed:")
7269
print(" " + repr(value))
7370
print("Value should match:")
7471
print(" " + repr(check_literal))
7572
test_failures += 1
7673
else:
77-
print("PASS: " + test_loc.symtab.filename +
78-
":" + str(test_loc.line))
74+
print("PASS: " + test_loc.symtab.filename + ":" + str(test_loc.line))
7975

8076
except RuntimeError as e:
8177
# At this point, lots of different things could be wrong, so don't try to
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Load the same local configuration as the corresponding one in libcxx/test/std
22
import os
3-
inLibcxx = os.path.join('libcxx', 'test', 'libcxx')
4-
inStd = os.path.join('libcxx', 'test', 'std')
3+
4+
inLibcxx = os.path.join("libcxx", "test", "libcxx")
5+
inStd = os.path.join("libcxx", "test", "std")
56
localConfig = os.path.normpath(os.path.realpath(__file__)).replace(inLibcxx, inStd)
67
config.load_from_path(localConfig, lit_config)

0 commit comments

Comments
 (0)