Closed julenl closed 10 months ago
Totals | |
---|---|
Change from base Build 6873975703: | 0.0% |
Covered Lines: | 8768 |
Relevant Lines: | 10104 |
Did you do a search if you find any more such cases besides this one?
Yesterday I didn't but today, before I sent this one, I run a recursive grep on the circuit folder and only those two (the one from yesterday and this one) came up.
Since you already have this search set up, why don't you run that on the entire source code rather than just the circuit
module?
Sure, I did that too, short after I answered you.
cd qiskit_nature
grep -R 'The number of spatial orbitals {' -R
second_q/circuit/library/initial_states/hartree_fock.py: f"The number of spatial orbitals {self.num_spatial_orbitals} "
second_q/circuit/library/ansatzes/ucc.py f"The number of spatial orbitals {self.num_spatial_orbitals}"
Only those two, by that syntax.
Ah I see. I had assumed you would have done a search for:
'
or "
)'
or "
)That would probably require a little bit of regex magic so if that is not something you are familiar with, we can also leave it at that.
With this snippet:
for entry in os.walk('qiskit_nature'):
for filename in entry[2]:
file = entry[0] + os.sep + filename
if file.endswith('.py'):
with open(file, 'r') as fh:
text = fh.read()
mymatch = re.search('f".*[^\s]"\n\s+f"[^\s].*"', text)
if mymatch:
print(file)
print(' ', mymatch.group()
I get:
qiskit_nature/second_q/hamiltonians/quadratic_hamiltonian.py
f"QuadraticHamiltonian("
f"hermitian_part={repr(self.hermitian_part)}, "
qiskit_nature/second_q/circuit/library/ansatzes/ucc.py
f"The number of spatial orbitals {self.num_spatial_orbitals}"
f"must be greater than number of particles of any spin kind "
qiskit_nature/second_q/operators/spin_op.py
f"Invalid operation between operators with different spin"
f"values. Found spin_1={spin} and spin_2={other_spin}."
qiskit_nature/second_q/operators/electronic_integrals.py
f"The reported register_length of your beta-alpha-spin tensor, {beta_alpha_len}"
f", does not match the alpha-spin tensor one, {alpha_len}."
But only the spin_op and ucc require changes.
An space was missing here as well.
Summary
Details and comments