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


Python base.MultiPurposeList类代码示例

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


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

示例1: append

 def append(self, item, taint=True):
     if not self.__class__.is_heading(item):
         raise ValueError(u"Item is not a heading!")
     if item in self:
         raise ValueError(u"Heading is already part of this list!")
     self._associate_heading(item, self[-1] if len(self) > 0 else None, None, taint=taint)
     MultiPurposeList.append(self, item)
开发者ID:oyslboy,项目名称:config,代码行数:7,代码来源:headings.py

示例2: __setitem__

	def __setitem__(self, i, item):
		if isinstance(i, slice):
			o = item
			if self.__class__.is_domobj(o):
				o = (o, )
			o = flatten_list(o)
			for item in o:
				if not self.__class__.is_domobj(item):
					raise ValueError(u'List contains items that are not a Dom obj!')

			# self._add_to_deleted_domobjs(self[i:j])
			# self._associate_domobj(o, \
			# self[i - 1] if i - 1 >= 0 and i < len(self) else None, \
			# self[j] if j >= 0 and j < len(self) else None)
			MultiPurposeList.__setitem__(self, i, o)
		else:
			if not self.__class__.is_domobj(item):
				raise ValueError(u'Item is not a Dom obj!')
			if item in self:
				raise ValueError(u'Dom obj is already part of this list!')
			# self._add_to_deleted_domobjs(self[i])

			# self._associate_domobj(item, \
			# self[i - 1] if i - 1 >= 0 else None, \
			# self[i + 1] if i + 1 < len(self) else None)
			MultiPurposeList.__setitem__(self, i, item)
开发者ID:Ron89,项目名称:vim-orgmode,代码行数:26,代码来源:dom_obj.py

示例3: __setitem__

	def __setitem__(self, i, item):
		if isinstance(i, slice):
			start, stop, step = i.indices(len(self))
			items = item
			if self.__class__.is_heading(items):
				items = (items, )
			items = flatten_list(items)
			for head in items:
				if not self.__class__.is_heading(head):
					raise ValueError(u'List contains items that are not a heading!')

			self._add_to_deleted_headings(self[i])
			self._associate_heading(
				items,
				self[start - 1] if start - 1 >= 0 else None,
				self[stop] if stop < len(self) else None)
			MultiPurposeList.__setitem__(self, i, items)
		else:
			if not self.__class__.is_heading(item):
				raise ValueError(u'Item is not a heading!')
			if item in self:
				raise ValueError(u'Heading is already part of this list!')
			self._add_to_deleted_headings(self[i])
			self._associate_heading(
				item,
				self[i - 1] if i - 1 >= 0 else None,
				self[i + 1] if i + 1 < len(self) else None)
			MultiPurposeList.__setitem__(self, i, item)
开发者ID:Ron89,项目名称:vim-orgmode,代码行数:28,代码来源:headings.py

示例4: insert

 def insert(self, i, item, taint=True):
     self._associate_heading(
         item,
         self[i - 1] if i - 1 >= 0 and i - 1 < len(self) else None,
         self[i] if i >= 0 and i < len(self) else None,
         taint=taint,
     )
     MultiPurposeList.insert(self, i, item)
开发者ID:oyslboy,项目名称:config,代码行数:8,代码来源:headings.py

示例5: __delitem__

	def __delitem__(self, i):
		item = self[i]
		if item.previous_sibling:
			item.previous_sibling._next_sibling = item.next_sibling
		if item.next_sibling:
			item.next_sibling._previous_sibling = item.previous_sibling

		self._add_to_deleted_headings(item)
		MultiPurposeList.__delitem__(self, i)
开发者ID:imxiaohui,项目名称:vimrc-1,代码行数:9,代码来源:headings.py

示例6: __setitem__

    def __setitem__(self, i, item):
        if not self.__class__.is_heading(item):
            raise ValueError(u"Item is not a heading!")
        if item in self:
            raise ValueError(u"Heading is already part of this list!")
        self._add_to_deleted_headings(self[i])

        self._associate_heading(item, self[i - 1] if i - 1 >= 0 else None, self[i + 1] if i + 1 < len(self) else None)
        MultiPurposeList.__setitem__(self, i, item)
开发者ID:oyslboy,项目名称:config,代码行数:9,代码来源:headings.py

示例7: extend

	def extend(self, other):
		o = other
		if self.__class__.is_domobj(o):
			o = (o, )
		for item in o:
			if not self.__class__.is_domobj(item):
				raise ValueError(u'List contains items that are not a heading!')
		# self._associate_domobj(o, self[-1] if len(self) > 0 else None, None)
		MultiPurposeList.extend(self, o)
