Closed cduck closed 4 years ago
Could it be that the errors have nothing to do with the unused import
? What you linked has
cirq/optimizers/eject_phased_paulis_test.py:42:0: C0301: Line too long (83/80) (line-too-long)
cirq/optimizers/eject_phased_paulis_test.py:18:0: C0411: third party import "import numpy as np" should be placed before "import sympy" (wrong-import-order)
Alongside the unused import error.
The same thing happened in #1963 (last commit on Apr 15). I got an unused import error on Travis but no errors locally.
I just ran your cduck:eject-pauli
branch locally on my machine and i received lots of unused imports.
vtomole@vtomole:~/Cirq$ check/pylint
************* Module cirq.neutral_atoms.neutral_atom_devices
cirq/neutral_atoms/neutral_atom_devices.py:18:0: W0611: Unused DefaultDict imported from typing (unused-import)
************* Module cirq.optimizers.eject_z
cirq/optimizers/eject_z.py:17:0: W0611: Unused Dict imported from typing (unused-import)
cirq/optimizers/eject_z.py:17:0: W0611: Unused List imported from typing (unused-import)
cirq/optimizers/eject_z.py:17:0: W0611: Unused Tuple imported from typing (unused-import)
************* Module cirq.work.pauli_sum_collector
cirq/work/pauli_sum_collector.py:16:0: W0611: Unused MutableMapping imported from typing (unused-import)
************* Module cirq.value.linear_dict
cirq/value/linear_dict.py:17:0: W0611: Unused Dict imported from typing (unused-import)
************* Module cirq.sim.simulator
cirq/sim/simulator.py:30:0: W0611: Unused Hashable imported from typing (unused-import)
cirq/sim/simulator.py:30:0: W0611: Unused Tuple imported from typing (unused-import)
************* Module cirq.sim.wave_function_simulator
cirq/sim/wave_function_simulator.py:19:0: W0611: Unused Hashable imported from typing (unused-import)
************* Module cirq.ops.linear_combinations
cirq/ops/linear_combinations.py:15:0: W0611: Unused DefaultDict imported from typing (unused-import)
************* Module cirq.ops.op_tree
cirq/ops/op_tree.py:20:0: W0611: Unused Dict imported from typing (unused-import)
************* Module cirq.ops.pauli_gates
cirq/ops/pauli_gates.py:15:0: W0611: Unused Optional imported from typing (unused-import)
************* Module cirq.experiments.qubit_characterizations
cirq/experiments/qubit_characterizations.py:8:0: W0611: Unused Axes3D imported from mpl_toolkits.mplot3d (unused-import)
************* Module cirq.google.serializable_gate_set
cirq/google/serializable_gate_set.py:18:0: W0611: Unused List imported from typing (unused-import)
cirq/google/serializable_gate_set.py:18:0: W0611: Unused Type imported from typing (unused-import)
************* Module cirq.google.engine.engine
cirq/google/engine/engine.py:33:0: W0611: Unused Tuple imported from typing (unused-import)
************* Module cirq.protocols.has_unitary
cirq/protocols/has_unitary.py:15:0: W0611: Unused Dict imported from typing (unused-import)
************* Module cirq.contrib.acquaintance.optimizers
cirq/contrib/acquaintance/optimizers.py:15:0: W0611: Unused FrozenSet imported from typing (unused-import)
cirq/contrib/acquaintance/optimizers.py:15:0: W0611: Unused List imported from typing (unused-import)
cirq/contrib/acquaintance/optimizers.py:15:0: W0611: Unused Set imported from typing (unused-import)
************* Module cirq.contrib.acquaintance.executor
cirq/contrib/acquaintance/executor.py:15:0: W0611: Unused List imported from typing (unused-import)
************* Module cirq.contrib.qasm_import._parser
cirq/contrib/qasm_import/_parser.py:16:0: W0611: Unused Dict imported from typing (unused-import)
cirq/contrib/qasm_import/_parser.py:16:0: W0611: Unused Optional imported from typing (unused-import)
************* Module cirq.contrib.paulistring.convert_to_pauli_string_phasors
cirq/contrib/paulistring/convert_to_pauli_string_phasors.py:15:0: W0611: Unused List imported from typing (unused-import)
************* Module cirq.vis.heatmap
cirq/vis/heatmap.py:29:0: W0611: Unused List imported from typing (unused-import)
I also have pylint==2.3.1, astroid==2.1.0. I always get these but i ignore them and they pass on Travis.
At least some of those are imports only used in a type comment. The latest pylint version should handle that.
We are on the latest version on pylint, what we are not on the latest version of is astroid because this bug has not been fixed https://github.com/PyCQA/astroid/issues/650.
This is growing stale and we probably need someone to repo again to make progress.
I still notice pylint checks returning more results on my machine than in ci.
I noticed that the pylintrc has a weird configuration - it used [config]
instead of [MASTER]
section - not sure how it was working at all - I think we were running pylint with default settings everywhere.
https://github.com/quantumlib/Cirq/pull/3387 is fixing this + upgrades to the latest pylint.
I believe that #3387 should fix this issue.
An unused import (
Optional
) passed CI here: https://github.com/quantumlib/Cirq/blame/master/cirq/ops/pauli_gates.py#L15Now I'm getting an error for that on Travis: https://travis-ci.com/quantumlib/Cirq/jobs/225990740#L253
When I run pylint locally, I don't catch this or other import errors. This has happened during my last few PRs: https://travis-ci.com/quantumlib/Cirq/jobs/225990740#L251
I updated my local pylint to pylint==2.3.1, astroid==2.1.0 and still don't get the errors that Travis shows.
Can anyone else reproduce this?