Skip to content

Commit fdc1182

Browse files
committed
STY: apply ruff-formatting
1 parent 43c0dc2 commit fdc1182

97 files changed

Lines changed: 4563 additions & 3964 deletions

File tree

Some content is hidden

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

doc/source/conf.py

Lines changed: 28 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,12 @@
1818

1919
# -- Project information -----------------------------------------------------
2020

21-
project = 'Idefix'
22-
copyright = 'Geoffroy Lesur et al.'
23-
author = 'Geoffroy Lesur'
21+
project = "Idefix"
22+
copyright = "Geoffroy Lesur et al."
23+
author = "Geoffroy Lesur"
2424

2525
# The full version, including alpha/beta/rc tags
26-
release = '2.3.0'
27-
26+
release = "2.3.0"
2827

2928

3029
# -- General configuration ---------------------------------------------------
@@ -34,20 +33,24 @@
3433
# ones.
3534
extensions = [
3635
"sphinx_rtd_theme",
37-
'sphinx_git',
38-
'matplotlib.sphinxext.plot_directive',
36+
"sphinx_git",
37+
"matplotlib.sphinxext.plot_directive",
3938
"breathe",
4039
"exhale",
4140
"m2r2",
42-
"sphinx_copybutton"
43-
]
41+
"sphinx_copybutton",
42+
]
4443

4544
source_suffix = [".rst", ".md"]
4645

47-
cpp_id_attributes=["KOKKOS_FORCEINLINE_FUNCTION","KOKKOS_INLINE_FUNCTION","KOKKOS_RESTRICT"]
46+
cpp_id_attributes = [
47+
"KOKKOS_FORCEINLINE_FUNCTION",
48+
"KOKKOS_INLINE_FUNCTION",
49+
"KOKKOS_RESTRICT",
50+
]
4851

4952
# Add any paths that contain templates here, relative to this directory.
50-
templates_path = ['_templates']
53+
templates_path = ["_templates"]
5154

5255
# List of patterns, relative to source directory, that match files and
5356
# directories to ignore when looking for source files.
@@ -60,45 +63,47 @@
6063
# The theme to use for HTML and HTML Help pages. See the documentation for
6164
# a list of builtin themes.
6265
#
63-
html_theme = 'sphinx_rtd_theme'
66+
html_theme = "sphinx_rtd_theme"
6467

6568
# Add any paths that contain custom static files (such as style sheets) here,
6669
# relative to this directory. They are copied after the builtin static files,
6770
# so a file named "default.css" will overwrite the builtin "default.css".
68-
html_static_path = ['_static']
71+
html_static_path = ["_static"]
72+
6973

7074
def setup(app):
71-
app.add_css_file('my_theme.css')
75+
app.add_css_file("my_theme.css")
76+
7277

7378
##############
7479
# Breathe/Exhale options
7580

7681
# Setup the breathe extension
7782
breathe_projects = {
78-
"Idefix": "./xml"
83+
"Idefix": "./xml",
7984
}
8085
breathe_default_project = "Idefix"
8186

