fix: bug in _find_correlator fixed. (#193)

This commit is contained in:
Fabian Joswig 2023-06-02 15:46:27 +01:00 committed by GitHub
parent 09cf6bae5a
commit e0e2686142
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -286,9 +286,9 @@ def _make_pattern(version, name, noffset, wf, wf2, b2b, quarks):
def _find_correlator(file_name, version, pattern, b2b, silent=False): def _find_correlator(file_name, version, pattern, b2b, silent=False):
T = 0 T = 0
file = open(file_name, "r") with open(file_name, "r") as my_file:
content = file.read() content = my_file.read()
match = re.search(pattern, content) match = re.search(pattern, content)
if match: if match:
if version == "0.0": if version == "0.0":
@ -304,10 +304,8 @@ def _find_correlator(file_name, version, pattern, b2b, silent=False):
print(T, 'entries, starting to read in line', start_read) print(T, 'entries, starting to read in line', start_read)
else: else:
file.close()
raise ValueError('Correlator with pattern\n' + pattern + '\nnot found.') raise ValueError('Correlator with pattern\n' + pattern + '\nnot found.')
file.close()
return start_read, T return start_read, T