From 96ff762ff93473efad017a5f2955b4b95813bec1 Mon Sep 17 00:00:00 2001 From: BrunoLiegiBastonLiegi Date: Wed, 10 Apr 2024 10:03:12 +0200 Subject: [PATCH] fix: allowing for platform=None --- src/qibojit/backends/__init__.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/qibojit/backends/__init__.py b/src/qibojit/backends/__init__.py index fb83277..47754f1 100644 --- a/src/qibojit/backends/__init__.py +++ b/src/qibojit/backends/__init__.py @@ -14,7 +14,7 @@ class MetaBackend: """Meta-backend class which takes care of loading the qibojit backends.""" @staticmethod - def load(platform: str) -> QibojitBackend: + def load(platform: str = None) -> QibojitBackend: """Loads the backend. Args: @@ -29,11 +29,11 @@ def load(platform: str) -> QibojitBackend: return CupyBackend() elif platform == "cuquantum": return CuQuantumBackend() - else: - raise_error( - ValueError, - f"Unsupported platform, please use one among {PLATFORMS}.", - ) + else: # pragma: no cover + try: + return CupyBackend() + except (ModuleNotFoundError, ImportError): + return NumbaBackend() def list_available(self) -> dict: """Lists all the available qibojit backends."""