Skip to content

Commit 686f913

Browse files
committed
BandsData: Use f-strings in _prepare_gnuplot
The `flynt` autoformatter was trying to correct them automatically but it would result in incorrect syntax, so the transformation is done manually.
1 parent 3dda84f commit 686f913

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

src/aiida/orm/nodes/data/array/bands.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1033,20 +1033,17 @@ def _prepare_gnuplot(
10331033
script.append(f'set ylabel "Dispersion ({self.units})"')
10341034

10351035
if title:
1036-
script.append('set title "{}"'.format(title.replace('"', '"')))
1036+
script.append(f'set title "{title}"')
10371037

10381038
# Plot, escaping filename
1039+
filename = os.path.basename(dat_filename)
10391040
if len(x) > 1:
10401041
script.append(f'set xrange [{x_min_lim}:{x_max_lim}]')
10411042
script.append('set grid xtics lt 1 lc rgb "#888888"')
1042-
script.append('plot "{}" with l lc rgb "#000000"'.format(os.path.basename(dat_filename).replace('"', '"')))
1043+
script.append(f'plot "{filename}" with l lc rgb "#000000"')
10431044
else:
10441045
script.append('set xrange [-1.0:1.0]')
1045-
script.append(
1046-
'plot "{}" using ($1-0.25):($2):(0.5):(0) with vectors nohead lc rgb "#000000"'.format(
1047-
os.path.basename(dat_filename).replace('"', '"')
1048-
)
1049-
)
1046+
script.append(f'plot "{filename}" using ($1-0.25):($2):(0.5):(0) with vectors nohead lc rgb "#000000"')
10501047

10511048
script_data = '\n'.join(script) + '\n'
10521049
extra_files = {dat_filename: raw_data}

0 commit comments

Comments
 (0)