from bigsi.storage.berkeleydb import BerkeleyDBStorage
from bigsi.storage.redis import RedisStorage
from bigsi.storage.rocksdb import RocksDBStorage


def get_storage(config):
    return {
        "rocksdb": RocksDBStorage,
        "berkeleydb": BerkeleyDBStorage,
        "redis": RedisStorage,
    }[config["storage-engine"]](config["storage-config"])

from bigsi.storage.redis import RedisStorage

try:
    from bigsi.storage.berkeleydb import BerkeleyDBStorage
except ModuleNotFoundError:
    pass
try:
    from bigsi.storage.rocksdb import RocksDBStorage
except ModuleNotFoundError:
    pass


def get_storage(config):
    return {
        "rocksdb": RocksDBStorage,
        "berkeleydb": BerkeleyDBStorage,
        "redis": RedisStorage,
    }[config["storage-engine"]](config["storage-config"])

Allow import without optional requirements
Allow import without optional requirements

- from bigsi.storage.berkeleydb import BerkeleyDBStorage
  from bigsi.storage.redis import RedisStorage
+ 
+ try:
+     from bigsi.storage.berkeleydb import BerkeleyDBStorage
+ except ModuleNotFoundError:
+     pass
+ try:
- from bigsi.storage.rocksdb import RocksDBStorage
+     from bigsi.storage.rocksdb import RocksDBStorage
+ except ModuleNotFoundError:
+     pass
  
  
  def get_storage(config):
      return {
          "rocksdb": RocksDBStorage,
          "berkeleydb": BerkeleyDBStorage,
          "redis": RedisStorage,
      }[config["storage-engine"]](config["storage-config"])
  
Allow import without optional requirements
## Code Before:
from bigsi.storage.berkeleydb import BerkeleyDBStorage
from bigsi.storage.redis import RedisStorage
from bigsi.storage.rocksdb import RocksDBStorage


def get_storage(config):
    return {
        "rocksdb": RocksDBStorage,
        "berkeleydb": BerkeleyDBStorage,
        "redis": RedisStorage,
    }[config["storage-engine"]](config["storage-config"])

## Instruction:
Allow import without optional requirements
## Code After:
from bigsi.storage.redis import RedisStorage

try:
    from bigsi.storage.berkeleydb import BerkeleyDBStorage
except ModuleNotFoundError:
    pass
try:
    from bigsi.storage.rocksdb import RocksDBStorage
except ModuleNotFoundError:
    pass


def get_storage(config):
    return {
        "rocksdb": RocksDBStorage,
        "berkeleydb": BerkeleyDBStorage,
        "redis": RedisStorage,
    }[config["storage-engine"]](config["storage-config"])
