当前位置: 首页>>代码示例>>Python>>正文


Python documents.MultiPurposeList类代码示例

本文整理汇总了Python中orgmode.liborgmode.documents.MultiPurposeList的典型用法代码示例。如果您正苦于以下问题:Python MultiPurposeList类的具体用法?Python MultiPurposeList怎么用?Python MultiPurposeList使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了MultiPurposeList类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __setitem__

	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)
开发者ID:Ron89,项目名称:vim-orgmode,代码行数:26,代码来源:vimbuffer.py

示例2: __getitem__

	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
开发者ID:Ron89,项目名称:vim-orgmode,代码行数:9,代码来源:vimbuffer.py

示例3: extend

	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)
开发者ID:kongluoxing,项目名称:vimwiki-org,代码行数:11,代码来源:vimbuffer.py

示例4: __setslice__

	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)
开发者ID:kongluoxing,项目名称:vimwiki-org,代码行数:11,代码来源:vimbuffer.py

示例5: __setitem__

	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)
开发者ID:Yixf-Self,项目名称:vim-orgmode,代码行数:14,代码来源:vimbuffer.py

示例6: __iadd__

	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)
开发者ID:Yixf-Self,项目名称:vim-orgmode,代码行数:12,代码来源:vimbuffer.py

示例7: __contains__

	def __contains__(self, item):
		i = item
		if type(i) is unicode:
			i = item.encode(u'utf-8')
		return MultiPurposeList.__contains__(self, i)
开发者ID:kongluoxing,项目名称:vimwiki-org,代码行数:5,代码来源:vimbuffer.py

示例8: pop

	def pop(self, i=-1):
		return MultiPurposeList.pop(self, i).decode(u'utf-8')
开发者ID:kongluoxing,项目名称:vimwiki-org,代码行数:2,代码来源:vimbuffer.py

示例9: index

	def index(self, item, *args):
		i = item
		if type(i) is unicode:
			i = item.encode(u'utf-8')
		MultiPurposeList.index(self, i, *args)
开发者ID:kongluoxing,项目名称:vimwiki-org,代码行数:5,代码来源:vimbuffer.py

示例10: insert

	def insert(self, i, item):
		_i = item
		if type(_i) is str:
			_i = item.encode(u'utf-8')
		MultiPurposeList.insert(self, i, _i)
开发者ID:kongluoxing,项目名称:vimwiki-org,代码行数:5,代码来源:vimbuffer.py

示例11: append

	def append(self, item):
		i = item
		if type(item) is str:
			i = item.encode(u'utf-8')
		MultiPurposeList.append(self, i)
开发者ID:kongluoxing,项目名称:vimwiki-org,代码行数:5,代码来源:vimbuffer.py

示例12: __setitem__

	def __setitem__(self, i, item):
		_i = item
		if type(_i) is unicode:
			_i = item.encode(u'utf-8')

		MultiPurposeList.__setitem__(self, i, _i)
开发者ID:kongluoxing,项目名称:vimwiki-org,代码行数:6,代码来源:vimbuffer.py

示例13: __getslice__

	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)]
开发者ID:kongluoxing,项目名称:vimwiki-org,代码行数:3,代码来源:vimbuffer.py

示例14: __getitem__

	def __getitem__(self, i):
		item = MultiPurposeList.__getitem__(self, i)
		if type(item) is str:
			return item.decode(u'utf-8')
		return item
开发者ID:kongluoxing,项目名称:vimwiki-org,代码行数:5,代码来源:vimbuffer.py

示例15: __init__

	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
开发者ID:kongluoxing,项目名称:vimwiki-org,代码行数:6,代码来源:vimbuffer.py


注:本文中的orgmode.liborgmode.documents.MultiPurposeList类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。