예제 #1
0
파일: versioning.py 프로젝트: nden/pyasdf
    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
예제 #2
0
    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
예제 #3
0
파일: properties.py 프로젝트: rij/jwst
 def __dir__(self):
     return list(six.iterkeys(self._schema.get('properties', {})))
예제 #4
0
 def __dir__(self):
     return list(six.iterkeys(self._schema.get('properties', {})))
예제 #5
0
 def __repr__(self):
     names = ("'{0}'".format(x) for x in six.iterkeys(self))
     return "<{1} names=({0})>".format(",".join(names), self.__class__.__name__)