Python future.utils 模块,ensure_new_type() 实例源码

我们从Python开源项目中,提取了以下44个代码示例,用于说明如何使用future.utils.ensure_new_type()

项目:hakkuframework    作者:4shadoww    | 项目源码 | 文件源码
def __dump(self, value, write):
        try:
            f = self.dispatch[type(ensure_new_type(value))]
        except KeyError:
            # check if this object can be marshalled as a structure
            if not hasattr(value, '__dict__'):
                raise TypeError("cannot marshal %s objects" % type(value))
            # check if this class is a sub-class of a basic type,
            # because we don't know how to marshal these types
            # (e.g. a string sub-class)
            for type_ in type(value).__mro__:
                if type_ in self.dispatch.keys():
                    raise TypeError("cannot marshal %s objects" % type(value))
            # XXX(twouters): using "_arbitrary_instance" as key as a quick-fix
            # for the p3yk merge, this should probably be fixed more neatly.
            f = self.dispatch["_arbitrary_instance"]
        f(self, value, write)
项目:packaging    作者:blockstack    | 项目源码 | 文件源码
def __dump(self, value, write):
        try:
            f = self.dispatch[type(ensure_new_type(value))]
        except KeyError:
            # check if this object can be marshalled as a structure
            if not hasattr(value, '__dict__'):
                raise TypeError("cannot marshal %s objects" % type(value))
            # check if this class is a sub-class of a basic type,
            # because we don't know how to marshal these types
            # (e.g. a string sub-class)
            for type_ in type(value).__mro__:
                if type_ in self.dispatch.keys():
                    raise TypeError("cannot marshal %s objects" % type(value))
            # XXX(twouters): using "_arbitrary_instance" as key as a quick-fix
            # for the p3yk merge, this should probably be fixed more neatly.
            f = self.dispatch["_arbitrary_instance"]
        f(self, value, write)
项目:islam-buddy    作者:hamir    | 项目源码 | 文件源码
def __dump(self, value, write):
        try:
            f = self.dispatch[type(ensure_new_type(value))]
        except KeyError:
            # check if this object can be marshalled as a structure
            if not hasattr(value, '__dict__'):
                raise TypeError("cannot marshal %s objects" % type(value))
            # check if this class is a sub-class of a basic type,
            # because we don't know how to marshal these types
            # (e.g. a string sub-class)
            for type_ in type(value).__mro__:
                if type_ in self.dispatch.keys():
                    raise TypeError("cannot marshal %s objects" % type(value))
            # XXX(twouters): using "_arbitrary_instance" as key as a quick-fix
            # for the p3yk merge, this should probably be fixed more neatly.
            f = self.dispatch["_arbitrary_instance"]
        f(self, value, write)
项目:FightstickDisplay    作者:calexil    | 项目源码 | 文件源码
def __dump(self, value, write):
        try:
            f = self.dispatch[type(ensure_new_type(value))]
        except KeyError:
            # check if this object can be marshalled as a structure
            if not hasattr(value, '__dict__'):
                raise TypeError("cannot marshal %s objects" % type(value))
            # check if this class is a sub-class of a basic type,
            # because we don't know how to marshal these types
            # (e.g. a string sub-class)
            for type_ in type(value).__mro__:
                if type_ in self.dispatch.keys():
                    raise TypeError("cannot marshal %s objects" % type(value))
            # XXX(twouters): using "_arbitrary_instance" as key as a quick-fix
            # for the p3yk merge, this should probably be fixed more neatly.
            f = self.dispatch["_arbitrary_instance"]
        f(self, value, write)
项目:cryptogram    作者:xinmingzhang    | 项目源码 | 文件源码
def __dump(self, value, write):
        try:
            f = self.dispatch[type(ensure_new_type(value))]
        except KeyError:
            # check if this object can be marshalled as a structure
            if not hasattr(value, '__dict__'):
                raise TypeError("cannot marshal %s objects" % type(value))
            # check if this class is a sub-class of a basic type,
            # because we don't know how to marshal these types
            # (e.g. a string sub-class)
            for type_ in type(value).__mro__:
                if type_ in self.dispatch.keys():
                    raise TypeError("cannot marshal %s objects" % type(value))
            # XXX(twouters): using "_arbitrary_instance" as key as a quick-fix
            # for the p3yk merge, this should probably be fixed more neatly.
            f = self.dispatch["_arbitrary_instance"]
        f(self, value, write)
