OSC2.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:pyOSC3 作者: Qirky 项目源码 文件源码
def append(self, argument, typehint=None):
        """Appends data to the message, updating the typetags based on
        the argument's type. If the argument is a blob (counted
        string) pass in 'b' as typehint.
        'argument' may also be a list or tuple, in which case its elements
        will get appended one-by-one, all using the provided typehint
        """
        if type(argument) == types.DictType:
            argument = argument.items()
        elif isinstance(argument, OSCMessage):
            raise TypeError("Can only append 'OSCMessage' to 'OSCBundle'")

        if hasattr(argument, '__iter__'):
                        for arg in argument:
                                self.append(arg, typehint)

                        return

        if typehint == 'b':
            binary = OSCBlob(argument)
            tag = 'b'
        elif typehint == 't':
            binary = OSCTimeTag(argument)
            tag = 't'
        else:
            tag, binary = OSCArgument(argument, typehint)

        self.typetags += tag
        self.message += binary
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号