Move CircuitDag to contrib#5481
Conversation
- Moves CircuitDag to contrib. - cirq.CircuitDag is now deprecated and now must be changed to cirq.contrib.CircuitDag. - Also moves the related cirq.Unique class Note: the tests use a high number of cirq.Unique instances which are also moved, so unable to verify count of deprecation messages in many tests.
MichaelBroughton
left a comment
There was a problem hiding this comment.
LGTM after a few tweaks. Mostly module import issues. Also, do we want to create a whole new folder in contrib or just copy the two modules over without the new folder ?
| from cirq.contrib.acquaintance.executor import AcquaintanceOperation, ExecutionStrategy | ||
| from cirq.contrib.acquaintance.mutation_utils import expose_acquaintance_gates | ||
| from cirq.contrib.acquaintance.permutation import LogicalIndex, LogicalMapping | ||
| from cirq.contrib.circuitdag import CircuitDag |
There was a problem hiding this comment.
Nit: prefer module import
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| from cirq.contrib.circuitdag.circuit_dag import CircuitDag, Unique |
There was a problem hiding this comment.
Why do we need our own circuitdag folder ?
There was a problem hiding this comment.
It's used in 3 different sub modules - contrib/acquaintance; contrib/routing; contrib/paulistring
So, I think it makes sense to make a separate submodule / folder for circuit dag. Note that all code is in specific submodules in contrib/* and we don't have any top-level python files in contrib, so we shouldn't put circuitdag as a top level python file directly in contrib/.
There was a problem hiding this comment.
Yeah, this was to stay consistent with other modules in contrib.
| from typing import cast | ||
|
|
||
| from cirq import circuits, ops, protocols | ||
| from cirq.contrib.circuitdag import CircuitDag |
There was a problem hiding this comment.
Nit: module import
| import networkx | ||
|
|
||
| from cirq import circuits, linalg | ||
| from cirq.contrib.circuitdag import CircuitDag |
There was a problem hiding this comment.
Nit: module import
|
|
||
| from cirq import circuits, ops, protocols | ||
|
|
||
| from cirq.contrib.circuitdag import CircuitDag, Unique |
|
|
||
| from cirq import circuits, ops, value | ||
| import cirq.contrib.acquaintance as cca | ||
| from cirq.contrib.circuitdag import CircuitDag |
There was a problem hiding this comment.
Nit: module import
* Move CircuitDag to contrib - Moves CircuitDag to contrib. - cirq.CircuitDag is now deprecated and now must be changed to cirq.contrib.CircuitDag. - Also moves the related cirq.Unique class Note: the tests use a high number of cirq.Unique instances which are also moved, so unable to verify count of deprecation messages in many tests.
* Move CircuitDag to contrib - Moves CircuitDag to contrib. - cirq.CircuitDag is now deprecated and now must be changed to cirq.contrib.CircuitDag. - Also moves the related cirq.Unique class Note: the tests use a high number of cirq.Unique instances which are also moved, so unable to verify count of deprecation messages in many tests.
to cirq.contrib.CircuitDag.
Note: the tests use a high number of cirq.Unique instances which
are also moved, so unable to verify count of deprecation messages
in many tests.
Fixes: #3816