项目:Repobot    作者:Desgard    | 项目源码 | 文件源码
def __dump(self, value, write):
        try:
            f = self.dispatch[type(ensure_new_type(value))]
        except KeyError:
            # check if this object can be marshalled as a structure
            if not hasattr(value, '__dict__'):
                raise TypeError("cannot marshal %s objects" % type(value))
            # check if this class is a sub-class of a basic type,
            # because we don't know how to marshal these types
            # (e.g. a string sub-class)
            for type_ in type(value).__mro__:
                if type_ in self.dispatch.keys():
                    raise TypeError("cannot marshal %s objects" % type(value))
            # XXX(twouters): using "_arbitrary_instance" as key as a quick-fix
            # for the p3yk merge, this should probably be fixed more neatly.
            f = self.dispatch["_arbitrary_instance"]
        f(self, value, write)
项目:UMOG    作者:hsab    | 项目源码 | 文件源码
def __dump(self, value, write):
        try:
            f = self.dispatch[type(ensure_new_type(value))]
        except KeyError:
            # check if this object can be marshalled as a structure
            if not hasattr(value, '__dict__'):
                raise TypeError("cannot marshal %s objects" % type(value))
            # check if this class is a sub-class of a basic type,
            # because we don't know how to marshal these types
            # (e.g. a string sub-class)
            for type_ in type(value).__mro__:
                if type_ in self.dispatch.keys():
                    raise TypeError("cannot marshal %s objects" % type(value))
            # XXX(twouters): using "_arbitrary_instance" as key as a quick-fix
            # for the p3yk merge, this should probably be fixed more neatly.
            f = self.dispatch["_arbitrary_instance"]
        f(self, value, write)
项目:blackmamba    作者:zrzka    | 项目源码 | 文件源码
def __dump(self, value, write):
        try:
            f = self.dispatch[type(ensure_new_type(value))]
        except KeyError:
            # check if this object can be marshalled as a structure
            if not hasattr(value, '__dict__'):
                raise TypeError("cannot marshal %s objects" % type(value))
            # check if this class is a sub-class of a basic type,
            # because we don't know how to marshal these types
            # (e.g. a string sub-class)
            for type_ in type(value).__mro__:
                if type_ in self.dispatch.keys():
                    raise TypeError("cannot marshal %s objects" % type(value))
            # XXX(twouters): using "_arbitrary_instance" as key as a quick-fix
            # for the p3yk merge, this should probably be fixed more neatly.
            f = self.dispatch["_arbitrary_instance"]
        f(self, value, write)
项目:beepboop    作者:nicolehe    | 项目源码 | 文件源码
def __dump(self, value, write):
        try:
            f = self.dispatch[type(ensure_new_type(value))]
        except KeyError:
            # check if this object can be marshalled as a structure
            if not hasattr(value, '__dict__'):
                raise TypeError("cannot marshal %s objects" % type(value))
            # check if this class is a sub-class of a basic type,
            # because we don't know how to marshal these types
            # (e.g. a string sub-class)
            for type_ in type(value).__mro__:
                if type_ in self.dispatch.keys():
                    raise TypeError("cannot marshal %s objects" % type(value))
            # XXX(twouters): using "_arbitrary_instance" as key as a quick-fix
            # for the p3yk merge, this should probably be fixed more neatly.
            f = self.dispatch["_arbitrary_instance"]
        f(self, value, write)
项目:hackathon    作者:vertica    | 项目源码 | 文件源码
def __dump(self, value, write):
        try:
            f = self.dispatch[type(ensure_new_type(value))]
        except KeyError:
            # check if this object can be marshalled as a structure
            if not hasattr(value, '__dict__'):
                raise TypeError("cannot marshal %s objects" % type(value))
            # check if this class is a sub-class of a basic type,
            # because we don't know how to marshal these types
            # (e.g. a string sub-class)
            for type_ in type(value).__mro__:
                if type_ in self.dispatch.keys():
                    raise TypeError("cannot marshal %s objects" % type(value))
            # XXX(twouters): using "_arbitrary_instance" as key as a quick-fix
            # for the p3yk merge, this should probably be fixed more neatly.
            f = self.dispatch["_arbitrary_instance"]
        f(self, value, write)