8287
# Setup the exhale extension
8388
exhale_args = {
8489
# These arguments are required
85-
"containmentFolder": "./api",
86-
"rootFileName": "library_root.rst",
87-
"rootFileTitle": "Idefix API",
90+
"containmentFolder": "./api",
91+
"rootFileName": "library_root.rst",
92+
"rootFileTitle": "Idefix API",
8893
# Suggested optional arguments
89-
"createTreeView": False,
94+
"createTreeView": False,
9095
# TIP: if using the sphinx-bootstrap-theme, you need
9196
# "treeViewIsBootstrap": True,
9297
"doxygenStripFromPath": "../../src",
9398
"exhaleExecutesDoxygen": True,
94-
"exhaleDoxygenStdin": textwrap.dedent('''
99+
"exhaleDoxygenStdin": textwrap.dedent("""
95100
INPUT = ../../src
96101
EXCLUDE = ../../src/kokkos
97-
''')
102+
"""),
98103
}
99104

100105
# Tell sphinx what the primary language being documented is.
101-
primary_domain = 'cpp'
106+
primary_domain = "cpp"
102107

103108
# Tell sphinx what the pygments highlight language should be.
104-
highlight_language = 'cpp'
109+
highlight_language = "cpp"

doc/source/plot_idefix_bench.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,24 @@
44

55

66
def do_plot(title, bench_file, gpumodels):
7-
with open(bench_file, 'r') as f:
7+
with open(bench_file, "r") as f:
88
benches = json.load(f)
99

1010
plt.figure()
11-
xmax=0
12-
ymax=0
11+
xmax = 0
12+
ymax = 0
1313
for gpumodel in gpumodels:
14-
select = [bench for bench in benches if bench['gpumodel'] == gpumodel][-1]
14+
select = [bench for bench in benches if bench["gpumodel"] == gpumodel][-1]
1515

16-
xs = [r['nbgpu'] for r in select['results']]
17-
ys = [r['cell_updates'] for r in select['results']]
18-
plt.plot(xs, ys,'o-',label=gpumodel)
19-
xmax=max(xmax,max(xs))
20-
ymax=max(ymax,max(ys))
16+
xs = [r["nbgpu"] for r in select["results"]]
17+
ys = [r["cell_updates"] for r in select["results"]]
18+
plt.plot(xs, ys, "o-", label=gpumodel)
19+
xmax = max(xmax, max(xs))
20+
ymax = max(ymax, max(ys))
2121

2222
plt.xscale("log", base=2)
23-
plt.ylim(0,ymax*1.1)
24-
plt.xlim(1,xmax*1.1)
23+
plt.ylim(0, ymax * 1.1)
24+
plt.xlim(1, xmax * 1.1)
2525
plt.legend()
2626
plt.xlabel("Number of GPUs/GCDs")
2727
plt.ylabel("Performance (cells / second / GPU)")

make_tarballs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def _make_self_contained_tarball(output_dir, *, suffix="", exclude_list=None):
8989
os.replace(os.path.join(work_dir, tarball), final_tarfile)
9090

9191
filesize = os.path.getsize(final_tarfile)
92-
print("Done ! Final file size is %.1f MB" % (filesize / 1024 ** 2))
92+
print("Done ! Final file size is %.1f MB" % (filesize / 1024**2))
9393

9494

9595
def main(argv=None):

pytools/dump_io.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
55
@author: lesurg
66
"""
7+
78
import os
89
import re
910
import struct
@@ -119,6 +120,7 @@ def _read_fields(self, fh):
119120
def __repr__(self):
120121
return "DumpDataset('%s')" % self.filename
121122

123+
122124
# public API
123125
def readDump(filename):
124126
return DumpDataset(filename)

pytools/idfx_io.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313

1414
HEADER_SIZE = 128
1515

16+
1617
# There is one .idfx file per processor
1718
class IdfxFileField(object):
18-
1919
def __init__(self, fh, byteorder="little"):
2020
# read entry name
2121
q = fh.read(NAME_SIZE)
@@ -32,6 +32,7 @@ def __init__(self, fh, byteorder="little"):
3232
raw = struct.unpack(str(ntot) + "d", fh.read(DOUBLE_SIZE * ntot))
3333
self.array = np.asarray(raw).reshape(dims[::-1])
3434

35+
3536
class IdfxFileDataset(object):
3637
def __init__(self, filename):
3738
# identical to DumpDataset
@@ -45,12 +46,11 @@ def _read_header(self, fh):
4546
# could easily be identical to DumpDataset
4647
headerSize = 128
4748
q = fh.read(headerSize)
48-
n = q.index(b'\x00')
49-
self.header = q[:n].decode('utf-8')
49+
n = q.index(b"\x00")
50+
self.header = q[:n].decode("utf-8")
5051

5152
self.metadata["byteorder"] = "little"
5253

53-
5454
def _read_field(self, fh):
5555
# identical to DumpDataset
5656
if self.metadata["byteorder"] is None:

0 commit comments

Comments
 (0)