# Path: hydra_base/config.py
# PYTHONVERSION = sys.version_info
# CONFIG = None
#     CONFIG = config
# def load_config():
# def read_values_from_environment(config, section_key, options_key):
# def set_windows_env_variables(config):
# def get(section, option, default=None):
# def getint(section, option, default=None):
# 
# Path: hydra_base/lib/HydraTypes/Encodings.py
# class ScalarJSON(object):
#     def __get__(self, instance, owner):
#         return json.dumps({owner.tag : { arg : getattr(instance, arg) for arg in owner.ctor_fmt }})
# 
#     def __set__(self, instance, encstr):
#         jo = json.loads(encstr)[instance.tag]
#         for arg in instance.ctor_fmt:
#             setattr(instance, arg, jo[arg])
# 
# class ArrayJSON(object):
#     def __get__(self, instance, owner):
#         return json.dumps({owner.tag : instance.data.to_dict()})
# 
#     def __set__(self, instance, encstr):
#         data = json.loads(encstr)[instance.tag]
#         instance.data = pd.DataFrame.from_dict(data)
# 
# class DescriptorJSON(object):
#     def __get__(self, instance, owner):
#         return ""
# 
#     def __set__(self, instance, encstr):
#         pass
# 
# class DataframeJSON(object):
#     def __get__(self, instance, owner):
#         return "{}"
# 
#     def __set__(self, instance, encstr):
#         pass
# 
# class TimeseriesJSON(object):
#     def __get__(self, instance, owner):
#         return "{}"
# 
#     def __set__(self, instance, encstr):
#         pass
# 
# Path: hydra_base/exceptions.py
# class HydraError(Exception):
#     __error_code__ = None
# 
#     def __init__(self, message="A hydra error has occurred"):
#         # Call the base class constructor with the parameters it needs
#         self.code = error_codes.get(self.__error_code__, '0000')
#         self.message = message # Added for Py3
#         super(HydraError, self).__init__({"message": message, "code": self.code})


import json
import math
import six
import numpy as np
import pandas as pd
import collections
import logging
from abc import abstractmethod, abstractproperty
from datetime import datetime
from hydra_base import config
from .Encodings import ScalarJSON, ArrayJSON, DescriptorJSON, DataframeJSON, TimeseriesJSON
from hydra_base.exceptions import HydraError
        from .Registry import typemap
            log.exception(e)
            raise HydraError(str(e))

        except AssertionError as e:
            log.warning("An error occurred creating the new data frame: %s. Defaulting to a simple read_json"%(e))
            df = pd.read_json(value).fillna(0)

        return df

    def validate(self):
        assert isinstance(self._value, pd.DataFrame)
        assert not self._value.empty


    def get_value(self):
        return self._value.to_json()

    def set_value(self, val):
        self._value = val
        try:
            """ Use validate test to confirm is pd.DataFrame... """
            self.validate()
        except AssertionError:
            """ ...otherwise attempt as json..."""
            try:
                df = self.__class__._create_dataframe(val)
                self._value = df
                self.validate()
            except Exception as e:
                """ ...and fail if neither """

# Path: hydra_base/config.py
# PYTHONVERSION = sys.version_info
# CONFIG = None
#     CONFIG = config
# def load_config():
# def read_values_from_environment(config, section_key, options_key):
# def set_windows_env_variables(config):
# def get(section, option, default=None):
# def getint(section, option, default=None):
# 
# Path: hydra_base/lib/HydraTypes/Encodings.py
# class ScalarJSON(object):
#     def __get__(self, instance, owner):
#         return json.dumps({owner.tag : { arg : getattr(instance, arg) for arg in owner.ctor_fmt }})
# 
#     def __set__(self, instance, encstr):
#         jo = json.loads(encstr)[instance.tag]
#         for arg in instance.ctor_fmt:
#             setattr(instance, arg, jo[arg])
# 
# class ArrayJSON(object):
#     def __get__(self, instance, owner):
#         return json.dumps({owner.tag : instance.data.to_dict()})
# 
#     def __set__(self, instance, encstr):
#         data = json.loads(encstr)[instance.tag]
#         instance.data = pd.DataFrame.from_dict(data)
# 
# class DescriptorJSON(object):
#     def __get__(self, instance, owner):
#         return ""
# 
#     def __set__(self, instance, encstr):
#         pass
# 
# class DataframeJSON(object):
#     def __get__(self, instance, owner):
#         return "{}"
# 
#     def __set__(self, instance, encstr):
#         pass
# 
# class TimeseriesJSON(object):
#     def __get__(self, instance, owner):
#         return "{}"
# 
#     def __set__(self, instance, encstr):
#         pass
# 
# Path: hydra_base/exceptions.py
# class HydraError(Exception):
#     __error_code__ = None
# 
#     def __init__(self, message="A hydra error has occurred"):
#         # Call the base class constructor with the parameters it needs
#         self.code = error_codes.get(self.__error_code__, '0000')
#         self.message = message # Added for Py3
#         super(HydraError, self).__init__({"message": message, "code": self.code})


# Path: hydra_base/lib/HydraTypes/Types.py
import json
import math
import six
import numpy as np
import pandas as pd
import collections
import logging
from abc import abstractmethod, abstractproperty
from datetime import datetime
from hydra_base import config
from .Encodings import ScalarJSON, ArrayJSON, DescriptorJSON, DataframeJSON, TimeseriesJSON
from hydra_base.exceptions import HydraError
        from .Registry import typemap

            log.exception(e)
            raise HydraError(str(e))

        except AssertionError as e:
            log.warning("An error occurred creating the new data frame: %s. Defaulting to a simple read_json"%(e))
            df = pd.read_json(value).fillna(0)

        return df

    def validate(self):
        assert isinstance(self._value, pd.DataFrame)
        assert not self._value.empty


    def get_value(self):
        return self._value.to_json()

    def set_value(self, val):
        self._value = val
        try:
            """ Use validate test to confirm is pd.DataFrame... """
            self.validate()
        except AssertionError:
            """ ...otherwise attempt as json..."""
            try:
                df = self.__class__._create_dataframe(val)
                self._value = df
                self.validate()
            except Exception as e:
                """ ...and fail if neither """

                raise HydraError(str(e))