开发者ID:Ron89,项目名称:vim-orgmode,代码行数:9,代码来源:dom_obj.py

示例8: reverse

	def reverse(self):
		MultiPurposeList.reverse(self)
		prev_h = None
		for h in self:
			h._previous_sibling = prev_h
			h._next_sibling = None
			prev_h._next_sibling = h
			h.set_dirty()
			prev_h = h
开发者ID:Ron89,项目名称:vim-orgmode,代码行数:9,代码来源:dom_obj.py

示例9: sort

	def sort(self, *args, **kwds):
		MultiPurposeList.sort(*args, **kwds)
		prev_h = None
		for h in self:
			h._previous_sibling = prev_h
			h._next_sibling = None
			prev_h._next_sibling = h
			h.set_dirty()
			prev_h = h
开发者ID:Ron89,项目名称:vim-orgmode,代码行数:9,代码来源:dom_obj.py

示例10: append

	def append(self, item, taint=True):
		if not self.__class__.is_domobj(item):
			raise ValueError(u'Item is not a heading!')
		if item in self:
			raise ValueError(u'Heading is already part of this list!')
		# self._associate_domobj(
		# 	item, self[-1] if len(self) > 0 else None,
		# 	None, taint=taint)
		MultiPurposeList.append(self, item)
开发者ID:Ron89,项目名称:vim-orgmode,代码行数:9,代码来源:dom_obj.py

示例11: __delitem__

	def __delitem__(self, i, taint=True):
		item = self[i]
		if item.previous_sibling:
			item.previous_sibling._next_sibling = item.next_sibling
		if item.next_sibling:
			item.next_sibling._previous_sibling = item.previous_sibling

		# if taint:
			# self._add_to_deleted_domobjs(item)
		MultiPurposeList.__delitem__(self, i)
开发者ID:Yixf-Self,项目名称:vim-orgmode,代码行数:10,代码来源:dom_obj.py

示例12: __setitem__

	def __setitem__(self, i, item):
		if not self.__class__.is_domobj(item):
			raise ValueError(u'Item is not a Dom obj!')
		if item in self:
			raise ValueError(u'Dom obj is already part of this list!')
		# self._add_to_deleted_domobjs(self[i])

		# self._associate_domobj(item, \
		# self[i - 1] if i - 1 >= 0 else None, \
		# self[i + 1] if i + 1 < len(self) else None)
		MultiPurposeList.__setitem__(self, i, item)
开发者ID:Yixf-Self,项目名称:vim-orgmode,代码行数:11,代码来源:dom_obj.py

示例13: __delslice__

	def __delslice__(self, i, j):
		i = max(i, 0)
		j = max(j, 0)
		items = self[i:j]
		if items:
			first = items[0]
			last = items[-1]
			if first.previous_sibling:
				first.previous_sibling._next_sibling = last.next_sibling
			if last.next_sibling:
				last.next_sibling._previous_sibling = first.previous_sibling
		self._add_to_deleted_headings(items)
		MultiPurposeList.__delslice__(self, i, j)
开发者ID:imxiaohui,项目名称:vimrc-1,代码行数:13,代码来源:headings.py

示例14: __delslice__

	def __delslice__(self, i, j, taint=True):
		i = max(i, 0)
		j = max(j, 0)
		items = self[i:j]
		if items:
			first = items[0]
			last = items[-1]
			if first.previous_sibling:
				first.previous_sibling._next_sibling = last.next_sibling
			if last.next_sibling:
				last.next_sibling._previous_sibling = first.previous_sibling
		# if taint:
			# self._add_to_deleted_domobjs(items)
		MultiPurposeList.__delslice__(self, i, j)
开发者ID:Yixf-Self,项目名称:vim-orgmode,代码行数:14,代码来源:dom_obj.py

示例15: __setslice__

	def __setslice__(self, i, j, other):
		o = other
		if self.__class__.is_heading(o):
			o = (o, )
		o = flatten_list(o)
		for item in o:
			if not self.__class__.is_heading(item):
				raise ValueError(u'List contains items that are not a heading!')
		i = max(i, 0)
		j = max(j, 0)
		self._add_to_deleted_headings(self[i:j])
		self._associate_heading(o, \
				self[i - 1] if i - 1 >= 0 and i < len(self) else None, \
				self[j] if j >= 0 and j < len(self) else None)
		MultiPurposeList.__setslice__(self, i, j, o)
开发者ID:Amperture,项目名称:vim-orgmode,代码行数:15,代码来源:headings.py


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