# Path: cma-es/batchcompute_python_sdk/src/batchcompute/utils/constants.py
# STRING = (str, unicode)
# 
# PY2 = sys.version_info[0] == 2


import copy
from .constants import STRING, PY2
from batchcompute.core.exceptions import (
    FieldError, ValidationError, JsonError
)
from batchcompute.utils import (
    partial, CamelCasedClass, import_json, add_metaclass,
)
        self._d = {}
        if isinstance(properties, STRING):
            self.load(properties)
        elif isinstance(properties, dict):
            self.update(properties)
        elif isinstance(properties, self.__class__):
            self.update(properties.detail())
        else:
            error = (type(properties), self.__class__.__name__)
            raise TypeError('''Invalid type '%s' for '%s' ''' % error)

    def validate(self):
        if self.required:
            for key in self.required:
                if key in self._d:
                    if isinstance(self._d[key], Jsonizable):
                        self._d[key].validate()
                else:
                    raise ValidationError(key)

    def detail(self):
        return copy.deepcopy(self._d)

    def update(self, d):
        self._update(d)

    def setproperty(self, key, value):
        if key in self.descriptor_map:
            valid_type = self.descriptor_map[key]
            if isinstance(value, valid_type):

# Path: cma-es/batchcompute_python_sdk/src/batchcompute/utils/constants.py
# STRING = (str, unicode)
# 
# PY2 = sys.version_info[0] == 2


# Path: cma-es/batchcompute_python_sdk/src/batchcompute/utils/jsonizable.py
import copy
from .constants import STRING, PY2
from batchcompute.core.exceptions import (
    FieldError, ValidationError, JsonError
)
from batchcompute.utils import (
    partial, CamelCasedClass, import_json, add_metaclass,
)

        self._d = {}
        if isinstance(properties, STRING):
            self.load(properties)
        elif isinstance(properties, dict):
            self.update(properties)
        elif isinstance(properties, self.__class__):
            self.update(properties.detail())
        else:
            error = (type(properties), self.__class__.__name__)
            raise TypeError('''Invalid type '%s' for '%s' ''' % error)

    def validate(self):
        if self.required:
            for key in self.required:
                if key in self._d:
                    if isinstance(self._d[key], Jsonizable):
                        self._d[key].validate()
                else:
                    raise ValidationError(key)

    def detail(self):
        return copy.deepcopy(self._d)

    def update(self, d):
        self._update(d)

    def setproperty(self, key, value):
        if key in self.descriptor_map:
            valid_type = self.descriptor_map[key]
            if isinstance(value, valid_type):

                if valid_type == STRING and not value and key in self._d: