mirror of
https://github.com/fjosw/pyerrors.git
synced 2025-05-14 19:43:41 +02:00
fix: bug in _find_correlator fixed. (#193)
This commit is contained in:
parent
09cf6bae5a
commit
e0e2686142
1 changed files with 17 additions and 19 deletions
|
@ -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
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue