示例#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__)