项目:yatta_reader    作者:sound88    | 项目源码 | 文件源码
def __dump(self, value, write):
        try:
            f = self.dispatch[type(ensure_new_type(value))]
        except KeyError:
            # check if this object can be marshalled as a structure
            if not hasattr(value, '__dict__'):
                raise TypeError("cannot marshal %s objects" % type(value))
            # check if this class is a sub-class of a basic type,
            # because we don't know how to marshal these types
            # (e.g. a string sub-class)
            for type_ in type(value).__mro__:
                if type_ in self.dispatch.keys():
                    raise TypeError("cannot marshal %s objects" % type(value))
            # XXX(twouters): using "_arbitrary_instance" as key as a quick-fix
            # for the p3yk merge, this should probably be fixed more neatly.
            f = self.dispatch["_arbitrary_instance"]
        f(self, value, write)
项目:hakkuframework    作者:4shadoww    | 项目源码 | 文件源码
def __repr__(self):
        return "<Fault %s: %r>" % (ensure_new_type(self.faultCode),
                                   ensure_new_type(self.faultString))

# --------------------------------------------------------------------
# Special values

##
# Backwards compatibility
项目:hakkuframework    作者:4shadoww    | 项目源码 | 文件源码
def __repr__(self):
        return "<DateTime %r at %x>" % (ensure_new_type(self.value), id(self))
项目:hakkuframework    作者:4shadoww    | 项目源码 | 文件源码
def dump_double(self, value, write):
        write("<value><double>")
        write(repr(ensure_new_type(value)))
        write("</double></value>\n")
项目:packaging    作者:blockstack    | 项目源码 | 文件源码
def __repr__(self):
        return "<Fault %s: %r>" % (ensure_new_type(self.faultCode),
                                   ensure_new_type(self.faultString))

# --------------------------------------------------------------------
# Special values

##
# Backwards compatibility
项目:packaging    作者:blockstack    | 项目源码 | 文件源码
def __repr__(self):
        return "<DateTime %r at %x>" % (ensure_new_type(self.value), id(self))
项目:packaging    作者:blockstack    | 项目源码 | 文件源码
def dump_double(self, value, write):
        write("<value><double>")
        write(repr(ensure_new_type(value)))
        write("</double></value>\n")
项目:islam-buddy    作者:hamir    | 项目源码 | 文件源码
def __repr__(self):
        return "<Fault %s: %r>" % (ensure_new_type(self.faultCode),
                                   ensure_new_type(self.faultString))

# --------------------------------------------------------------------
# Special values

##
# Backwards compatibility
项目:islam-buddy    作者:hamir    | 项目源码 | 文件源码
def __repr__(self):
        return "<DateTime %r at %x>" % (ensure_new_type(self.value), id(self))
项目:islam-buddy    作者:hamir    | 项目源码 | 文件源码
def dump_double(self, value, write):
        write("<value><double>")
        write(repr(ensure_new_type(value)))
        write("</double></value>\n")
项目:FightstickDisplay    作者:calexil    | 项目源码 | 文件源码
def __repr__(self):
        return "<Fault %s: %r>" % (ensure_new_type(self.faultCode),
                                   ensure_new_type(self.faultString))

# --------------------------------------------------------------------
# Special values

##
# Backwards compatibility
项目:FightstickDisplay    作者:calexil    | 项目源码 | 文件源码
def __repr__(self):
        return "<DateTime %r at %x>" % (ensure_new_type(self.value), id(self))
项目:FightstickDisplay    作者:calexil    | 项目源码 | 文件源码
def dump_double(self, value, write):
        write("<value><double>")
        write(repr(ensure_new_type(value)))
        write("</double></value>\n")
项目:cryptogram    作者:xinmingzhang    | 项目源码 | 文件源码
def __repr__(self):
        return "<Fault %s: %r>" % (ensure_new_type(self.faultCode),
                                   ensure_new_type(self.faultString))

# --------------------------------------------------------------------
# Special values

##
# Backwards compatibility
项目:cryptogram    作者:xinmingzhang    | 项目源码 | 文件源码
def __repr__(self):
        return "<DateTime %r at %x>" % (ensure_new_type(self.value), id(self))
