This commit is contained in:
Justus Kuhlmann 2025-11-10 08:24:37 +00:00
commit 4f099fb4a9

View file

@ -610,7 +610,7 @@ def _check_append_rep(content, start_list):
has_regular_len_heads = True has_regular_len_heads = True
for chunk_num in range(len(start_list)): for chunk_num in range(len(start_list)):
start = start_list[chunk_num] start = start_list[chunk_num]
if chunk_num == len(start_list)-1: if chunk_num == len(start_list) - 1:
stop = len(content) stop = len(content)
else: else:
stop = start_list[chunk_num+1] stop = start_list[chunk_num+1]
@ -621,7 +621,7 @@ def _check_append_rep(content, start_list):
break break
header_len_list.append(header_len) header_len_list.append(header_len)
data_len_list.append(len(chunk) - header_len) data_len_list.append(len(chunk) - header_len)
if len(set(header_len_list)) > 1: if len(set(header_len_list)) > 1:
warnings.warn("Not all headers have the same length. Data parts do.") warnings.warn("Not all headers have the same length. Data parts do.")
has_regular_len_heads = False has_regular_len_heads = False
@ -653,7 +653,6 @@ def _read_chunk_structure(chunk, pattern, b2b):
return gauge_line, corr_line, start_read, T return gauge_line, corr_line, start_read, T
def _read_append_rep(filename, pattern, b2b, im, single, idl_func, cfg_func_args): def _read_append_rep(filename, pattern, b2b, im, single, idl_func, cfg_func_args):
with open(filename, 'r') as fp: with open(filename, 'r') as fp:
content = fp.readlines() content = fp.readlines()
@ -674,10 +673,10 @@ def _read_append_rep(filename, pattern, b2b, im, single, idl_func, cfg_func_args
for chunk_num in range(len(chunk_start_lines)): for chunk_num in range(len(chunk_start_lines)):
start = chunk_start_lines[chunk_num] start = chunk_start_lines[chunk_num]
if chunk_num == len(chunk_start_lines)-1: if chunk_num == len(chunk_start_lines) - 1:
stop = len(content) stop = len(content)
else: else:
stop = chunk_start_lines[chunk_num+1] stop = chunk_start_lines[chunk_num + 1]
chunk = content[start:stop] chunk = content[start:stop]
if not has_regular_len_heads: if not has_regular_len_heads:
gauge_line, corr_line, start_read, T = _read_chunk_structure(chunk, pattern, b2b) gauge_line, corr_line, start_read, T = _read_chunk_structure(chunk, pattern, b2b)