本文整理汇总了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)
示例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
示例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)
示例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)
示例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)
示例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)
示例7: __contains__
def __contains__(self, item):
i = item
if type(i) is unicode:
i = item.encode(u'utf-8')
return MultiPurposeList.__contains__(self, i)
示例8: pop
def pop(self, i=-1):
return MultiPurposeList.pop(self, i).decode(u'utf-8')
示例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)
示例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)
示例11: append
def append(self, item):
i = item
if type(item) is str:
i = item.encode(u'utf-8')
MultiPurposeList.append(self, i)
示例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)
示例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)]
示例14: __getitem__
def __getitem__(self, i):
item = MultiPurposeList.__getitem__(self, i)
if type(item) is str:
return item.decode(u'utf-8')
return item
示例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