Issue #1346 - removed "get" from function names (except get_backend)#2516
Issue #1346 - removed "get" from function names (except get_backend)#2516TrishaPe wants to merge 3 commits into
Conversation
|
|
|
I'm not sure we should do this. What is the problem with
I'm less concerned about the qasm changes. |
|
It’s because we never closed the issue. We decided to keep the get in results class as they change the data. I think we need to close and update the issue |
|
Yes I agree. @TrishaPe sorry that the issue you worked on was not updated. Do you mind making this PR only change the |
|
I can fix the issue later |
|
@TrishaPe please let us know if you are still going to work on this |
Summary
Issue #1346 lists several function names with the word 'get' in the name, which doesn't do much to clarify what the function does (some are generating data, some are looking for data to store in variables). I changed their names, generally using 'generate', 'read' or 'return' instead.
Details and comments
DONE:
qiskit/qasm/_qasm.py:
-- get_filename(self) to read_filename
-- get_tokens(self): There was an instance of this in quasm.py and another in qasmparse.py with different programs attached to them - two functions with the same name and different contents. I changed the instance in qasm.py to generate_tokens and the one in qasmparse.py to read_tokens.
qiskit/result/_result.py:
-- get_statevector(self, circuit=None): defined in result.py, referenced in 5 other files. I changed to return_statevector in all of them. There is still another function defined as _get_statevector in qasm_simulator.py, but this is a different one and only appears in this same file. It also has an underscore as the first character so I shouldn't touch it.
-- get_counts to histogram_data
PROBLEMS:
qiskit/result/result.py:
-- get_status(self), get_circuit_status(self, icircuit), get_job_id(self), get_ran_qasm(self, name), get_snapshots(self, circuit=None), get_snapshot(self, slot=None, circuit=None), get_names(self), get_qubitpol_vs_xval(self, nqubits, xvals_dict=None) do not exist
-- get_data is referenced twice, but is not defined anywhere in the whole qiskit-terra folder. Maybe this text should be updated for clarity.
folder qiskit\backends has been turned into "providers"
qiskit\mapper does not exist
EXTRA REMARK:
I also tried to adapt 'get_backends', originally defined in baseprovider.py in qiskit/providers, but keep on receiving errors in the tests. I turned back all my changes and now the tests are fine, but this also means that this change still needs to be completed.