We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
[Requires Aer 0.2] BackendSchema list coupling_map as optional
<!-- ⚠️ If you do not respect this template, your issue will be closed -->
<!-- ⚠️ Make sure to browse the opened and closed issues -->

### Information

- **Qiskit Terra version**:
- **Python version**:
- **Operating system**:

### What is the current behavior?
The schemas in `qiskit.providers.model` list `coupling_map` as an optional field in the `backend.configuration` when it is in fact required.


### Steps to reproduce the problem



### What is the expected behavior?



### Suggested solutions




--- 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/providers/models/backendconfiguration.py`
Content:
```
1 # -*- coding: utf-8 -*-
2 
3 # This code is part of Qiskit.
4 #
5 # (C) Copyright IBM 2017, 2018.
6 #
7 # This code is licensed under the Apache License, Version 2.0. You may
8 # obtain a copy of this license in the LICENSE.txt file in the root directory
9 # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
10 #
11 # Any modifications or derivative works of this code must retain this
12 # copyright notice, and modified files need to carry a notice indicating
13 # that they have been altered from the originals.
14 
15 """Model and schema for backend configuration."""
16 
17 from marshmallow.validate import Length, OneOf, Range, Regexp
18 
19 from qiskit.validation import BaseModel, BaseSchema, bind_schema
20 from qiskit.validation.fields import (Boolean, DateTime, Integer, List, Nested, String,
21                                       Complex, Float, Dict, InstructionParameter)
22 from qiskit.validation.validate import PatternProperties
23 
24 
25 class GateConfigSchema(BaseSchema):
26     """Schema for GateConfig."""
27 
28     # Required properties.
29     name = String(required=True)
30     parameters = List(String(), required=True)
31     qasm_def = String(required=True)
32 
33     # Optional properties.
34     coupling_map = List(List(Integer(),
35                              validate=Length(min=1)),
36                         validate=Length(min=1))
37     latency_map = List(List(Integer(validate=OneOf([0, 1])),
38                             validate=Length(min=1)),
39                        validate=Length(min=1))
40     conditional = Boolean()
41     description = String()
42 
43 
44 class UchannelLOSchema(BaseSchema):
45     """Schema for uchannel LO."""
46 
47     # Required properties.
48     q = Integer(required=True, validate=Range(min=0))
49     scale = Complex(required=True)
50 
51     # Optional properties.
52 
53 
54 class PulseHamiltonianSchema(BaseSchema):
55     """Schema for PulseHamiltonian."""
56 
57     # Required properties.
58     h_str = List(String(), validate=Length(min=1), required=True)
59     dim_osc = List(Integer(validate=Range(min=1)), required=True)
60     dim_qub = List(Integer(validate=Range(min=2)), required=True)
61     vars = Dict(validate=PatternProperties({
62         Regexp('^([a-z0-9])+$'): InstructionParameter()
63     }), required=True)
64 
65     # Optional properties.
66 
67 
68 class BackendConfigurationSchema(BaseSchema):
69     """Schema for BackendConfiguration."""
70     # Required properties.
71     backend_name = String(required=True)
72     backend_version = String(required=True,
73                              validate=Regexp("[0-9]+.[0-9]+.[0-9]+$"))
74     n_qubits = Integer(required=True, validate=Range(min=1))
75     basis_gates = List(String(), required=True)
76     gates = Nested(GateConfigSchema, required=True, many=True)
77     local = Boolean(required=True)
78     simulator = Boolean(required=True)
79     conditional = Boolean(required=True)
80     open_pulse = Boolean(required=True)
81     memory = Boolean(required=True)
82     max_shots = Integer(required=True, validate=Range(min=1))
83 
84     # Optional properties.
85     max_experiments = Integer(validate=Range(min=1))
86     sample_name = String()
87     coupling_map = List(List(Integer(),
88                              validate=Length(min=1)),
89                         validate=Length(min=1), allow_none=True)
90     n_registers = Integer(validate=Range(min=1))
91     register_map = List(List(Integer(validate=OneOf([0, 1])),
92                              validate=Length(min=1)),
93                         validate=Length(min=1))
94     configurable = Boolean()
95     credits_required = Boolean()
96     online_date = DateTime()
97     display_name = String()
98     description = String()
99     tags = List(String())
100 
101 
102 class QasmBackendConfigurationSchema(BackendConfigurationSchema):
103     """Schema for Qasm backend."""
104     open_pulse = Boolean(required=True, validate=OneOf([False]))
105 
106 
107 class PulseBackendConfigurationSchema(QasmBackendConfigurationSchema):
108     """Schema for pulse backend"""
109     # Required properties.
110     open_pulse = Boolean(required=True, validate=OneOf([True]))
111     n_uchannels = Integer(required=True, validate=Range(min=0))
112     u_channel_lo = List(Nested(UchannelLOSchema, validate=Length(min=1),
113                                required=True, many=True))
114     meas_levels = List(Integer(), validate=Length(min=1), required=True)
115     qubit_lo_range = List(List(Float(validate=Range(min=0)),
116                                validate=Length(equal=2)), required=True)
117     meas_lo_range = List(List(Float(validate=Range(min=0)),
118                               validate=Length(equal=2)), required=True)
119     dt = Float(required=True, validate=Range(min=0))  # pylint: disable=invalid-name
120     dtm = Float(required=True, validate=Range(min=0))
121     rep_times = List(Integer(validate=Range(min=0)), required=True)
122     meas_kernels = List(String(), required=True)
123     discriminators = List(String(), required=True)
124 
125     # Optional properties.
126     meas_map = List(List(Integer(), validate=Length(min=1)))
127     channel_bandwidth = List(List(Float(), validate=Length(equal=2)))
128     acquisition_latency = List(List(Integer()))
129     conditional_latency = List(List(Integer()))
130     hamiltonian = PulseHamiltonianSchema()
131 
132 
133 @bind_schema(GateConfigSchema)
134 class GateConfig(BaseModel):
135     """Model for GateConfig.
136 
137     Please note that this class only describes the required fields. For the
138     full description of the model, please check ``GateConfigSchema``.
139 
140     Attributes:
141         name (str): the gate name as it will be referred to in Qasm.
142         parameters (list[str]): variable names for the gate parameters (if any).
143         qasm_def (str): definition of this gate in terms of Qasm primitives U
144             and CX.
145     """
146 
147     def __init__(self, name, parameters, qasm_def, **kwargs):
148         self.name = name
149         self.parameters = parameters
150         self.qasm_def = qasm_def
151 
152         super().__init__(**kwargs)
153 
154 
155 @bind_schema(UchannelLOSchema)
156 class UchannelLO(BaseModel):
157     """Model for GateConfig.
158 
159     Please note that this class only describes the required fields. For the
160     full description of the model, please check ``GateConfigSchema``.
161 
162     Attributes:
163         q (int): Qubit that scale corresponds too.
164         scale (complex): Scale factor for qubit frequency.
165     """
166     def __init__(self, q, scale, **kwargs):
167 
168         self.q = q
169         self.scale = scale
170 
171         super().__init__(q=q, scale=scale, **kwargs)
172 
173 
174 @bind_schema(BackendConfigurationSchema)
175 class BackendConfiguration(BaseModel):
176     """Model for BackendConfiguration.
177 
178     Please note that this class only describes the required fields. For the
179     full description of the model, please check ``BackendConfigurationSchema``.
180     Attributes:
181         backend_name (str): backend name.
182         backend_version (str): backend version in the form X.Y.Z.
183         n_qubits (int): number of qubits.
184         basis_gates (list[str]): list of basis gates names on the backend.
185         gates (GateConfig): list of basis gates on the backend.
186         local (bool): backend is local or remote.
187         simulator (bool): backend is a simulator.
188         conditional (bool): backend supports conditional operations.
189         open_pulse (bool): backend supports open pulse.
190         memory (bool): backend supports memory.
191         max_shots (int): maximum number of shots supported.
192     """
193 
194     def __init__(self, backend_name, backend_version, n_qubits, basis_gates,
195                  gates, local, simulator, conditional, open_pulse, memory,
196                  max_shots, **kwargs):
197 
198         self.backend_name = backend_name
199         self.backend_version = backend_version
200         self.n_qubits = n_qubits
201         self.basis_gates = basis_gates
202         self.gates = gates
203         self.local = local
204         self.simulator = simulator
205         self.conditional = conditional
206         self.open_pulse = open_pulse
207         self.memory = memory
208         self.max_shots = max_shots
209 
210         super().__init__(**kwargs)
211 
212 
213 @bind_schema(QasmBackendConfigurationSchema)
214 class QasmBackendConfiguration(BackendConfiguration):
215     """Model for QasmBackendConfiguration.
216 
217     Please note that this class only describes the required fields. For the
218     full description of the model, please check ``QasmBackendConfigurationSchema``.
219     Attributes:
220         backend_name (str): backend name.
221         backend_version (str): backend version in the form X.Y.Z.
222         n_qubits (int): number of qubits.
223         basis_gates (list[str]): list of basis gates names on the backend.
224         gates (GateConfig): list of basis gates on the backend.
225         local (bool): backend is local or remote.
226         simulator (bool): backend is a simulator.
227         conditional (bool): backend supports conditional operations.
228         open_pulse (bool): backend supports open pulse.
229         memory (bool): backend supports memory.
230         max_shots (int): maximum number of shots supported.
231         **kwargs: Optional fields.
232     """
233 
234     def __init__(self, backend_name, backend_version, n_qubits, basis_gates,
235                  gates, local, simulator, conditional, open_pulse, memory,
236                  max_shots, **kwargs):
237 
238         super().__init__(backend_name=backend_name, backend_version=backend_version,
239                          n_qubits=n_qubits, basis_gates=basis_gates, gates=gates,
240                          local=local, simulator=simulator, conditional=conditional,
241                          open_pulse=open_pulse, memory=memory, max_shots=max_shots,
242                          **kwargs)
243 
244 
245 @bind_schema(PulseBackendConfigurationSchema)
246 class PulseBackendConfiguration(BackendConfiguration):
247     """Model for PulseBackendConfiguration.
248 
249     Please note that this class only describes the required fields. For the
250     full description of the model, please check ``PulseBackendConfigurationSchema``.
251     Attributes:
252         backend_name (str): backend name.
253         backend_version (str): backend version in the form X.Y.Z.
254         n_qubits (int): number of qubits.
255         basis_gates (list[str]): list of basis gates names on the backend.
256         gates (GateConfig): list of basis gates on the backend.
257         local (bool): backend is local or remote.
258         simulator (bool): backend is a simulator.
259         conditional (bool): backend supports conditional operations.
260         open_pulse (bool): backend supports open pulse.
261         memory (bool): backend supports memory.
262         max_shots (int): maximum number of shots supported.
263         n_uchannels (int): Number of u-channels.
264         u_channel_lo (list[UchannelLO]): U-channel relationship on device los.
265         meas_levels (list[int]): Supported measurement levels.
266         qubit_lo_range (list[list[float]]): Qubit lo ranges for each qubit
267             with form (min, max) in GHz.
268         meas_lo_range (list[list[float]]): Measurement lo ranges for each qubit
269             with form (min, max) in GHz.
270         dt (float): Qubit drive channel timestep in nanoseconds.
271         dtm (float): Measurement drive channel timestep in nanoseconds.
272         rep_times (list[float]): Supported repetition times for device in microseconds.
273         meas_kernels (list[str]): Supported measurement kernels.
274         discriminators: Supported discriminators.
275         **kwargs: Optional fields.
276     """
277 
278     def __init__(self, backend_name, backend_version, n_qubits, basis_gates,
279                  gates, local, simulator, conditional, open_pulse, memory,
280                  max_shots, n_uchannels, u_channel_lo, meas_levels,
281                  qubit_lo_range, meas_lo_range, dt, dtm, rep_times, meas_kernels,
282                  discriminators, **kwargs):
283 
284         self.n_uchannels = n_uchannels
285         self.u_channel_lo = u_channel_lo
286         self.meas_levels = meas_levels
287         self.qubit_lo_range = qubit_lo_range
288         self.meas_lo_range = meas_lo_range
289         self.dt = dt  # pylint: disable=invalid-name
290         self.dtm = dtm
291         self.rep_times = rep_times
292         self.meas_kernels = meas_kernels
293         self.discriminators = discriminators
294 
295         super().__init__(backend_name=backend_name, backend_version=backend_version,
296                          n_qubits=n_qubits, basis_gates=basis_gates, gates=gates,
297                          local=local, simulator=simulator, conditional=conditional,
298                          open_pulse=open_pulse, memory=memory, max_shots=max_shots,
299                          n_uchannels=n_uchannels, u_channel_lo=u_channel_lo,
300                          meas_levels=meas_levels, qubit_lo_range=qubit_lo_range,
301                          meas_lo_range=meas_lo_range, dt=dt, dtm=dtm,
302                          rep_times=rep_times, meas_kernels=meas_kernels,
303                          discriminators=discriminators, **kwargs)
304
```
--- 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/providers/models/backendconfiguration.py b/qiskit/providers/models/backendconfiguration.py
--- a/qiskit/providers/models/backendconfiguration.py
+++ b/qiskit/providers/models/backendconfiguration.py
@@ -80,13 +80,12 @@
     open_pulse = Boolean(required=True)
     memory = Boolean(required=True)
     max_shots = Integer(required=True, validate=Range(min=1))
+    coupling_map = List(List(Integer(), validate=Length(min=1)),
+                        validate=Length(min=1), allow_none=True, required=True)
 
     # Optional properties.
     max_experiments = Integer(validate=Range(min=1))
     sample_name = String()
-    coupling_map = List(List(Integer(),
-                             validate=Length(min=1)),
-                        validate=Length(min=1), allow_none=True)
     n_registers = Integer(validate=Range(min=1))
     register_map = List(List(Integer(validate=OneOf([0, 1])),
                              validate=Length(min=1)),

{"golden_diff": "diff --git a/qiskit/providers/models/backendconfiguration.py b/qiskit/providers/models/backendconfiguration.py\n--- a/qiskit/providers/models/backendconfiguration.py\n+++ b/qiskit/providers/models/backendconfiguration.py\n@@ -80,13 +80,12 @@\n     open_pulse = Boolean(required=True)\n     memory = Boolean(required=True)\n     max_shots = Integer(required=True, validate=Range(min=1))\n+    coupling_map = List(List(Integer(), validate=Length(min=1)),\n+                        validate=Length(min=1), allow_none=True, required=True)\n \n     # Optional properties.\n     max_experiments = Integer(validate=Range(min=1))\n     sample_name = String()\n-    coupling_map = List(List(Integer(),\n-                             validate=Length(min=1)),\n-                        validate=Length(min=1), allow_none=True)\n     n_registers = Integer(validate=Range(min=1))\n     register_map = List(List(Integer(validate=OneOf([0, 1])),\n                              validate=Length(min=1)),\n", "issue": "[Requires Aer 0.2] BackendSchema list coupling_map as optional\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 -->\r\n\r\n### Information\r\n\r\n- **Qiskit Terra version**:\r\n- **Python version**:\r\n- **Operating system**:\r\n\r\n### What is the current behavior?\r\nThe schemas in `qiskit.providers.model` list `coupling_map` as an optional field in the `backend.configuration` when it is in fact required.\r\n\r\n\r\n### Steps to reproduce the problem\r\n\r\n\r\n\r\n### What is the expected behavior?\r\n\r\n\r\n\r\n### Suggested solutions\r\n\r\n\r\n\n", "before_files": [{"content": "# -*- coding: utf-8 -*-\n\n# This code is part of Qiskit.\n#\n# (C) Copyright IBM 2017, 2018.\n#\n# This code is licensed under the Apache License, Version 2.0. You may\n# obtain a copy of this license in the LICENSE.txt file in the root directory\n# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.\n#\n# Any modifications or derivative works of this code must retain this\n# copyright notice, and modified files need to carry a notice indicating\n# that they have been altered from the originals.\n\n\"\"\"Model and schema for backend configuration.\"\"\"\n\nfrom marshmallow.validate import Length, OneOf, Range, Regexp\n\nfrom qiskit.validation import BaseModel, BaseSchema, bind_schema\nfrom qiskit.validation.fields import (Boolean, DateTime, Integer, List, Nested, String,\n                                      Complex, Float, Dict, InstructionParameter)\nfrom qiskit.validation.validate import PatternProperties\n\n\nclass GateConfigSchema(BaseSchema):\n    \"\"\"Schema for GateConfig.\"\"\"\n\n    # Required properties.\n    name = String(required=True)\n    parameters = List(String(), required=True)\n    qasm_def = String(required=True)\n\n    # Optional properties.\n    coupling_map = List(List(Integer(),\n                             validate=Length(min=1)),\n                        validate=Length(min=1))\n    latency_map = List(List(Integer(validate=OneOf([0, 1])),\n                            validate=Length(min=1)),\n                       validate=Length(min=1))\n    conditional = Boolean()\n    description = String()\n\n\nclass UchannelLOSchema(BaseSchema):\n    \"\"\"Schema for uchannel LO.\"\"\"\n\n    # Required properties.\n    q = Integer(required=True, validate=Range(min=0))\n    scale = Complex(required=True)\n\n    # Optional properties.\n\n\nclass PulseHamiltonianSchema(BaseSchema):\n    \"\"\"Schema for PulseHamiltonian.\"\"\"\n\n    # Required properties.\n    h_str = List(String(), validate=Length(min=1), required=True)\n    dim_osc = List(Integer(validate=Range(min=1)), required=True)\n    dim_qub = List(Integer(validate=Range(min=2)), required=True)\n    vars = Dict(validate=PatternProperties({\n        Regexp('^([a-z0-9])+$'): InstructionParameter()\n    }), required=True)\n\n    # Optional properties.\n\n\nclass BackendConfigurationSchema(BaseSchema):\n    \"\"\"Schema for BackendConfiguration.\"\"\"\n    # Required properties.\n    backend_name = String(required=True)\n    backend_version = String(required=True,\n                             validate=Regexp(\"[0-9]+.[0-9]+.[0-9]+$\"))\n    n_qubits = Integer(required=True, validate=Range(min=1))\n    basis_gates = List(String(), required=True)\n    gates = Nested(GateConfigSchema, required=True, many=True)\n    local = Boolean(required=True)\n    simulator = Boolean(required=True)\n    conditional = Boolean(required=True)\n    open_pulse = Boolean(required=True)\n    memory = Boolean(required=True)\n    max_shots = Integer(required=True, validate=Range(min=1))\n\n    # Optional properties.\n    max_experiments = Integer(validate=Range(min=1))\n    sample_name = String()\n    coupling_map = List(List(Integer(),\n                             validate=Length(min=1)),\n                        validate=Length(min=1), allow_none=True)\n    n_registers = Integer(validate=Range(min=1))\n    register_map = List(List(Integer(validate=OneOf([0, 1])),\n                             validate=Length(min=1)),\n                        validate=Length(min=1))\n    configurable = Boolean()\n    credits_required = Boolean()\n    online_date = DateTime()\n    display_name = String()\n    description = String()\n    tags = List(String())\n\n\nclass QasmBackendConfigurationSchema(BackendConfigurationSchema):\n    \"\"\"Schema for Qasm backend.\"\"\"\n    open_pulse = Boolean(required=True, validate=OneOf([False]))\n\n\nclass PulseBackendConfigurationSchema(QasmBackendConfigurationSchema):\n    \"\"\"Schema for pulse backend\"\"\"\n    # Required properties.\n    open_pulse = Boolean(required=True, validate=OneOf([True]))\n    n_uchannels = Integer(required=True, validate=Range(min=0))\n    u_channel_lo = List(Nested(UchannelLOSchema, validate=Length(min=1),\n                               required=True, many=True))\n    meas_levels = List(Integer(), validate=Length(min=1), required=True)\n    qubit_lo_range = List(List(Float(validate=Range(min=0)),\n                               validate=Length(equal=2)), required=True)\n    meas_lo_range = List(List(Float(validate=Range(min=0)),\n                              validate=Length(equal=2)), required=True)\n    dt = Float(required=True, validate=Range(min=0))  # pylint: disable=invalid-name\n    dtm = Float(required=True, validate=Range(min=0))\n    rep_times = List(Integer(validate=Range(min=0)), required=True)\n    meas_kernels = List(String(), required=True)\n    discriminators = List(String(), required=True)\n\n    # Optional properties.\n    meas_map = List(List(Integer(), validate=Length(min=1)))\n    channel_bandwidth = List(List(Float(), validate=Length(equal=2)))\n    acquisition_latency = List(List(Integer()))\n    conditional_latency = List(List(Integer()))\n    hamiltonian = PulseHamiltonianSchema()\n\n\n@bind_schema(GateConfigSchema)\nclass GateConfig(BaseModel):\n    \"\"\"Model for GateConfig.\n\n    Please note that this class only describes the required fields. For the\n    full description of the model, please check ``GateConfigSchema``.\n\n    Attributes:\n        name (str): the gate name as it will be referred to in Qasm.\n        parameters (list[str]): variable names for the gate parameters (if any).\n        qasm_def (str): definition of this gate in terms of Qasm primitives U\n            and CX.\n    \"\"\"\n\n    def __init__(self, name, parameters, qasm_def, **kwargs):\n        self.name = name\n        self.parameters = parameters\n        self.qasm_def = qasm_def\n\n        super().__init__(**kwargs)\n\n\n@bind_schema(UchannelLOSchema)\nclass UchannelLO(BaseModel):\n    \"\"\"Model for GateConfig.\n\n    Please note that this class only describes the required fields. For the\n    full description of the model, please check ``GateConfigSchema``.\n\n    Attributes:\n        q (int): Qubit that scale corresponds too.\n        scale (complex): Scale factor for qubit frequency.\n    \"\"\"\n    def __init__(self, q, scale, **kwargs):\n\n        self.q = q\n        self.scale = scale\n\n        super().__init__(q=q, scale=scale, **kwargs)\n\n\n@bind_schema(BackendConfigurationSchema)\nclass BackendConfiguration(BaseModel):\n    \"\"\"Model for BackendConfiguration.\n\n    Please note that this class only describes the required fields. For the\n    full description of the model, please check ``BackendConfigurationSchema``.\n    Attributes:\n        backend_name (str): backend name.\n        backend_version (str): backend version in the form X.Y.Z.\n        n_qubits (int): number of qubits.\n        basis_gates (list[str]): list of basis gates names on the backend.\n        gates (GateConfig): list of basis gates on the backend.\n        local (bool): backend is local or remote.\n        simulator (bool): backend is a simulator.\n        conditional (bool): backend supports conditional operations.\n        open_pulse (bool): backend supports open pulse.\n        memory (bool): backend supports memory.\n        max_shots (int): maximum number of shots supported.\n    \"\"\"\n\n    def __init__(self, backend_name, backend_version, n_qubits, basis_gates,\n                 gates, local, simulator, conditional, open_pulse, memory,\n                 max_shots, **kwargs):\n\n        self.backend_name = backend_name\n        self.backend_version = backend_version\n        self.n_qubits = n_qubits\n        self.basis_gates = basis_gates\n        self.gates = gates\n        self.local = local\n        self.simulator = simulator\n        self.conditional = conditional\n        self.open_pulse = open_pulse\n        self.memory = memory\n        self.max_shots = max_shots\n\n        super().__init__(**kwargs)\n\n\n@bind_schema(QasmBackendConfigurationSchema)\nclass QasmBackendConfiguration(BackendConfiguration):\n    \"\"\"Model for QasmBackendConfiguration.\n\n    Please note that this class only describes the required fields. For the\n    full description of the model, please check ``QasmBackendConfigurationSchema``.\n    Attributes:\n        backend_name (str): backend name.\n        backend_version (str): backend version in the form X.Y.Z.\n        n_qubits (int): number of qubits.\n        basis_gates (list[str]): list of basis gates names on the backend.\n        gates (GateConfig): list of basis gates on the backend.\n        local (bool): backend is local or remote.\n        simulator (bool): backend is a simulator.\n        conditional (bool): backend supports conditional operations.\n        open_pulse (bool): backend supports open pulse.\n        memory (bool): backend supports memory.\n        max_shots (int): maximum number of shots supported.\n        **kwargs: Optional fields.\n    \"\"\"\n\n    def __init__(self, backend_name, backend_version, n_qubits, basis_gates,\n                 gates, local, simulator, conditional, open_pulse, memory,\n                 max_shots, **kwargs):\n\n        super().__init__(backend_name=backend_name, backend_version=backend_version,\n                         n_qubits=n_qubits, basis_gates=basis_gates, gates=gates,\n                         local=local, simulator=simulator, conditional=conditional,\n                         open_pulse=open_pulse, memory=memory, max_shots=max_shots,\n                         **kwargs)\n\n\n@bind_schema(PulseBackendConfigurationSchema)\nclass PulseBackendConfiguration(BackendConfiguration):\n    \"\"\"Model for PulseBackendConfiguration.\n\n    Please note that this class only describes the required fields. For the\n    full description of the model, please check ``PulseBackendConfigurationSchema``.\n    Attributes:\n        backend_name (str): backend name.\n        backend_version (str): backend version in the form X.Y.Z.\n        n_qubits (int): number of qubits.\n        basis_gates (list[str]): list of basis gates names on the backend.\n        gates (GateConfig): list of basis gates on the backend.\n        local (bool): backend is local or remote.\n        simulator (bool): backend is a simulator.\n        conditional (bool): backend supports conditional operations.\n        open_pulse (bool): backend supports open pulse.\n        memory (bool): backend supports memory.\n        max_shots (int): maximum number of shots supported.\n        n_uchannels (int): Number of u-channels.\n        u_channel_lo (list[UchannelLO]): U-channel relationship on device los.\n        meas_levels (list[int]): Supported measurement levels.\n        qubit_lo_range (list[list[float]]): Qubit lo ranges for each qubit\n            with form (min, max) in GHz.\n        meas_lo_range (list[list[float]]): Measurement lo ranges for each qubit\n            with form (min, max) in GHz.\n        dt (float): Qubit drive channel timestep in nanoseconds.\n        dtm (float): Measurement drive channel timestep in nanoseconds.\n        rep_times (list[float]): Supported repetition times for device in microseconds.\n        meas_kernels (list[str]): Supported measurement kernels.\n        discriminators: Supported discriminators.\n        **kwargs: Optional fields.\n    \"\"\"\n\n    def __init__(self, backend_name, backend_version, n_qubits, basis_gates,\n                 gates, local, simulator, conditional, open_pulse, memory,\n                 max_shots, n_uchannels, u_channel_lo, meas_levels,\n                 qubit_lo_range, meas_lo_range, dt, dtm, rep_times, meas_kernels,\n                 discriminators, **kwargs):\n\n        self.n_uchannels = n_uchannels\n        self.u_channel_lo = u_channel_lo\n        self.meas_levels = meas_levels\n        self.qubit_lo_range = qubit_lo_range\n        self.meas_lo_range = meas_lo_range\n        self.dt = dt  # pylint: disable=invalid-name\n        self.dtm = dtm\n        self.rep_times = rep_times\n        self.meas_kernels = meas_kernels\n        self.discriminators = discriminators\n\n        super().__init__(backend_name=backend_name, backend_version=backend_version,\n                         n_qubits=n_qubits, basis_gates=basis_gates, gates=gates,\n                         local=local, simulator=simulator, conditional=conditional,\n                         open_pulse=open_pulse, memory=memory, max_shots=max_shots,\n                         n_uchannels=n_uchannels, u_channel_lo=u_channel_lo,\n                         meas_levels=meas_levels, qubit_lo_range=qubit_lo_range,\n                         meas_lo_range=meas_lo_range, dt=dt, dtm=dtm,\n                         rep_times=rep_times, meas_kernels=meas_kernels,\n                         discriminators=discriminators, **kwargs)\n", "path": "qiskit/providers/models/backendconfiguration.py"}], "after_files": [{"content": "# -*- coding: utf-8 -*-\n\n# This code is part of Qiskit.\n#\n# (C) Copyright IBM 2017, 2018.\n#\n# This code is licensed under the Apache License, Version 2.0. You may\n# obtain a copy of this license in the LICENSE.txt file in the root directory\n# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.\n#\n# Any modifications or derivative works of this code must retain this\n# copyright notice, and modified files need to carry a notice indicating\n# that they have been altered from the originals.\n\n\"\"\"Model and schema for backend configuration.\"\"\"\n\nfrom marshmallow.validate import Length, OneOf, Range, Regexp\n\nfrom qiskit.validation import BaseModel, BaseSchema, bind_schema\nfrom qiskit.validation.fields import (Boolean, DateTime, Integer, List, Nested, String,\n                                      Complex, Float, Dict, InstructionParameter)\nfrom qiskit.validation.validate import PatternProperties\n\n\nclass GateConfigSchema(BaseSchema):\n    \"\"\"Schema for GateConfig.\"\"\"\n\n    # Required properties.\n    name = String(required=True)\n    parameters = List(String(), required=True)\n    qasm_def = String(required=True)\n\n    # Optional properties.\n    coupling_map = List(List(Integer(),\n                             validate=Length(min=1)),\n                        validate=Length(min=1))\n    latency_map = List(List(Integer(validate=OneOf([0, 1])),\n                            validate=Length(min=1)),\n                       validate=Length(min=1))\n    conditional = Boolean()\n    description = String()\n\n\nclass UchannelLOSchema(BaseSchema):\n    \"\"\"Schema for uchannel LO.\"\"\"\n\n    # Required properties.\n    q = Integer(required=True, validate=Range(min=0))\n    scale = Complex(required=True)\n\n    # Optional properties.\n\n\nclass PulseHamiltonianSchema(BaseSchema):\n    \"\"\"Schema for PulseHamiltonian.\"\"\"\n\n    # Required properties.\n    h_str = List(String(), validate=Length(min=1), required=True)\n    dim_osc = List(Integer(validate=Range(min=1)), required=True)\n    dim_qub = List(Integer(validate=Range(min=2)), required=True)\n    vars = Dict(validate=PatternProperties({\n        Regexp('^([a-z0-9])+$'): InstructionParameter()\n    }), required=True)\n\n    # Optional properties.\n\n\nclass BackendConfigurationSchema(BaseSchema):\n    \"\"\"Schema for BackendConfiguration.\"\"\"\n    # Required properties.\n    backend_name = String(required=True)\n    backend_version = String(required=True,\n                             validate=Regexp(\"[0-9]+.[0-9]+.[0-9]+$\"))\n    n_qubits = Integer(required=True, validate=Range(min=1))\n    basis_gates = List(String(), required=True)\n    gates = Nested(GateConfigSchema, required=True, many=True)\n    local = Boolean(required=True)\n    simulator = Boolean(required=True)\n    conditional = Boolean(required=True)\n    open_pulse = Boolean(required=True)\n    memory = Boolean(required=True)\n    max_shots = Integer(required=True, validate=Range(min=1))\n    coupling_map = List(List(Integer(), validate=Length(min=1)),\n                        validate=Length(min=1), allow_none=True, required=True)\n\n    # Optional properties.\n    max_experiments = Integer(validate=Range(min=1))\n    sample_name = String()\n    n_registers = Integer(validate=Range(min=1))\n    register_map = List(List(Integer(validate=OneOf([0, 1])),\n                             validate=Length(min=1)),\n                        validate=Length(min=1))\n    configurable = Boolean()\n    credits_required = Boolean()\n    online_date = DateTime()\n    display_name = String()\n    description = String()\n    tags = List(String())\n\n\nclass QasmBackendConfigurationSchema(BackendConfigurationSchema):\n    \"\"\"Schema for Qasm backend.\"\"\"\n    open_pulse = Boolean(required=True, validate=OneOf([False]))\n\n\nclass PulseBackendConfigurationSchema(QasmBackendConfigurationSchema):\n    \"\"\"Schema for pulse backend\"\"\"\n    # Required properties.\n    open_pulse = Boolean(required=True, validate=OneOf([True]))\n    n_uchannels = Integer(required=True, validate=Range(min=0))\n    u_channel_lo = List(Nested(UchannelLOSchema, validate=Length(min=1),\n                               required=True, many=True))\n    meas_levels = List(Integer(), validate=Length(min=1), required=True)\n    qubit_lo_range = List(List(Float(validate=Range(min=0)),\n                               validate=Length(equal=2)), required=True)\n    meas_lo_range = List(List(Float(validate=Range(min=0)),\n                              validate=Length(equal=2)), required=True)\n    dt = Float(required=True, validate=Range(min=0))  # pylint: disable=invalid-name\n    dtm = Float(required=True, validate=Range(min=0))\n    rep_times = List(Integer(validate=Range(min=0)), required=True)\n    meas_kernels = List(String(), required=True)\n    discriminators = List(String(), required=True)\n\n    # Optional properties.\n    meas_map = List(List(Integer(), validate=Length(min=1)))\n    channel_bandwidth = List(List(Float(), validate=Length(equal=2)))\n    acquisition_latency = List(List(Integer()))\n    conditional_latency = List(List(Integer()))\n    hamiltonian = PulseHamiltonianSchema()\n\n\n@bind_schema(GateConfigSchema)\nclass GateConfig(BaseModel):\n    \"\"\"Model for GateConfig.\n\n    Please note that this class only describes the required fields. For the\n    full description of the model, please check ``GateConfigSchema``.\n\n    Attributes:\n        name (str): the gate name as it will be referred to in Qasm.\n        parameters (list[str]): variable names for the gate parameters (if any).\n        qasm_def (str): definition of this gate in terms of Qasm primitives U\n            and CX.\n    \"\"\"\n\n    def __init__(self, name, parameters, qasm_def, **kwargs):\n        self.name = name\n        self.parameters = parameters\n        self.qasm_def = qasm_def\n\n        super().__init__(**kwargs)\n\n\n@bind_schema(UchannelLOSchema)\nclass UchannelLO(BaseModel):\n    \"\"\"Model for GateConfig.\n\n    Please note that this class only describes the required fields. For the\n    full description of the model, please check ``GateConfigSchema``.\n\n    Attributes:\n        q (int): Qubit that scale corresponds too.\n        scale (complex): Scale factor for qubit frequency.\n    \"\"\"\n    def __init__(self, q, scale, **kwargs):\n\n        self.q = q\n        self.scale = scale\n\n        super().__init__(q=q, scale=scale, **kwargs)\n\n\n@bind_schema(BackendConfigurationSchema)\nclass BackendConfiguration(BaseModel):\n    \"\"\"Model for BackendConfiguration.\n\n    Please note that this class only describes the required fields. For the\n    full description of the model, please check ``BackendConfigurationSchema``.\n    Attributes:\n        backend_name (str): backend name.\n        backend_version (str): backend version in the form X.Y.Z.\n        n_qubits (int): number of qubits.\n        basis_gates (list[str]): list of basis gates names on the backend.\n        gates (GateConfig): list of basis gates on the backend.\n        local (bool): backend is local or remote.\n        simulator (bool): backend is a simulator.\n        conditional (bool): backend supports conditional operations.\n        open_pulse (bool): backend supports open pulse.\n        memory (bool): backend supports memory.\n        max_shots (int): maximum number of shots supported.\n    \"\"\"\n\n    def __init__(self, backend_name, backend_version, n_qubits, basis_gates,\n                 gates, local, simulator, conditional, open_pulse, memory,\n                 max_shots, **kwargs):\n\n        self.backend_name = backend_name\n        self.backend_version = backend_version\n        self.n_qubits = n_qubits\n        self.basis_gates = basis_gates\n        self.gates = gates\n        self.local = local\n        self.simulator = simulator\n        self.conditional = conditional\n        self.open_pulse = open_pulse\n        self.memory = memory\n        self.max_shots = max_shots\n\n        super().__init__(**kwargs)\n\n\n@bind_schema(QasmBackendConfigurationSchema)\nclass QasmBackendConfiguration(BackendConfiguration):\n    \"\"\"Model for QasmBackendConfiguration.\n\n    Please note that this class only describes the required fields. For the\n    full description of the model, please check ``QasmBackendConfigurationSchema``.\n    Attributes:\n        backend_name (str): backend name.\n        backend_version (str): backend version in the form X.Y.Z.\n        n_qubits (int): number of qubits.\n        basis_gates (list[str]): list of basis gates names on the backend.\n        gates (GateConfig): list of basis gates on the backend.\n        local (bool): backend is local or remote.\n        simulator (bool): backend is a simulator.\n        conditional (bool): backend supports conditional operations.\n        open_pulse (bool): backend supports open pulse.\n        memory (bool): backend supports memory.\n        max_shots (int): maximum number of shots supported.\n        **kwargs: Optional fields.\n    \"\"\"\n\n    def __init__(self, backend_name, backend_version, n_qubits, basis_gates,\n                 gates, local, simulator, conditional, open_pulse, memory,\n                 max_shots, **kwargs):\n\n        super().__init__(backend_name=backend_name, backend_version=backend_version,\n                         n_qubits=n_qubits, basis_gates=basis_gates, gates=gates,\n                         local=local, simulator=simulator, conditional=conditional,\n                         open_pulse=open_pulse, memory=memory, max_shots=max_shots,\n                         **kwargs)\n\n\n@bind_schema(PulseBackendConfigurationSchema)\nclass PulseBackendConfiguration(BackendConfiguration):\n    \"\"\"Model for PulseBackendConfiguration.\n\n    Please note that this class only describes the required fields. For the\n    full description of the model, please check ``PulseBackendConfigurationSchema``.\n    Attributes:\n        backend_name (str): backend name.\n        backend_version (str): backend version in the form X.Y.Z.\n        n_qubits (int): number of qubits.\n        basis_gates (list[str]): list of basis gates names on the backend.\n        gates (GateConfig): list of basis gates on the backend.\n        local (bool): backend is local or remote.\n        simulator (bool): backend is a simulator.\n        conditional (bool): backend supports conditional operations.\n        open_pulse (bool): backend supports open pulse.\n        memory (bool): backend supports memory.\n        max_shots (int): maximum number of shots supported.\n        n_uchannels (int): Number of u-channels.\n        u_channel_lo (list[UchannelLO]): U-channel relationship on device los.\n        meas_levels (list[int]): Supported measurement levels.\n        qubit_lo_range (list[list[float]]): Qubit lo ranges for each qubit\n            with form (min, max) in GHz.\n        meas_lo_range (list[list[float]]): Measurement lo ranges for each qubit\n            with form (min, max) in GHz.\n        dt (float): Qubit drive channel timestep in nanoseconds.\n        dtm (float): Measurement drive channel timestep in nanoseconds.\n        rep_times (list[float]): Supported repetition times for device in microseconds.\n        meas_kernels (list[str]): Supported measurement kernels.\n        discriminators: Supported discriminators.\n        **kwargs: Optional fields.\n    \"\"\"\n\n    def __init__(self, backend_name, backend_version, n_qubits, basis_gates,\n                 gates, local, simulator, conditional, open_pulse, memory,\n                 max_shots, n_uchannels, u_channel_lo, meas_levels,\n                 qubit_lo_range, meas_lo_range, dt, dtm, rep_times, meas_kernels,\n                 discriminators, **kwargs):\n\n        self.n_uchannels = n_uchannels\n        self.u_channel_lo = u_channel_lo\n        self.meas_levels = meas_levels\n        self.qubit_lo_range = qubit_lo_range\n        self.meas_lo_range = meas_lo_range\n        self.dt = dt  # pylint: disable=invalid-name\n        self.dtm = dtm\n        self.rep_times = rep_times\n        self.meas_kernels = meas_kernels\n        self.discriminators = discriminators\n\n        super().__init__(backend_name=backend_name, backend_version=backend_version,\n                         n_qubits=n_qubits, basis_gates=basis_gates, gates=gates,\n                         local=local, simulator=simulator, conditional=conditional,\n                         open_pulse=open_pulse, memory=memory, max_shots=max_shots,\n                         n_uchannels=n_uchannels, u_channel_lo=u_channel_lo,\n                         meas_levels=meas_levels, qubit_lo_range=qubit_lo_range,\n                         meas_lo_range=meas_lo_range, dt=dt, dtm=dtm,\n                         rep_times=rep_times, meas_kernels=meas_kernels,\n                         discriminators=discriminators, **kwargs)\n", "path": "qiskit/providers/models/backendconfiguration.py"}]}