# Path: sciunit/base.py
# PLATFORM = sys.platform
# PYTHON_MAJOR_VERSION = sys.version_info.major
# class Config(dict):
# class Versioned(object):
# class SciUnit(Versioned):
# class TestWeighted(object):
# class SciUnitHandler(BaseHandler):
# class QuantitiesHandler(BaseHandler):
# class UnitQuantitiesHandler(BaseHandler):
#     def __init__(self, *args, **kwargs):
#     def path(self):
#     def path(self, val):
#     def __getitem__(self, key):
#     def get(self, key, default=None, update_from_disk=True):
#     def set(self, key, val):
#     def __setitem__(self, key, val):
#     def get_from_disk(self):
#     def create(self, data: dict = None) -> bool:
#     def load(self):
#     def save(self):
#     def get_repo(self, cached: bool = True) -> Repo:
#     def get_version(self, cached: bool = True) -> str:
#     def get_remote(self, remote_name: str = "origin", **kwargs) -> Remote:
#     def get_remote_url(self, remote: str = "origin", cached: bool = True) -> str:
#     def __init__(self):
#     def __getstate__(self) -> dict:
#     def properties(self, keys: list = None, exclude: list = None) -> dict:
#     def property_names(self) -> list:
#     def json(
#         self, add_props: bool = True, string: bool = True, unpicklable: bool = False, make_refs: bool = False) -> str:
#     def diff(self, other, add_props=False):
#     def hash(self, serialization: str = None) -> str:
#     def _class(self) -> dict:
#     def url(self) -> str:
#     def get_list_attr_with_bases(self, attr: str) -> list:
#     def weights(self) -> List[float]:
# def deep_exclude(state: dict, exclude: list) -> dict:
# def log(*args, **kwargs):
# def strip_html(html):
#     def flatten(self, obj, data):
#     def restore(self, data):
#     def simplify(self, d):
#     def flatten(self, obj, data):
#     def restore(self, data):
#     def flatten(self, obj, data):
#     def restore(self, data):


import inspect
import pickle
import shelve
import tempfile
from pathlib import Path
from typing import Any, Union
from sciunit.base import SciUnit, config
        if self.use_disk_cache:
            self.init_disk_cache(location=self.use_disk_cache)
        self.load_model()

    #: Name of the backend
    name = None

    #: The function that handles running the simulation
    f = None

    #: Optional list of state variables for a backend to record.
    recorded_variables = None

    state_hide = ["memory_cache", "_results", "stdout", "exec_in_dir", "model"]

    def init_cache(self) -> None:
        """Initialize the cache."""
        self.init_memory_cache()
        self.init_disk_cache()

    def init_memory_cache(self) -> None:
        """Initialize the in-memory version of the cache."""
        self.memory_cache = {}

    def init_disk_cache(self, location: Union[str, Path, bool, None] = None) -> None:
        """Initialize the on-disk version of the cache."""
        if isinstance(location, (str, Path)):
            location = str(location)
        else:
            # => "~/.sciunit/cache"

# Path: sciunit/base.py
# PLATFORM = sys.platform
# PYTHON_MAJOR_VERSION = sys.version_info.major
# class Config(dict):
# class Versioned(object):
# class SciUnit(Versioned):
# class TestWeighted(object):
# class SciUnitHandler(BaseHandler):
# class QuantitiesHandler(BaseHandler):
# class UnitQuantitiesHandler(BaseHandler):
#     def __init__(self, *args, **kwargs):
#     def path(self):
#     def path(self, val):
#     def __getitem__(self, key):
#     def get(self, key, default=None, update_from_disk=True):
#     def set(self, key, val):
#     def __setitem__(self, key, val):
#     def get_from_disk(self):
#     def create(self, data: dict = None) -> bool:
#     def load(self):
#     def save(self):
#     def get_repo(self, cached: bool = True) -> Repo:
#     def get_version(self, cached: bool = True) -> str:
#     def get_remote(self, remote_name: str = "origin", **kwargs) -> Remote:
#     def get_remote_url(self, remote: str = "origin", cached: bool = True) -> str:
#     def __init__(self):
#     def __getstate__(self) -> dict:
#     def properties(self, keys: list = None, exclude: list = None) -> dict:
#     def property_names(self) -> list:
#     def json(
#         self, add_props: bool = True, string: bool = True, unpicklable: bool = False, make_refs: bool = False) -> str:
#     def diff(self, other, add_props=False):
#     def hash(self, serialization: str = None) -> str:
#     def _class(self) -> dict:
#     def url(self) -> str:
#     def get_list_attr_with_bases(self, attr: str) -> list:
#     def weights(self) -> List[float]:
# def deep_exclude(state: dict, exclude: list) -> dict:
# def log(*args, **kwargs):
# def strip_html(html):
#     def flatten(self, obj, data):
#     def restore(self, data):
#     def simplify(self, d):
#     def flatten(self, obj, data):
#     def restore(self, data):
#     def flatten(self, obj, data):
#     def restore(self, data):


# Path: sciunit/models/backends.py
import inspect
import pickle
import shelve
import tempfile
from pathlib import Path
from typing import Any, Union
from sciunit.base import SciUnit, config

        if self.use_disk_cache:
            self.init_disk_cache(location=self.use_disk_cache)
        self.load_model()

    #: Name of the backend
    name = None

    #: The function that handles running the simulation
    f = None

    #: Optional list of state variables for a backend to record.
    recorded_variables = None

    state_hide = ["memory_cache", "_results", "stdout", "exec_in_dir", "model"]

    def init_cache(self) -> None:
        """Initialize the cache."""
        self.init_memory_cache()
        self.init_disk_cache()

    def init_memory_cache(self) -> None:
        """Initialize the in-memory version of the cache."""
        self.memory_cache = {}

    def init_disk_cache(self, location: Union[str, Path, bool, None] = None) -> None:
        """Initialize the on-disk version of the cache."""
        if isinstance(location, (str, Path)):
            location = str(location)
        else:
            # => "~/.sciunit/cache"

            location = str(config.path.parent / "cache")