def version(self, val): if isinstance(val, bytes): try: val = tuple(int(x) for x in val.split('.')) except: pass if (not isinstance(val, tuple) or len(val) != 3 or any(not isinstance(x, int) for x in val)): raise TypeError("version must be a 3-tuple or byte string") if val not in versions: human_versions = util.human_list( [version_to_string(x) for x in six.iterkeys(versions)]) raise ValueError( "pyasdf only understands how to handle ASDF versions {0}. " "Got '{1}'".format(human_versions, version_to_string(val))) self._version = val
def version(self, val): if isinstance(val, bytes): try: val = tuple(int(x) for x in val.split('.')) except: pass if (not isinstance(val, tuple) or len(val) != 3 or any(not isinstance(x, int) for x in val)): raise TypeError("version must be a 3-tuple or byte string") if val not in versions: human_versions = util.human_list( [version_to_string(x) for x in six.iterkeys(versions)]) raise ValueError( "pyasdf only understands how to handle ASDF versions {0}. " "Got '{1}'".format( human_versions, version_to_string(val))) self._version = val
def __dir__(self): return list(six.iterkeys(self._schema.get('properties', {})))
def __repr__(self): names = ("'{0}'".format(x) for x in six.iterkeys(self)) return "<{1} names=({0})>".format(",".join(names), self.__class__.__name__)