コード例 #1
0
    def __init__(self, *args, **kwargs):
        """
		handle=A Go-side object is always initialized with an explicit handle=arg
		otherwise parameter is a python list that we copy from
		"""
        self.index = 0
        if len(kwargs) == 1 and 'handle' in kwargs:
            self.handle = kwargs['handle']
            _test.IncRef(self.handle)
        elif len(args) == 1 and isinstance(args[0], go.GoClass):
            self.handle = args[0].handle
            _test.IncRef(self.handle)
        else:
            self.handle = _test.Map_int64_int32_CTor()
            _test.IncRef(self.handle)
            if len(args) > 0:
                if not isinstance(args[0], collections.Mapping):
                    raise TypeError(
                        'Map_int64_int32.__init__ takes a mapping as argument')
                for k, v in args[0].items():
                    _test.Map_int64_int32_set(self.handle, k, v)
コード例 #2
0
    def __init__(self, *args, **kwargs):
        """
		handle=A Go-side object is always initialized with an explicit handle=arg
		otherwise parameter is a python list that we copy from
		"""
        self.index = 0
        if len(kwargs) == 1 and 'handle' in kwargs:
            self.handle = kwargs['handle']
            _test.IncRef(self.handle)
        elif len(args) == 1 and isinstance(args[0], go.GoClass):
            self.handle = args[0].handle
            _test.IncRef(self.handle)
        else:
            self.handle = _test.Slice_Ptr_expr_Expr_CTor()
            _test.IncRef(self.handle)
            if len(args) > 0:
                if not isinstance(args[0], collections.Iterable):
                    raise TypeError(
                        'Slice_Ptr_expr_Expr.__init__ takes a sequence as argument'
                    )
                for elt in args[0]:
                    self.append(elt)
コード例 #3
0
    def __init__(self, *args, **kwargs):
        """
		handle=A Go-side object is always initialized with an explicit handle=arg
		otherwise parameters can be unnamed in order of field names or named fields
		in which case a new Go object is constructed first
		"""
        if len(kwargs) == 1 and 'handle' in kwargs:
            self.handle = kwargs['handle']
            _test.IncRef(self.handle)
        elif len(args) == 1 and isinstance(args[0], go.GoClass):
            self.handle = args[0].handle
            _test.IncRef(self.handle)
        else:
            self.handle = _test.test_TestExpr_CTor()
            _test.IncRef(self.handle)
            if 0 < len(args):
                self.Expr = args[0]
            if "Expr" in kwargs:
                self.Expr = kwargs["Expr"]
            if 1 < len(args):
                self.SourceInfo = args[1]
            if "SourceInfo" in kwargs:
                self.SourceInfo = kwargs["SourceInfo"]