Example #1
0
    def __setitem__(self, i, item):
        if isinstance(i, slice):
            o = []
            o_tmp = item
            if type(o_tmp) not in (list,
                                   tuple) and not isinstance(o_tmp, UserList):
                o_tmp = list(o_tmp)
            for item in o_tmp:
                if type(item) == unicode:
                    o.append(u_encode(item))
                else:
                    o.append(item)
            MultiPurposeList.__setitem__(self, i, o)
        else:
            _i = item
            if type(_i) is unicode:
                _i = u_encode(item)

            # TODO: fix this bug properly, it is really strange that it fails on
            # python3 without it. Problem is that when _i = ['* '] it fails in
            # UserList.__setitem__() but if it is changed in debuggr in __setitem__
            # like item[0] = '* ' it works, hence this is some quirk with unicode
            # stuff but very likely vim 7.4 BUG too.
            if isinstance(_i, UserList) and sys.version_info > (3, ):
                _i = [s.encode('utf8').decode('utf8') for s in _i]

            MultiPurposeList.__setitem__(self, i, _i)
Example #2
0
	def __setitem__(self, i, item):
		if isinstance(i, slice):
			o = []
			o_tmp = item
			if type(o_tmp) not in (list, tuple) and not isinstance(o_tmp, UserList):
				o_tmp = list(o_tmp)
			for item in o_tmp:
				if type(item) == unicode:
					o.append(u_encode(item))
				else:
					o.append(item)
			MultiPurposeList.__setitem__(self, i, o)
		else:
			_i = item
			if type(_i) is unicode:
				_i = u_encode(item)

			# TODO: fix this bug properly, it is really strange that it fails on
			# python3 without it. Problem is that when _i = ['* '] it fails in
			# UserList.__setitem__() but if it is changed in debuggr in __setitem__
			# like item[0] = '* ' it works, hence this is some quirk with unicode
			# stuff but very likely vim 7.4 BUG too.
			if isinstance(_i, UserList) and sys.version_info > (3, ):
				_i = [s.encode('utf8').decode('utf8') for s in _i]

			MultiPurposeList.__setitem__(self, i, _i)
Example #3
0
 def __getitem__(self, i):
     if isinstance(i, slice):
         return [u_decode(item) if type(item) is str else item \
           for item in MultiPurposeList.__getitem__(self, i)]
     else:
         item = MultiPurposeList.__getitem__(self, i)
         if type(item) is str:
             return u_decode(item)
         return item
Example #4
0
	def __getitem__(self, i):
		if isinstance(i, slice):
			return [u_decode(item) if type(item) is str else item \
					for item in MultiPurposeList.__getitem__(self, i)]
		else:
			item = MultiPurposeList.__getitem__(self, i)
			if type(item) is str:
				return u_decode(item)
			return item
Example #5
0
	def __setslice__(self, i, j, other):
		o = []
		o_tmp = other
		if type(o_tmp) not in (list, tuple) and not isinstance(o_tmp, UserList):
			o_tmp = list(o_tmp)
		for item in o_tmp:
			if type(item) == unicode:
				o.append(item.encode(u'utf-8'))
			else:
				o.append(item)
		MultiPurposeList.__setslice__(self, i, j, o)
Example #6
0
	def extend(self, other):
		o = []
		o_tmp = other
		if type(o_tmp) not in (list, tuple) and not isinstance(o_tmp, UserList):
			o_tmp = list(o_tmp)
		for i in o_tmp:
			if type(i) is unicode:
				o.append(i.encode(u'utf-8'))
			else:
				o.append(i)
		MultiPurposeList.extend(self, o)
Example #7
0
    def __setitem__(self, i, item):
        _i = item
        if type(_i) is unicode:
            _i = u_encode(item)

        # TODO: fix this bug properly, it is really strange that it fails on
        # python3 without it. Problem is that when _i = ['* '] it fails in
        # UserList.__setitem__() but if it is changed in debuggr in __setitem__
        # like item[0] = '* ' it works, hence this is some quirk with unicode
        # stuff but very likely vim 7.4 BUG too.
        if isinstance(_i, UserList) and sys.version_info > (3, ):
            _i = [s.encode('utf8').decode('utf8') for s in _i]

        MultiPurposeList.__setitem__(self, i, _i)
