We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
BackendConfiguration should allow None for gates and basis_gates
<!-- ⚠️ 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?
`BackendConfiguration` needs to allow for `gates = None` and `basis_gates =  None` in the model validation in order to allow a pulse-based simulator



--- 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                        validate=Length(min=1))
77     gates = Nested(GateConfigSchema, required=True, many=True,
78                    validate=Length(min=1))
79     local = Boolean(required=True)
80     simulator = Boolean(required=True)
81     conditional = Boolean(required=True)
82     open_pulse = Boolean(required=True)
83     memory = Boolean(required=True)
84     max_shots = Integer(required=True, validate=Range(min=1))
85 
86     # Optional properties.
87     max_experiments = Integer(validate=Range(min=1))
88     sample_name = String()
89     coupling_map = List(List(Integer(),
90                              validate=Length(min=1)),
91                         validate=Length(min=1), allow_none=True)
92     n_registers = Integer(validate=Range(min=1))
93     register_map = List(List(Integer(validate=OneOf([0, 1])),
94                              validate=Length(min=1)),
95                         validate=Length(min=1))
96     configurable = Boolean()
97     credits_required = Boolean()
98     online_date = DateTime()
99     display_name = String()
100     description = String()
101     tags = List(String())
102 
103 
104 class QasmBackendConfigurationSchema(BackendConfigurationSchema):
105     """Schema for Qasm backend."""
106     open_pulse = Boolean(required=True, validate=OneOf([False]))
107 
108 
109 class PulseBackendConfigurationSchema(QasmBackendConfigurationSchema):
110     """Schema for pulse backend"""
111     # Required properties.
112     open_pulse = Boolean(required=True, validate=OneOf([True]))
113     n_uchannels = Integer(required=True, validate=Range(min=0))
114     u_channel_lo = List(Nested(UchannelLOSchema, validate=Length(min=1),
115                                required=True, many=True))
116     meas_levels = List(Integer(), validate=Length(min=1), required=True)
117     qubit_lo_range = List(List(Float(validate=Range(min=0)),
118                                validate=Length(equal=2)), required=True)
119     meas_lo_range = List(List(Float(validate=Range(min=0)),
120                               validate=Length(equal=2)), required=True)
121     dt = Float(required=True, validate=Range(min=0))  # pylint: disable=invalid-name
122     dtm = Float(required=True, validate=Range(min=0))
123     rep_times = List(Integer(validate=Range(min=0)), required=True)
124     meas_kernels = List(String(), required=True)
125     discriminators = List(String(), required=True)
126 
127     # Optional properties.
128     meas_map = List(List(Integer(), validate=Length(min=1)))
129     channel_bandwidth = List(List(Float(), validate=Length(equal=2)))
130     acquisition_latency = List(List(Integer()))
131     conditional_latency = List(List(Integer()))
132     hamiltonian = PulseHamiltonianSchema()
133 
134 
135 @bind_schema(GateConfigSchema)
136 class GateConfig(BaseModel):
137     """Model for GateConfig.
138 
139     Please note that this class only describes the required fields. For the
140     full description of the model, please check ``GateConfigSchema``.
141 
142     Attributes:
143         name (str): the gate name as it will be referred to in Qasm.
144         parameters (list[str]): variable names for the gate parameters (if any).
145         qasm_def (str): definition of this gate in terms of Qasm primitives U
146             and CX.
147     """
148 
149     def __init__(self, name, parameters, qasm_def, **kwargs):
150         self.name = name
151         self.parameters = parameters
152         self.qasm_def = qasm_def
153 
154         super().__init__(**kwargs)
155 
156 
157 @bind_schema(UchannelLOSchema)
158 class UchannelLO(BaseModel):
159     """Model for GateConfig.
160 
161     Please note that this class only describes the required fields. For the
162     full description of the model, please check ``GateConfigSchema``.
163 
164     Attributes:
165         q (int): Qubit that scale corresponds too.
166         scale (complex): Scale factor for qubit frequency.
167     """
168     def __init__(self, q, scale, **kwargs):
169 
170         self.q = q
171         self.scale = scale
172 
173         super().__init__(q=q, scale=scale, **kwargs)
174 
175 
176 @bind_schema(BackendConfigurationSchema)
177 class BackendConfiguration(BaseModel):
178     """Model for BackendConfiguration.
179 
180     Please note that this class only describes the required fields. For the
181     full description of the model, please check ``BackendConfigurationSchema``.
182     Attributes:
183         backend_name (str): backend name.
184         backend_version (str): backend version in the form X.Y.Z.
185         n_qubits (int): number of qubits.
186         basis_gates (list[str]): list of basis gates names on the backend.
187         gates (GateConfig): list of basis gates on the backend.
188         local (bool): backend is local or remote.
189         simulator (bool): backend is a simulator.
190         conditional (bool): backend supports conditional operations.
191         open_pulse (bool): backend supports open pulse.
192         memory (bool): backend supports memory.
193         max_shots (int): maximum number of shots supported.
194     """
195 
196     def __init__(self, backend_name, backend_version, n_qubits, basis_gates,
197                  gates, local, simulator, conditional, open_pulse, memory,
198                  max_shots, **kwargs):
199 
200         self.backend_name = backend_name
201         self.backend_version = backend_version
202         self.n_qubits = n_qubits
203         self.basis_gates = basis_gates
204         self.gates = gates
205         self.local = local
206         self.simulator = simulator
207         self.conditional = conditional
208         self.open_pulse = open_pulse
209         self.memory = memory
210         self.max_shots = max_shots
211 
212         super().__init__(**kwargs)
213 
214 
215 @bind_schema(QasmBackendConfigurationSchema)
216 class QasmBackendConfiguration(BackendConfiguration):
217     """Model for QasmBackendConfiguration.
218 
219     Please note that this class only describes the required fields. For the
220     full description of the model, please check ``QasmBackendConfigurationSchema``.
221     Attributes:
222         backend_name (str): backend name.
223         backend_version (str): backend version in the form X.Y.Z.
224         n_qubits (int): number of qubits.
225         basis_gates (list[str]): list of basis gates names on the backend.
226         gates (GateConfig): list of basis gates on the backend.
227         local (bool): backend is local or remote.
228         simulator (bool): backend is a simulator.
229         conditional (bool): backend supports conditional operations.
230         open_pulse (bool): backend supports open pulse.
231         memory (bool): backend supports memory.
232         max_shots (int): maximum number of shots supported.
233         **kwargs: Optional fields.
234     """
235 
236     def __init__(self, backend_name, backend_version, n_qubits, basis_gates,
237                  gates, local, simulator, conditional, open_pulse, memory,
238                  max_shots, **kwargs):
239 
240         super().__init__(backend_name=backend_name, backend_version=backend_version,
241                          n_qubits=n_qubits, basis_gates=basis_gates, gates=gates,
242                          local=local, simulator=simulator, conditional=conditional,
243                          open_pulse=open_pulse, memory=memory, max_shots=max_shots,
244                          **kwargs)
245 
246 
247 @bind_schema(PulseBackendConfigurationSchema)
248 class PulseBackendConfiguration(BackendConfiguration):
249     """Model for PulseBackendConfiguration.
250 
251     Please note that this class only describes the required fields. For the
252     full description of the model, please check ``PulseBackendConfigurationSchema``.
253     Attributes:
254         backend_name (str): backend name.
255         backend_version (str): backend version in the form X.Y.Z.
256         n_qubits (int): number of qubits.
257         basis_gates (list[str]): list of basis gates names on the backend.
258         gates (GateConfig): list of basis gates on the backend.
259         local (bool): backend is local or remote.
260         simulator (bool): backend is a simulator.
261         conditional (bool): backend supports conditional operations.
262         open_pulse (bool): backend supports open pulse.
263         memory (bool): backend supports memory.
264         max_shots (int): maximum number of shots supported.
265         n_uchannels (int): Number of u-channels.
266         u_channel_lo (list[UchannelLO]): U-channel relationship on device los.
267         meas_levels (list[int]): Supported measurement levels.
268         qubit_lo_range (list[list[float]]): Qubit lo ranges for each qubit
269             with form (min, max) in GHz.
270         meas_lo_range (list[list[float]]): Measurement lo ranges for each qubit
271             with form (min, max) in GHz.
272         dt (float): Qubit drive channel timestep in nanoseconds.
273         dtm (float): Measurement drive channel timestep in nanoseconds.
274         rep_times (list[float]): Supported repetition times for device in microseconds.
275         meas_kernels (list[str]): Supported measurement kernels.
276         discriminators: Supported discriminators.
277         **kwargs: Optional fields.
278     """
279 
280     def __init__(self, backend_name, backend_version, n_qubits, basis_gates,
281                  gates, local, simulator, conditional, open_pulse, memory,
282                  max_shots, n_uchannels, u_channel_lo, meas_levels,
283                  qubit_lo_range, meas_lo_range, dt, dtm, rep_times, meas_kernels,
284                  discriminators, **kwargs):
285 
286         self.n_uchannels = n_uchannels
287         self.u_channel_lo = u_channel_lo
288         self.meas_levels = meas_levels
289         self.qubit_lo_range = qubit_lo_range
290         self.meas_lo_range = meas_lo_range
291         self.dt = dt  # pylint: disable=invalid-name
292         self.dtm = dtm
293         self.rep_times = rep_times
294         self.meas_kernels = meas_kernels
295         self.discriminators = discriminators
296 
297         super().__init__(backend_name=backend_name, backend_version=backend_version,
298                          n_qubits=n_qubits, basis_gates=basis_gates, gates=gates,
299                          local=local, simulator=simulator, conditional=conditional,
300                          open_pulse=open_pulse, memory=memory, max_shots=max_shots,
301                          n_uchannels=n_uchannels, u_channel_lo=u_channel_lo,
302                          meas_levels=meas_levels, qubit_lo_range=qubit_lo_range,
303                          meas_lo_range=meas_lo_range, dt=dt, dtm=dtm,
304                          rep_times=rep_times, meas_kernels=meas_kernels,
305                          discriminators=discriminators, **kwargs)
306
```
--- 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
@@ -72,10 +72,8 @@
     backend_version = String(required=True,
                              validate=Regexp("[0-9]+.[0-9]+.[0-9]+$"))
     n_qubits = Integer(required=True, validate=Range(min=1))
-    basis_gates = List(String(), required=True,
-                       validate=Length(min=1))
-    gates = Nested(GateConfigSchema, required=True, many=True,
-                   validate=Length(min=1))
+    basis_gates = List(String(), required=True)
+    gates = Nested(GateConfigSchema, required=True, many=True)
     local = Boolean(required=True)
     simulator = Boolean(required=True)
     conditional = Boolean(required=True)

{"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@@ -72,10 +72,8 @@\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-                       validate=Length(min=1))\n-    gates = Nested(GateConfigSchema, required=True, many=True,\n-                   validate=Length(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", "issue": "BackendConfiguration should allow None for gates and basis_gates\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\n`BackendConfiguration` needs to allow for `gates = None` and `basis_gates =  None` in the model validation in order to allow a pulse-based simulator\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                       validate=Length(min=1))\n    gates = Nested(GateConfigSchema, required=True, many=True,\n                   validate=Length(min=1))\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\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"}]}