Ejemplo n.º 1
0
	def __getitem__(B,item):
		A=item
		if B.box_options.get(_G)and isinstance(A,str)and A.startswith('['):
			C=_list_pos_re.search(A);D=super(BoxList,B).__getitem__(int(C.groups()[0]))
			if len(C.group())==len(A):return D
			return D.__getitem__(A[len(C.group()):].lstrip('.'))
		return super(BoxList,B).__getitem__(A)
Ejemplo n.º 2
0
	def __setitem__(B,key,value):
		C=value;A=key
		if B.box_options.get(_E):raise BoxError(_F)
		if B.box_options.get(_G)and isinstance(A,str)and A.startswith('['):
			D=_list_pos_re.search(A);E=int(D.groups()[0])
			if len(D.group())==len(A):return super(BoxList,B).__setitem__(E,C)
			return super(BoxList,B).__getitem__(E).__setitem__(A[len(D.group()):].lstrip('.'),C)
		super(BoxList,B).__setitem__(A,C)