Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def __init__(self, *args: Any, **kwargs: Any) -> None:
super().__init__(*args, **kwargs)
self._backends: List[QuantumInspireBackend] = []
self._api: Optional[QuantumInspireAPI] = None
Returns:
List of backends that meet the filter requirements.
"""
if self._api is None:
raise ApiError('Authentication details have not been set.')
available_backends = self._api.get_backend_types()
if name is not None:
available_backends = list(filter(lambda b: b['name'] == name, available_backends))
backends = []
for backend in available_backends:
if backend['is_allowed']:
config = copy(QuantumInspireBackend.DEFAULT_CONFIGURATION)
self._adjust_backend_configuration(config, backend)
backends.append(QuantumInspireBackend(self._api, provider=self, configuration=config))
return backends