mirror of
https://github.com/fjosw/pyerrors.git
synced 2026-08-04 11:31:21 +02:00
[Fix] Address copilot comments
This commit is contained in:
parent
7b952f9548
commit
ac1b1b73cd
4 changed files with 11 additions and 11 deletions
|
|
@ -61,9 +61,9 @@ def _dict_to_xmlstring(d):
|
|||
elif not d[k]:
|
||||
return '\n'
|
||||
else:
|
||||
raise TypeError('Type', type(d[k]), 'not supported in export!')
|
||||
raise TypeError(f'Type {type(d[k]).__name__} not supported in export!')
|
||||
else:
|
||||
raise TypeError('Type', type(d), 'not supported in export!')
|
||||
raise TypeError(f'Type {type(d).__name__} not supported in export!')
|
||||
return iters
|
||||
|
||||
|
||||
|
|
@ -153,7 +153,7 @@ def create_pobs_string(obsl, name, spec='', origin='', symbol=None, enstag=None)
|
|||
if not isinstance(symbol, list):
|
||||
raise TypeError('Symbol has to be a list!')
|
||||
if not (len(symbol) == 0 or len(symbol) == len(obsl)):
|
||||
raise ValueError(f'Symbol has to be a list of lenght 0 or {len(obsl)}!')
|
||||
raise ValueError(f'Symbol has to be a list of length 0 or {len(obsl)}!')
|
||||
for s in symbol:
|
||||
osymbol += f' {s}'
|
||||
for r in range(nr):
|
||||
|
|
@ -365,7 +365,7 @@ def read_pobs(fname, full_output=False, gz=True, separator_insertion=None):
|
|||
elif isinstance(separator_insertion, str):
|
||||
name = name.replace(separator_insertion, f"|{separator_insertion}")
|
||||
else:
|
||||
raise TypeError("separator_insertion has to be string or int, is ", type(separator_insertion))
|
||||
raise TypeError(f"separator_insertion has to be string or int, is {type(separator_insertion).__name__}")
|
||||
names.append(name)
|
||||
idl.append(idx)
|
||||
res = [Obs([d[i] for d in deltas], names, idl=idl) for i in range(len(deltas[0]))]
|
||||
|
|
@ -485,7 +485,7 @@ def import_dobs_string(content, full_output=False, separator_insertion=True):
|
|||
elif isinstance(separator_insertion, str):
|
||||
rname = rname.replace(separator_insertion, f"|{separator_insertion}")
|
||||
else:
|
||||
raise TypeError("separator_insertion has to be string or int, is ", type(separator_insertion))
|
||||
raise TypeError(f"separator_insertion has to be string or int, is {type(separator_insertion).__name__}")
|
||||
if '|' in rname:
|
||||
new_ename = rname[:rname.index('|')]
|
||||
else:
|
||||
|
|
@ -657,9 +657,9 @@ def _dobsdict_to_xmlstring(d):
|
|||
elif not d[k]:
|
||||
return '\n'
|
||||
else:
|
||||
raise TypeError('Type', type(d[k]), 'not supported in export!')
|
||||
raise TypeError(f'Type {type(d[k]).__name__} not supported in export!')
|
||||
else:
|
||||
raise TypeError('Type', type(d), 'not supported in export!')
|
||||
raise TypeError(f'Type {type(d).__name__} not supported in export!')
|
||||
return iters
|
||||
|
||||
|
||||
|
|
@ -754,7 +754,7 @@ def create_dobs_string(obsl, name, spec='dobs v1.0', origin='', symbol=None, who
|
|||
if not isinstance(symbol, list):
|
||||
raise TypeError('Symbol has to be a list!')
|
||||
if not (len(symbol) == 0 or len(symbol) == len(obsl)):
|
||||
raise ValueError(f'Symbol has to be a list of lenght 0 or {len(obsl)}!')
|
||||
raise ValueError(f'Symbol has to be a list of length 0 or {len(obsl)}!')
|
||||
osymbol = symbol[0]
|
||||
for s in symbol[1:]:
|
||||
osymbol += f' {s}'
|
||||
|
|
|
|||
|
|
@ -1203,7 +1203,7 @@ def read_ms5_xsf(path, prefix, qc, corr, sep="r", **kwargs):
|
|||
|
||||
# test if the input is correct
|
||||
if qc not in ['dd', 'ud', 'du', 'uu']:
|
||||
raise ValueError("Unknown quark conbination!")
|
||||
raise ValueError("Unknown quark combination!")
|
||||
|
||||
if corr not in ["gS", "gP", "gA", "gV", "gVt", "lA", "lV", "lVt", "lT", "lTt", "g1", "l1"]:
|
||||
raise ValueError("Unknown correlator!")
|
||||
|
|
|
|||
|
|
@ -208,7 +208,7 @@ def read_sfcf_multi(path, prefix, name_list, quarks_list=None, corr_type_list=No
|
|||
if len(new_names) != len(set(new_names)):
|
||||
raise ValueError("names are not unique!")
|
||||
if len(new_names) != replica:
|
||||
raise ValueError('names should have the length', replica)
|
||||
raise ValueError(f'names should have the length {replica}')
|
||||
|
||||
else:
|
||||
ens_name = kwargs.get("ens_name")
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ def matrix_pencil_method(corrs, k=1, p=None, **kwargs):
|
|||
if n_data <= p:
|
||||
raise ValueError('The pencil p has to be smaller than the number of data samples.')
|
||||
if p < k or n_data - p < k:
|
||||
raise ValueError('Cannot extract', k, 'energy levels with p=', p, 'and N-p=', n_data - p)
|
||||
raise ValueError(f'Cannot extract {k} energy levels with p={p} and N-p={n_data - p}')
|
||||
|
||||
# Construct the hankel matrices
|
||||
matrix = []
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue