We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
remove transpile_dag
<!-- ⚠️ If you do not respect this template, your issue will be closed -->
<!-- ⚠️ Make sure to browse the opened and closed issues to confirm this idea does not exist. -->

### What is the expected enhancement?
Once we have pass_manager fully integrated we should remove the function transpile_dag from the transpiler.  



--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `qiskit/transpiler/transpiler.py`
Content:
```
1 # -*- coding: utf-8 -*-
2 
3 # Copyright 2018, IBM.
4 #
5 # This source code is licensed under the Apache License, Version 2.0 found in
6 # the LICENSE.txt file in the root directory of this source tree.
7 
8 """Tools for compiling a batch of quantum circuits."""
9 import logging
10 import warnings
11 
12 from qiskit.circuit import QuantumCircuit
13 from qiskit.mapper import CouplingMap
14 from qiskit.tools.parallel import parallel_map
15 from qiskit.converters import circuit_to_dag
16 from qiskit.converters import dag_to_circuit
17 from qiskit.mapper.layout import Layout
18 from qiskit.transpiler.exceptions import TranspilerError
19 from qiskit.transpiler.preset_passmanagers import default_pass_manager_simulator, \
20     default_pass_manager
21 
22 logger = logging.getLogger(__name__)
23 
24 
25 def transpile(circuits, backend=None, basis_gates=None, coupling_map=None,
26               initial_layout=None, seed_mapper=None, pass_manager=None):
27     """transpile one or more circuits.
28 
29     Args:
30         circuits (QuantumCircuit or list[QuantumCircuit]): circuits to compile
31         backend (BaseBackend): a backend to compile for
32         basis_gates (list[str]): list of basis gate names supported by the
33             target. Default: ['u1','u2','u3','cx','id']
34         coupling_map (list): coupling map (perhaps custom) to target in mapping
35         initial_layout (list): initial layout of qubits in mapping
36         seed_mapper (int): random seed for the swap_mapper
37         pass_manager (PassManager): a pass_manager for the transpiler stages
38 
39     Returns:
40         QuantumCircuit or list[QuantumCircuit]: transpiled circuit(s).
41     """
42     return_form_is_single = False
43     if isinstance(circuits, QuantumCircuit):
44         circuits = [circuits]
45         return_form_is_single = True
46 
47     # pass manager overrides explicit transpile options (basis_gates, coupling_map)
48     # explicit transpile options override options gotten from a backend
49     if not pass_manager and backend:
50         basis_gates = basis_gates or getattr(backend.configuration(), 'basis_gates', None)
51         # This needs to be removed once Aer 0.2 is out
52         coupling_map = coupling_map or getattr(backend.configuration(), 'coupling_map', None)
53 
54     # Convert integer list format to Layout
55     if isinstance(initial_layout, list) and \
56             all(isinstance(elem, int) for elem in initial_layout):
57         if isinstance(circuits, list):
58             circ = circuits[0]
59         else:
60             circ = circuits
61         initial_layout = Layout.generate_from_intlist(initial_layout, *circ.qregs)
62 
63     if initial_layout is not None and not isinstance(initial_layout, Layout):
64         initial_layout = Layout(initial_layout)
65 
66     circuits = parallel_map(_transpilation, circuits,
67                             task_kwargs={'basis_gates': basis_gates,
68                                          'coupling_map': coupling_map,
69                                          'initial_layout': initial_layout,
70                                          'seed_mapper': seed_mapper,
71                                          'pass_manager': pass_manager})
72     if return_form_is_single:
73         return circuits[0]
74     return circuits
75 
76 
77 def _transpilation(circuit, basis_gates=None, coupling_map=None,
78                    initial_layout=None, seed_mapper=None,
79                    pass_manager=None):
80     """Perform transpilation of a single circuit.
81 
82     Args:
83         circuit (QuantumCircuit): A circuit to transpile.
84         basis_gates (list[str]): list of basis gate names supported by the
85             target. Default: ['u1','u2','u3','cx','id']
86         coupling_map (CouplingMap): coupling map (perhaps custom) to target in mapping
87         initial_layout (Layout): initial layout of qubits in mapping
88         seed_mapper (int): random seed for the swap_mapper
89         pass_manager (PassManager): a pass_manager for the transpiler stage
90 
91     Returns:
92         QuantumCircuit: A transpiled circuit.
93 
94     Raises:
95         TranspilerError: If the Layout does not matches the circuit
96     """
97     if initial_layout is not None and set(circuit.qregs) != initial_layout.get_registers():
98         raise TranspilerError('The provided initial layout does not match the registers in '
99                               'the circuit "%s"' % circuit.name)
100 
101     if pass_manager and not pass_manager.working_list:
102         return circuit
103 
104     is_parametric_circuit = bool(circuit.unassigned_variables)
105 
106     dag = circuit_to_dag(circuit)
107     del circuit
108 
109     final_dag = transpile_dag(dag, basis_gates=basis_gates,
110                               coupling_map=coupling_map,
111                               initial_layout=initial_layout,
112                               skip_numeric_passes=is_parametric_circuit,
113                               seed_mapper=seed_mapper,
114                               pass_manager=pass_manager)
115 
116     out_circuit = dag_to_circuit(final_dag)
117 
118     return out_circuit
119 
120 
121 # pylint: disable=redefined-builtin
122 def transpile_dag(dag, basis_gates=None, coupling_map=None,
123                   initial_layout=None, skip_numeric_passes=None,
124                   seed_mapper=None, pass_manager=None):
125     """Transform a dag circuit into another dag circuit (transpile), through
126     consecutive passes on the dag.
127 
128     Args:
129         dag (DAGCircuit): dag circuit to transform via transpilation
130         basis_gates (list[str]): list of basis gate names supported by the
131             target. Default: ['u1','u2','u3','cx','id']
132         coupling_map (list): A graph of coupling::
133 
134             [
135              [control0(int), target0(int)],
136              [control1(int), target1(int)],
137             ]
138 
139             eg. [[0, 2], [1, 2], [1, 3], [3, 4]}
140 
141         initial_layout (Layout or None): A layout object
142         skip_numeric_passes (bool): If true, skip passes which require fixed parameter values
143         seed_mapper (int): random seed_mapper for the swap mapper
144         pass_manager (PassManager): pass manager instance for the transpilation process
145             If None, a default set of passes are run.
146             Otherwise, the passes defined in it will run.
147             If contains no passes in it, no dag transformations occur.
148 
149     Returns:
150         DAGCircuit: transformed dag
151     """
152     # TODO: `basis_gates` will be removed after we have the unroller pass.
153     # TODO: `coupling_map`, `initial_layout`, `seed_mapper` removed after mapper pass.
154 
155     if basis_gates is None:
156         basis_gates = ['u1', 'u2', 'u3', 'cx', 'id']
157     if isinstance(basis_gates, str):
158         warnings.warn("The parameter basis_gates is now a list of strings. "
159                       "For example, this basis ['u1','u2','u3','cx'] should be used "
160                       "instead of 'u1,u2,u3,cx'. The string format will be "
161                       "removed after 0.9", DeprecationWarning, 2)
162         basis_gates = basis_gates.split(',')
163 
164     if pass_manager is None:
165         # default set of passes
166 
167         # if a coupling map is given compile to the map
168         if coupling_map:
169             pass_manager = default_pass_manager(basis_gates,
170                                                 CouplingMap(coupling_map),
171                                                 initial_layout,
172                                                 skip_numeric_passes,
173                                                 seed_mapper=seed_mapper)
174         else:
175             pass_manager = default_pass_manager_simulator(basis_gates)
176 
177     # run the passes specified by the pass manager
178     # TODO return the property set too. See #1086
179     name = dag.name
180     dag = pass_manager.run_passes(dag)
181     dag.name = name
182 
183     return dag
184
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/qiskit/transpiler/transpiler.py b/qiskit/transpiler/transpiler.py
--- a/qiskit/transpiler/transpiler.py
+++ b/qiskit/transpiler/transpiler.py
@@ -106,22 +106,59 @@
     dag = circuit_to_dag(circuit)
     del circuit
 
-    final_dag = transpile_dag(dag, basis_gates=basis_gates,
-                              coupling_map=coupling_map,
-                              initial_layout=initial_layout,
-                              skip_numeric_passes=is_parametric_circuit,
-                              seed_mapper=seed_mapper,
-                              pass_manager=pass_manager)
+    final_dag = _transpile_dag(dag, basis_gates=basis_gates,
+                               coupling_map=coupling_map,
+                               initial_layout=initial_layout,
+                               skip_numeric_passes=is_parametric_circuit,
+                               seed_mapper=seed_mapper,
+                               pass_manager=pass_manager)
 
     out_circuit = dag_to_circuit(final_dag)
 
     return out_circuit
 
 
-# pylint: disable=redefined-builtin
 def transpile_dag(dag, basis_gates=None, coupling_map=None,
                   initial_layout=None, skip_numeric_passes=None,
                   seed_mapper=None, pass_manager=None):
+    """Deprecated - Transform a dag circuit into another dag circuit
+    (transpile), through consecutive passes on the dag.
+
+    Args:
+        dag (DAGCircuit): dag circuit to transform via transpilation
+        basis_gates (list[str]): list of basis gate names supported by the
+            target. Default: ['u1','u2','u3','cx','id']
+        coupling_map (list): A graph of coupling::
+
+            [
+             [control0(int), target0(int)],
+             [control1(int), target1(int)],
+            ]
+
+            eg. [[0, 2], [1, 2], [1, 3], [3, 4]}
+
+        initial_layout (Layout or None): A layout object
+        skip_numeric_passes (bool): If true, skip passes which require fixed parameter values
+        seed_mapper (int): random seed_mapper for the swap mapper
+        pass_manager (PassManager): pass manager instance for the transpilation process
+            If None, a default set of passes are run.
+            Otherwise, the passes defined in it will run.
+            If contains no passes in it, no dag transformations occur.
+
+    Returns:
+        DAGCircuit: transformed dag
+    """
+
+    warnings.warn("transpile_dag has been deprecated and will be removed in the "
+                  "0.9 release. Circuits can be transpiled directly to other "
+                  "circuits with the transpile function.", DeprecationWarning)
+    return _transpile_dag(dag, basis_gates, coupling_map, initial_layout,
+                          skip_numeric_passes, seed_mapper, pass_manager)
+
+
+def _transpile_dag(dag, basis_gates=None, coupling_map=None,
+                   initial_layout=None, skip_numeric_passes=None,
+                   seed_mapper=None, pass_manager=None):
     """Transform a dag circuit into another dag circuit (transpile), through
     consecutive passes on the dag.

{"golden_diff": "diff --git a/qiskit/transpiler/transpiler.py b/qiskit/transpiler/transpiler.py\n--- a/qiskit/transpiler/transpiler.py\n+++ b/qiskit/transpiler/transpiler.py\n@@ -106,22 +106,59 @@\n     dag = circuit_to_dag(circuit)\n     del circuit\n \n-    final_dag = transpile_dag(dag, basis_gates=basis_gates,\n-                              coupling_map=coupling_map,\n-                              initial_layout=initial_layout,\n-                              skip_numeric_passes=is_parametric_circuit,\n-                              seed_mapper=seed_mapper,\n-                              pass_manager=pass_manager)\n+    final_dag = _transpile_dag(dag, basis_gates=basis_gates,\n+                               coupling_map=coupling_map,\n+                               initial_layout=initial_layout,\n+                               skip_numeric_passes=is_parametric_circuit,\n+                               seed_mapper=seed_mapper,\n+                               pass_manager=pass_manager)\n \n     out_circuit = dag_to_circuit(final_dag)\n \n     return out_circuit\n \n \n-# pylint: disable=redefined-builtin\n def transpile_dag(dag, basis_gates=None, coupling_map=None,\n                   initial_layout=None, skip_numeric_passes=None,\n                   seed_mapper=None, pass_manager=None):\n+    \"\"\"Deprecated - Transform a dag circuit into another dag circuit\n+    (transpile), through consecutive passes on the dag.\n+\n+    Args:\n+        dag (DAGCircuit): dag circuit to transform via transpilation\n+        basis_gates (list[str]): list of basis gate names supported by the\n+            target. Default: ['u1','u2','u3','cx','id']\n+        coupling_map (list): A graph of coupling::\n+\n+            [\n+             [control0(int), target0(int)],\n+             [control1(int), target1(int)],\n+            ]\n+\n+            eg. [[0, 2], [1, 2], [1, 3], [3, 4]}\n+\n+        initial_layout (Layout or None): A layout object\n+        skip_numeric_passes (bool): If true, skip passes which require fixed parameter values\n+        seed_mapper (int): random seed_mapper for the swap mapper\n+        pass_manager (PassManager): pass manager instance for the transpilation process\n+            If None, a default set of passes are run.\n+            Otherwise, the passes defined in it will run.\n+            If contains no passes in it, no dag transformations occur.\n+\n+    Returns:\n+        DAGCircuit: transformed dag\n+    \"\"\"\n+\n+    warnings.warn(\"transpile_dag has been deprecated and will be removed in the \"\n+                  \"0.9 release. Circuits can be transpiled directly to other \"\n+                  \"circuits with the transpile function.\", DeprecationWarning)\n+    return _transpile_dag(dag, basis_gates, coupling_map, initial_layout,\n+                          skip_numeric_passes, seed_mapper, pass_manager)\n+\n+\n+def _transpile_dag(dag, basis_gates=None, coupling_map=None,\n+                   initial_layout=None, skip_numeric_passes=None,\n+                   seed_mapper=None, pass_manager=None):\n     \"\"\"Transform a dag circuit into another dag circuit (transpile), through\n     consecutive passes on the dag.\n", "issue": "remove transpile_dag\n<!-- \u26a0\ufe0f If you do not respect this template, your issue will be closed -->\r\n<!-- \u26a0\ufe0f Make sure to browse the opened and closed issues to confirm this idea does not exist. -->\r\n\r\n### What is the expected enhancement?\r\nOnce we have pass_manager fully integrated we should remove the function transpile_dag from the transpiler.  \r\n\r\n\n", "before_files": [{"content": "# -*- coding: utf-8 -*-\n\n# Copyright 2018, IBM.\n#\n# This source code is licensed under the Apache License, Version 2.0 found in\n# the LICENSE.txt file in the root directory of this source tree.\n\n\"\"\"Tools for compiling a batch of quantum circuits.\"\"\"\nimport logging\nimport warnings\n\nfrom qiskit.circuit import QuantumCircuit\nfrom qiskit.mapper import CouplingMap\nfrom qiskit.tools.parallel import parallel_map\nfrom qiskit.converters import circuit_to_dag\nfrom qiskit.converters import dag_to_circuit\nfrom qiskit.mapper.layout import Layout\nfrom qiskit.transpiler.exceptions import TranspilerError\nfrom qiskit.transpiler.preset_passmanagers import default_pass_manager_simulator, \\\n    default_pass_manager\n\nlogger = logging.getLogger(__name__)\n\n\ndef transpile(circuits, backend=None, basis_gates=None, coupling_map=None,\n              initial_layout=None, seed_mapper=None, pass_manager=None):\n    \"\"\"transpile one or more circuits.\n\n    Args:\n        circuits (QuantumCircuit or list[QuantumCircuit]): circuits to compile\n        backend (BaseBackend): a backend to compile for\n        basis_gates (list[str]): list of basis gate names supported by the\n            target. Default: ['u1','u2','u3','cx','id']\n        coupling_map (list): coupling map (perhaps custom) to target in mapping\n        initial_layout (list): initial layout of qubits in mapping\n        seed_mapper (int): random seed for the swap_mapper\n        pass_manager (PassManager): a pass_manager for the transpiler stages\n\n    Returns:\n        QuantumCircuit or list[QuantumCircuit]: transpiled circuit(s).\n    \"\"\"\n    return_form_is_single = False\n    if isinstance(circuits, QuantumCircuit):\n        circuits = [circuits]\n        return_form_is_single = True\n\n    # pass manager overrides explicit transpile options (basis_gates, coupling_map)\n    # explicit transpile options override options gotten from a backend\n    if not pass_manager and backend:\n        basis_gates = basis_gates or getattr(backend.configuration(), 'basis_gates', None)\n        # This needs to be removed once Aer 0.2 is out\n        coupling_map = coupling_map or getattr(backend.configuration(), 'coupling_map', None)\n\n    # Convert integer list format to Layout\n    if isinstance(initial_layout, list) and \\\n            all(isinstance(elem, int) for elem in initial_layout):\n        if isinstance(circuits, list):\n            circ = circuits[0]\n        else:\n            circ = circuits\n        initial_layout = Layout.generate_from_intlist(initial_layout, *circ.qregs)\n\n    if initial_layout is not None and not isinstance(initial_layout, Layout):\n        initial_layout = Layout(initial_layout)\n\n    circuits = parallel_map(_transpilation, circuits,\n                            task_kwargs={'basis_gates': basis_gates,\n                                         'coupling_map': coupling_map,\n                                         'initial_layout': initial_layout,\n                                         'seed_mapper': seed_mapper,\n                                         'pass_manager': pass_manager})\n    if return_form_is_single:\n        return circuits[0]\n    return circuits\n\n\ndef _transpilation(circuit, basis_gates=None, coupling_map=None,\n                   initial_layout=None, seed_mapper=None,\n                   pass_manager=None):\n    \"\"\"Perform transpilation of a single circuit.\n\n    Args:\n        circuit (QuantumCircuit): A circuit to transpile.\n        basis_gates (list[str]): list of basis gate names supported by the\n            target. Default: ['u1','u2','u3','cx','id']\n        coupling_map (CouplingMap): coupling map (perhaps custom) to target in mapping\n        initial_layout (Layout): initial layout of qubits in mapping\n        seed_mapper (int): random seed for the swap_mapper\n        pass_manager (PassManager): a pass_manager for the transpiler stage\n\n    Returns:\n        QuantumCircuit: A transpiled circuit.\n\n    Raises:\n        TranspilerError: If the Layout does not matches the circuit\n    \"\"\"\n    if initial_layout is not None and set(circuit.qregs) != initial_layout.get_registers():\n        raise TranspilerError('The provided initial layout does not match the registers in '\n                              'the circuit \"%s\"' % circuit.name)\n\n    if pass_manager and not pass_manager.working_list:\n        return circuit\n\n    is_parametric_circuit = bool(circuit.unassigned_variables)\n\n    dag = circuit_to_dag(circuit)\n    del circuit\n\n    final_dag = transpile_dag(dag, basis_gates=basis_gates,\n                              coupling_map=coupling_map,\n                              initial_layout=initial_layout,\n                              skip_numeric_passes=is_parametric_circuit,\n                              seed_mapper=seed_mapper,\n                              pass_manager=pass_manager)\n\n    out_circuit = dag_to_circuit(final_dag)\n\n    return out_circuit\n\n\n# pylint: disable=redefined-builtin\ndef transpile_dag(dag, basis_gates=None, coupling_map=None,\n                  initial_layout=None, skip_numeric_passes=None,\n                  seed_mapper=None, pass_manager=None):\n    \"\"\"Transform a dag circuit into another dag circuit (transpile), through\n    consecutive passes on the dag.\n\n    Args:\n        dag (DAGCircuit): dag circuit to transform via transpilation\n        basis_gates (list[str]): list of basis gate names supported by the\n            target. Default: ['u1','u2','u3','cx','id']\n        coupling_map (list): A graph of coupling::\n\n            [\n             [control0(int), target0(int)],\n             [control1(int), target1(int)],\n            ]\n\n            eg. [[0, 2], [1, 2], [1, 3], [3, 4]}\n\n        initial_layout (Layout or None): A layout object\n        skip_numeric_passes (bool): If true, skip passes which require fixed parameter values\n        seed_mapper (int): random seed_mapper for the swap mapper\n        pass_manager (PassManager): pass manager instance for the transpilation process\n            If None, a default set of passes are run.\n            Otherwise, the passes defined in it will run.\n            If contains no passes in it, no dag transformations occur.\n\n    Returns:\n        DAGCircuit: transformed dag\n    \"\"\"\n    # TODO: `basis_gates` will be removed after we have the unroller pass.\n    # TODO: `coupling_map`, `initial_layout`, `seed_mapper` removed after mapper pass.\n\n    if basis_gates is None:\n        basis_gates = ['u1', 'u2', 'u3', 'cx', 'id']\n    if isinstance(basis_gates, str):\n        warnings.warn(\"The parameter basis_gates is now a list of strings. \"\n                      \"For example, this basis ['u1','u2','u3','cx'] should be used \"\n                      \"instead of 'u1,u2,u3,cx'. The string format will be \"\n                      \"removed after 0.9\", DeprecationWarning, 2)\n        basis_gates = basis_gates.split(',')\n\n    if pass_manager is None:\n        # default set of passes\n\n        # if a coupling map is given compile to the map\n        if coupling_map:\n            pass_manager = default_pass_manager(basis_gates,\n                                                CouplingMap(coupling_map),\n                                                initial_layout,\n                                                skip_numeric_passes,\n                                                seed_mapper=seed_mapper)\n        else:\n            pass_manager = default_pass_manager_simulator(basis_gates)\n\n    # run the passes specified by the pass manager\n    # TODO return the property set too. See #1086\n    name = dag.name\n    dag = pass_manager.run_passes(dag)\n    dag.name = name\n\n    return dag\n", "path": "qiskit/transpiler/transpiler.py"}], "after_files": [{"content": "# -*- coding: utf-8 -*-\n\n# Copyright 2018, IBM.\n#\n# This source code is licensed under the Apache License, Version 2.0 found in\n# the LICENSE.txt file in the root directory of this source tree.\n\n\"\"\"Tools for compiling a batch of quantum circuits.\"\"\"\nimport logging\nimport warnings\n\nfrom qiskit.circuit import QuantumCircuit\nfrom qiskit.mapper import CouplingMap\nfrom qiskit.tools.parallel import parallel_map\nfrom qiskit.converters import circuit_to_dag\nfrom qiskit.converters import dag_to_circuit\nfrom qiskit.mapper.layout import Layout\nfrom qiskit.transpiler.exceptions import TranspilerError\nfrom qiskit.transpiler.preset_passmanagers import default_pass_manager_simulator, \\\n    default_pass_manager\n\nlogger = logging.getLogger(__name__)\n\n\ndef transpile(circuits, backend=None, basis_gates=None, coupling_map=None,\n              initial_layout=None, seed_mapper=None, pass_manager=None):\n    \"\"\"transpile one or more circuits.\n\n    Args:\n        circuits (QuantumCircuit or list[QuantumCircuit]): circuits to compile\n        backend (BaseBackend): a backend to compile for\n        basis_gates (list[str]): list of basis gate names supported by the\n            target. Default: ['u1','u2','u3','cx','id']\n        coupling_map (list): coupling map (perhaps custom) to target in mapping\n        initial_layout (list): initial layout of qubits in mapping\n        seed_mapper (int): random seed for the swap_mapper\n        pass_manager (PassManager): a pass_manager for the transpiler stages\n\n    Returns:\n        QuantumCircuit or list[QuantumCircuit]: transpiled circuit(s).\n    \"\"\"\n    return_form_is_single = False\n    if isinstance(circuits, QuantumCircuit):\n        circuits = [circuits]\n        return_form_is_single = True\n\n    # pass manager overrides explicit transpile options (basis_gates, coupling_map)\n    # explicit transpile options override options gotten from a backend\n    if not pass_manager and backend:\n        basis_gates = basis_gates or getattr(backend.configuration(), 'basis_gates', None)\n        # This needs to be removed once Aer 0.2 is out\n        coupling_map = coupling_map or getattr(backend.configuration(), 'coupling_map', None)\n\n    # Convert integer list format to Layout\n    if isinstance(initial_layout, list) and \\\n            all(isinstance(elem, int) for elem in initial_layout):\n        if isinstance(circuits, list):\n            circ = circuits[0]\n        else:\n            circ = circuits\n        initial_layout = Layout.generate_from_intlist(initial_layout, *circ.qregs)\n\n    if initial_layout is not None and not isinstance(initial_layout, Layout):\n        initial_layout = Layout(initial_layout)\n\n    circuits = parallel_map(_transpilation, circuits,\n                            task_kwargs={'basis_gates': basis_gates,\n                                         'coupling_map': coupling_map,\n                                         'initial_layout': initial_layout,\n                                         'seed_mapper': seed_mapper,\n                                         'pass_manager': pass_manager})\n    if return_form_is_single:\n        return circuits[0]\n    return circuits\n\n\ndef _transpilation(circuit, basis_gates=None, coupling_map=None,\n                   initial_layout=None, seed_mapper=None,\n                   pass_manager=None):\n    \"\"\"Perform transpilation of a single circuit.\n\n    Args:\n        circuit (QuantumCircuit): A circuit to transpile.\n        basis_gates (list[str]): list of basis gate names supported by the\n            target. Default: ['u1','u2','u3','cx','id']\n        coupling_map (CouplingMap): coupling map (perhaps custom) to target in mapping\n        initial_layout (Layout): initial layout of qubits in mapping\n        seed_mapper (int): random seed for the swap_mapper\n        pass_manager (PassManager): a pass_manager for the transpiler stage\n\n    Returns:\n        QuantumCircuit: A transpiled circuit.\n\n    Raises:\n        TranspilerError: If the Layout does not matches the circuit\n    \"\"\"\n    if initial_layout is not None and set(circuit.qregs) != initial_layout.get_registers():\n        raise TranspilerError('The provided initial layout does not match the registers in '\n                              'the circuit \"%s\"' % circuit.name)\n\n    if pass_manager and not pass_manager.working_list:\n        return circuit\n\n    is_parametric_circuit = bool(circuit.unassigned_variables)\n\n    dag = circuit_to_dag(circuit)\n    del circuit\n\n    final_dag = _transpile_dag(dag, basis_gates=basis_gates,\n                               coupling_map=coupling_map,\n                               initial_layout=initial_layout,\n                               skip_numeric_passes=is_parametric_circuit,\n                               seed_mapper=seed_mapper,\n                               pass_manager=pass_manager)\n\n    out_circuit = dag_to_circuit(final_dag)\n\n    return out_circuit\n\n\ndef transpile_dag(dag, basis_gates=None, coupling_map=None,\n                  initial_layout=None, skip_numeric_passes=None,\n                  seed_mapper=None, pass_manager=None):\n    \"\"\"Deprecated - Transform a dag circuit into another dag circuit\n    (transpile), through consecutive passes on the dag.\n\n    Args:\n        dag (DAGCircuit): dag circuit to transform via transpilation\n        basis_gates (list[str]): list of basis gate names supported by the\n            target. Default: ['u1','u2','u3','cx','id']\n        coupling_map (list): A graph of coupling::\n\n            [\n             [control0(int), target0(int)],\n             [control1(int), target1(int)],\n            ]\n\n            eg. [[0, 2], [1, 2], [1, 3], [3, 4]}\n\n        initial_layout (Layout or None): A layout object\n        skip_numeric_passes (bool): If true, skip passes which require fixed parameter values\n        seed_mapper (int): random seed_mapper for the swap mapper\n        pass_manager (PassManager): pass manager instance for the transpilation process\n            If None, a default set of passes are run.\n            Otherwise, the passes defined in it will run.\n            If contains no passes in it, no dag transformations occur.\n\n    Returns:\n        DAGCircuit: transformed dag\n    \"\"\"\n\n    warnings.warn(\"transpile_dag has been deprecated and will be removed in the \"\n                  \"0.9 release. Circuits can be transpiled directly to other \"\n                  \"circuits with the transpile function.\", DeprecationWarning)\n    return _transpile_dag(dag, basis_gates, coupling_map, initial_layout,\n                          skip_numeric_passes, seed_mapper, pass_manager)\n\n\ndef _transpile_dag(dag, basis_gates=None, coupling_map=None,\n                   initial_layout=None, skip_numeric_passes=None,\n                   seed_mapper=None, pass_manager=None):\n    \"\"\"Transform a dag circuit into another dag circuit (transpile), through\n    consecutive passes on the dag.\n\n    Args:\n        dag (DAGCircuit): dag circuit to transform via transpilation\n        basis_gates (list[str]): list of basis gate names supported by the\n            target. Default: ['u1','u2','u3','cx','id']\n        coupling_map (list): A graph of coupling::\n\n            [\n             [control0(int), target0(int)],\n             [control1(int), target1(int)],\n            ]\n\n            eg. [[0, 2], [1, 2], [1, 3], [3, 4]}\n\n        initial_layout (Layout or None): A layout object\n        skip_numeric_passes (bool): If true, skip passes which require fixed parameter values\n        seed_mapper (int): random seed_mapper for the swap mapper\n        pass_manager (PassManager): pass manager instance for the transpilation process\n            If None, a default set of passes are run.\n            Otherwise, the passes defined in it will run.\n            If contains no passes in it, no dag transformations occur.\n\n    Returns:\n        DAGCircuit: transformed dag\n    \"\"\"\n    # TODO: `basis_gates` will be removed after we have the unroller pass.\n    # TODO: `coupling_map`, `initial_layout`, `seed_mapper` removed after mapper pass.\n\n    if basis_gates is None:\n        basis_gates = ['u1', 'u2', 'u3', 'cx', 'id']\n    if isinstance(basis_gates, str):\n        warnings.warn(\"The parameter basis_gates is now a list of strings. \"\n                      \"For example, this basis ['u1','u2','u3','cx'] should be used \"\n                      \"instead of 'u1,u2,u3,cx'. The string format will be \"\n                      \"removed after 0.9\", DeprecationWarning, 2)\n        basis_gates = basis_gates.split(',')\n\n    if pass_manager is None:\n        # default set of passes\n\n        # if a coupling map is given compile to the map\n        if coupling_map:\n            pass_manager = default_pass_manager(basis_gates,\n                                                CouplingMap(coupling_map),\n                                                initial_layout,\n                                                skip_numeric_passes,\n                                                seed_mapper=seed_mapper)\n        else:\n            pass_manager = default_pass_manager_simulator(basis_gates)\n\n    # run the passes specified by the pass manager\n    # TODO return the property set too. See #1086\n    name = dag.name\n    dag = pass_manager.run_passes(dag)\n    dag.name = name\n\n    return dag\n", "path": "qiskit/transpiler/transpiler.py"}]}