项目:cryptogram    作者:xinmingzhang    | 项目源码 | 文件源码
def dump_double(self, value, write):
        write("<value><double>")
        write(repr(ensure_new_type(value)))
        write("</double></value>\n")
项目:Repobot    作者:Desgard    | 项目源码 | 文件源码
def __repr__(self):
        return "<Fault %s: %r>" % (ensure_new_type(self.faultCode),
                                   ensure_new_type(self.faultString))

# --------------------------------------------------------------------
# Special values

##
# Backwards compatibility
项目:Repobot    作者:Desgard    | 项目源码 | 文件源码
def __repr__(self):
        return "<DateTime %r at %x>" % (ensure_new_type(self.value), id(self))
项目:Repobot    作者:Desgard    | 项目源码 | 文件源码
def dump_double(self, value, write):
        write("<value><double>")
        write(repr(ensure_new_type(value)))
        write("</double></value>\n")
项目:UMOG    作者:hsab    | 项目源码 | 文件源码
def __repr__(self):
        return "<Fault %s: %r>" % (ensure_new_type(self.faultCode),
                                   ensure_new_type(self.faultString))

# --------------------------------------------------------------------
# Special values

##
# Backwards compatibility
项目:UMOG    作者:hsab    | 项目源码 | 文件源码
def __repr__(self):
        return "<DateTime %r at %x>" % (ensure_new_type(self.value), id(self))
项目:UMOG    作者:hsab    | 项目源码 | 文件源码
def dump_double(self, value, write):
        write("<value><double>")
        write(repr(ensure_new_type(value)))
        write("</double></value>\n")
项目:blackmamba    作者:zrzka    | 项目源码 | 文件源码
def __repr__(self):
        return "<Fault %s: %r>" % (ensure_new_type(self.faultCode),
                                   ensure_new_type(self.faultString))

# --------------------------------------------------------------------
# Special values

##
# Backwards compatibility
项目:blackmamba    作者:zrzka    | 项目源码 | 文件源码
def __repr__(self):
        return "<DateTime %r at %x>" % (ensure_new_type(self.value), id(self))
项目:blackmamba    作者:zrzka    | 项目源码 | 文件源码
def dump_double(self, value, write):
        write("<value><double>")
        write(repr(ensure_new_type(value)))
        write("</double></value>\n")
项目:beepboop    作者:nicolehe    | 项目源码 | 文件源码
def __repr__(self):
        return "<Fault %s: %r>" % (ensure_new_type(self.faultCode),
                                   ensure_new_type(self.faultString))

# --------------------------------------------------------------------
# Special values

##
# Backwards compatibility
项目:beepboop    作者:nicolehe    | 项目源码 | 文件源码
def __repr__(self):
        return "<DateTime %r at %x>" % (ensure_new_type(self.value), id(self))
项目:beepboop    作者:nicolehe    | 项目源码 | 文件源码
def dump_double(self, value, write):
        write("<value><double>")
        write(repr(ensure_new_type(value)))
        write("</double></value>\n")
项目:hackathon    作者:vertica    | 项目源码 | 文件源码
def __repr__(self):
        return "<Fault %s: %r>" % (ensure_new_type(self.faultCode),
                                   ensure_new_type(self.faultString))

# --------------------------------------------------------------------
# Special values

##
# Backwards compatibility
项目:hackathon    作者:vertica    | 项目源码 | 文件源码
def __repr__(self):
        return "<DateTime %r at %x>" % (ensure_new_type(self.value), id(self))
项目:hackathon    作者:vertica    | 项目源码 | 文件源码
def dump_double(self, value, write):
        write("<value><double>")
        write(repr(ensure_new_type(value)))
        write("</double></value>\n")
项目:yatta_reader    作者:sound88    | 项目源码 | 文件源码
def __repr__(self):
        return "<Fault %s: %r>" % (ensure_new_type(self.faultCode),
                                   ensure_new_type(self.faultString))

# --------------------------------------------------------------------
# Special values

##
# Backwards compatibility
项目:yatta_reader    作者:sound88    | 项目源码 | 文件源码
def __repr__(self):
        return "<DateTime %r at %x>" % (ensure_new_type(self.value), id(self))
项目:yatta_reader    作者:sound88    | 项目源码 | 文件源码
def dump_double(self, value, write):
        write("<value><double>")
        write(repr(ensure_new_type(value)))
        write("</double></value>\n")