# Path: hyperengine/base/util.py
# def str_to_dict(s):
#   return ast.literal_eval(s)
# 
# def smart_str(val):
#   if type(val) in [float, np.float32, np.float64] and val:
#     return '%.6f' % val if abs(val) > 1e-6 else '%e' % val
#   if type(val) == dict:
#     return '{%s}' % ', '.join(['%s: %s' % (repr(k), smart_str(val[k])) for k in sorted(val.keys())])
#   if type(val) in [list, tuple]:
#     return '[%s]' % ', '.join(['%s' % smart_str(i) for i in val])
#   return repr(val)
# 
# def random_id(size=6, chars=string.ascii_uppercase + string.digits):
#   return ''.join(random.choice(chars) for _ in range(size))


import datetime
import os
import numpy as np
from .logging import *
from .util import str_to_dict, smart_str, random_id
      value = np.array(data.get(key, default_value))
      setattr(self, '_%s' % key, value)

  def export_to(self):
    """
    Exports the object to the dictionary.
    """
    raise NotImplementedError()

  def _export_keys_to(self, keys):
    return {key: getattr(self, '_%s' % key).tolist() for key in keys}


class DefaultIO(BaseIO):
  """
  A simple I/O implementation: can save and load a serializable instance.
  """

  def __init__(self, serializable, filename, **params):
    super(DefaultIO, self).__init__(**params)
    self.serializable = serializable
    self.filename = filename

  def load(self):
    directory = self.load_dir
    if not directory is None:
      destination = os.path.join(directory, self.filename)
      if os.path.exists(destination):
        data = DefaultIO._load_dict(destination)
        if is_debug_logged():

# Path: hyperengine/base/util.py
# def str_to_dict(s):
#   return ast.literal_eval(s)
# 
# def smart_str(val):
#   if type(val) in [float, np.float32, np.float64] and val:
#     return '%.6f' % val if abs(val) > 1e-6 else '%e' % val
#   if type(val) == dict:
#     return '{%s}' % ', '.join(['%s: %s' % (repr(k), smart_str(val[k])) for k in sorted(val.keys())])
#   if type(val) in [list, tuple]:
#     return '[%s]' % ', '.join(['%s' % smart_str(i) for i in val])
#   return repr(val)
# 
# def random_id(size=6, chars=string.ascii_uppercase + string.digits):
#   return ''.join(random.choice(chars) for _ in range(size))


# Path: hyperengine/base/base_io.py
import datetime
import os
import numpy as np
from .logging import *
from .util import str_to_dict, smart_str, random_id

      value = np.array(data.get(key, default_value))
      setattr(self, '_%s' % key, value)

  def export_to(self):
    """
    Exports the object to the dictionary.
    """
    raise NotImplementedError()

  def _export_keys_to(self, keys):
    return {key: getattr(self, '_%s' % key).tolist() for key in keys}


class DefaultIO(BaseIO):
  """
  A simple I/O implementation: can save and load a serializable instance.
  """

  def __init__(self, serializable, filename, **params):
    super(DefaultIO, self).__init__(**params)
    self.serializable = serializable
    self.filename = filename

  def load(self):
    directory = self.load_dir
    if not directory is None:
      destination = os.path.join(directory, self.filename)
      if os.path.exists(destination):
        data = DefaultIO._load_dict(destination)
        if is_debug_logged():

          debug('Loaded data: %s from %s' % (smart_str(data), destination))