Skip to content

Commit 9bbe928

Browse files
committed
Merge branch '540-favor-appending-strings-over-adding-single-element-list' into 'development'
Replace addition of single string element with list.append call Closes #540 See merge request damask/DAMASK!1122
2 parents 5ad5779 + 8e57d73 commit 9bbe928

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

python/damask/_result.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -583,18 +583,18 @@ def list_data(self) -> list[str]:
583583
msg = []
584584
with h5py.File(self.fname,'r') as f:
585585
for inc in self._visible['increments']:
586-
msg += [f'\n{inc} ({self._times[int(inc.split("_")[1])]} s)']
586+
msg.append(f'\n{inc} ({self._times[int(inc.split("_")[1])]} s)')
587587
for ty in ['phase','homogenization']:
588-
msg += [f' {ty}']
588+
msg.append(f' {ty}')
589589
for label in self._visible[ty+'s']:
590-
msg += [f' {label}']
590+
msg.append(f' {label}')
591591
for field in _match(self._visible['fields'],f['/'.join([inc,ty,label])].keys()):
592-
msg += [f' {field}']
592+
msg.append(f' {field}')
593593
for d in f['/'.join([inc,ty,label,field])].keys():
594594
dataset = f['/'.join([inc,ty,label,field,d])]
595595
unit = dataset.attrs["unit"]
596596
description = dataset.attrs['description']
597-
msg += [f' {d} / {unit}: {description}']
597+
msg.append(f' {d} / {unit}: {description}')
598598

599599
return msg
600600

@@ -1991,7 +1991,7 @@ def export_VTK(self,
19911991
with h5py.File(self.fname,'r') as f:
19921992
creator = f.attrs['creator']
19931993
created = f.attrs['created']
1994-
v.comments += [f'{creator} ({created})']
1994+
v.comments.append(f'{creator} ({created})')
19951995

19961996
for inc in util.show_progress(self._visible['increments']):
19971997

python/damask/_vtk.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -563,13 +563,13 @@ def _add_array(vtk_data,
563563
_add_array(dup.vtk_data,
564564
label,
565565
np.where(data.mask,data.fill_value,data) if isinstance(data,np.ma.MaskedArray) else data)
566-
if info is not None: dup.comments += [f'{label}: {info}']
566+
if info is not None: dup.comments.append(f'{label}: {info}')
567567
else:
568568
raise ValueError('no label defined for data')
569569
elif isinstance(table,Table):
570570
for l in table.labels:
571571
_add_array(dup.vtk_data,l,table.get(l))
572-
if info is not None: dup.comments += [f'{l}: {info}']
572+
if info is not None: dup.comments.append(f'{l}: {info}')
573573
else:
574574
raise TypeError
575575

0 commit comments

Comments
 (0)