Example #8
0
	def __setitem__(self, i, item):
		_i = item
		if type(_i) is unicode:
			_i = u_encode(item)

		# TODO: fix this bug properly, it is really strange that it fails on
		# python3 without it. Problem is that when _i = ['* '] it fails in
		# UserList.__setitem__() but if it is changed in debuggr in __setitem__
		# like item[0] = '* ' it works, hence this is some quirk with unicode
		# stuff but very likely vim 7.4 BUG too.
		if isinstance(_i, UserList) and sys.version_info > (3, ):
			_i = [s.encode('utf8').decode('utf8') for s in _i]

		MultiPurposeList.__setitem__(self, i, _i)
Example #9
0
	def __iadd__(self, other):
		o = []
		o_tmp = other
		if type(o_tmp) not in (list, tuple) and not isinstance(o_tmp, UserList):
			o_tmp = list(o_tmp)
		for i in o_tmp:
			if type(i) is unicode:
				o.append(u_encode(i))
			else:
				o.append(i)

		return MultiPurposeList.__iadd__(self, o)
Example #10
0
    def __iadd__(self, other):
        o = []
        o_tmp = other
        if type(o_tmp) not in (list,
                               tuple) and not isinstance(o_tmp, UserList):
            o_tmp = list(o_tmp)
        for i in o_tmp:
            if type(i) is unicode:
                o.append(u_encode(i))
            else:
                o.append(i)

        return MultiPurposeList.__iadd__(self, o)
Example #11
0
	def append(self, item):
		i = item
		if type(item) is str:
			i = item.encode(u'utf-8')
		MultiPurposeList.append(self, i)
Example #12
0
	def __setitem__(self, i, item):
		_i = item
		if type(_i) is unicode:
			_i = item.encode(u'utf-8')

		MultiPurposeList.__setitem__(self, i, _i)
Example #13
0
	def __getslice__(self, i, j):
		return [item.decode(u'utf-8') if type(item) is str else item \
				for item in MultiPurposeList.__getslice__(self, i, j)]
Example #14
0
	def __getitem__(self, i):
		item = MultiPurposeList.__getitem__(self, i)
		if type(item) is str:
			return item.decode(u'utf-8')
		return item
Example #15
0
 def index(self, item, *args):
     i = item
     if type(i) is unicode:
         i = u_encode(item)
     MultiPurposeList.index(self, i, *args)
Example #16
0
	def pop(self, i=-1):
		return MultiPurposeList.pop(self, i).decode(u'utf-8')
Example #17
0
	def pop(self, i=-1):
		return u_decode(MultiPurposeList.pop(self, i))
Example #18
0
	def index(self, item, *args):
		i = item
		if type(i) is unicode:
			i = u_encode(item)
		MultiPurposeList.index(self, i, *args)
Example #19
0
 def append(self, item):
     i = item
     if type(item) is str:
         i = u_encode(item)
     MultiPurposeList.append(self, i)
Example #20
0
	def append(self, item):
		i = item
		if type(item) is str:
			i = u_encode(item)
		MultiPurposeList.append(self, i)
Example #21
0
 def pop(self, i=-1):
     return u_decode(MultiPurposeList.pop(self, i))
Example #22
0
	def insert(self, i, item):
		_i = item
		if type(_i) is str:
			_i = item.encode(u'utf-8')
		MultiPurposeList.insert(self, i, _i)
Example #23
0
	def __init__(self, vimbuffer, on_change=None):
		MultiPurposeList.__init__(self, on_change=on_change)

		# replace data with vimbuffer to make operations change the actual
		# buffer
		self.data = vimbuffer
Example #24
0
	def index(self, item, *args):
		i = item
		if type(i) is unicode:
			i = item.encode(u'utf-8')
		MultiPurposeList.index(self, i, *args)
Example #25
0
	def __contains__(self, item):
		i = item
		if type(i) is unicode:
			i = item.encode(u'utf-8')
		return MultiPurposeList.__contains__(self, i)
Example #26
0
	def insert(self, i, item):
		_i = item
		if type(_i) is str:
			_i = u_encode(item)
		MultiPurposeList.insert(self, i, _i)
Example #27
0
 def insert(self, i, item):
     _i = item
     if type(_i) is str:
         _i = u_encode(item)
     MultiPurposeList.insert(self, i, _i)