bhive.instance module

class bhive.instance.SharedInstance

Bases: object

Singelton for the Hive Instance

config = {}
instance = None
bhive.instance.clear_cache()

Clear Caches

bhive.instance.set_shared_config(config)

This allows to set a config that will be used when calling shared_hive_instance and allows to define the configuration without requiring to actually create an instance

bhive.instance.set_shared_hive_instance(hive_instance)

This method allows us to override default hive instance for all users of SharedInstance.instance.

Parameters

hive_instance (Hive) – Hive instance

bhive.instance.shared_hive_instance()

This method will initialize SharedInstance.instance and return it. The purpose of this method is to have offer single default hive instance that can be reused by multiple classes.

from bhive.account import Account
from bhive.instance import shared_hive_instance

account = Account("test")
# is equivalent with
account = Account("test", hive_instance=shared_hive_instance())