Source
def siblings(self):
ret = pyNodeList()
for node in self:
brothers = node.siblings()
if isinstance(brothers, pyNodeList) and len(brothers) != 0:
for bro in brothers:
duplicated = False
if len(ret) != 0:
for r in ret:
if bro == r:
duplicated = True
break
if not duplicated: ret.append(bro)
elif isinstance(brothers, pyNode):
duplicated = True
if len(ret) != 0:
for r in ret:
if brothers == r:
duplicated = True
break
if not duplicated: ret.append(brothers)
if len(ret) == 1: return ret[0]
else: return ret