<commit_before>skeleton = \
['ROOT Hips', \
	['JOINT LHipJoint', \
		['JOINT LeftUpLeg', \
			['JOINT LeftLeg', \
				['JOINT LeftFoot', \
					['JOINT LeftToeBase']]]]], \
	['JOINT RHipJoint', \
		['JOINT RightUpLeg', \
			['JOINT RightLeg', \
				['JOINT RightFoot', \
					['JOINT RightToeBase']]]]], \
	['JOINT LowerBack', \
		['JOINT Spine', \
			['JOINT Spine1', \
				['JOINT Neck', \
					['JOINT Neck1', \
						['JOINT Head']]], \
				['JOINT LeftShoulder', \
					['JOINT LeftArm', \
						['JOINT LeftForeArm', \
							['JOINT LeftHand', \
								['JOINT LeftFingerBase', \
									['JOINT LeftHandIndex1']], \
								['JOINT LThumb']]]]], \
				['JOINT RightShoulder', \
					['JOINT RightArm', \
						['JOINT RightForeArm', \
							['JOINT RightHand', \
								['JOINT RightFingerBase', \
									['JOINT RightHandIndex1']], \
								['JOINT RThumb']]]]] \
			]]]]

#print(skeleton)
# I should get 7 branches




def get_banch(parents, children, branches):
	if len(children) == 1:
		parents.append(children[0])
		branches.append(parents)

	elif len(children) == 2:
		parents.append(children[0])
		parents = get_banch(parents, children[1], branches)

	else:
		parents.append(children[0])
		print("------------------")
		for i in range(1,len(children)):
			parents = get_banch(parents, children[i], branches)
	return parents

def get_branches(skeleton):
	branches = []
	if len(skeleton) > 1:
		for i in range(1,len(skeleton)): # this is to stop the loop
			branch = []
			branch.append(skeleton[0])

			parents = branch[:len(branch)]
			children = skeleton[i]
			
			# ---------------------- add code here ----------------------

			branch = get_banch(parents, children, branches)

			# ---------------------- add code end ----------------------
			
			print(branch)
			print()


	return branches
	




if __name__ == "__main__":
    get_branches(skeleton)








<commit_msg>there are 7 branches but the values are not right.<commit_after>skeleton = \
['ROOT Hips', \
	['JOINT LHipJoint', \
		['JOINT LeftUpLeg', \
			['JOINT LeftLeg', \
				['JOINT LeftFoot', \
					['JOINT LeftToeBase']]]]], \
	['JOINT RHipJoint', \
		['JOINT RightUpLeg', \
			['JOINT RightLeg', \
				['JOINT RightFoot', \
					['JOINT RightToeBase']]]]], \
	['JOINT LowerBack', \
		['JOINT Spine', \
			['JOINT Spine1', \
				['JOINT Neck', \
					['JOINT Neck1', \
						['JOINT Head']]], \
				['JOINT LeftShoulder', \
					['JOINT LeftArm', \
						['JOINT LeftForeArm', \
							['JOINT LeftHand', \
								['JOINT LeftFingerBase', \
									['JOINT LeftHandIndex1']], \
								['JOINT LThumb']]]]], \
				['JOINT RightShoulder', \
					['JOINT RightArm', \
						['JOINT RightForeArm', \
							['JOINT RightHand', \
								['JOINT RightFingerBase', \
									['JOINT RightHandIndex1']], \
								['JOINT RThumb']]]]] \
			]]]]

#print(skeleton)
# I should get 7 branches

def get_banch(parents, children, index, branches):
	print(index)
	if len(children) == 1:
		parents.append(children[0])
		branches.append(parents)
		print()

	elif len(children) == 2:
		parents.append(children[0])
		parents = get_banch(parents, children[1], index+1, branches)

	else:
		parents.append(children[0])
		for i in range(1,len(children)):
			print(parents[:index+1])
			print(children[i])
			new = []
			new = get_banch(parents, children[i], index, branches)
			
	return parents

def get_branches(skeleton):
	branches = []
	if len(skeleton) > 1:
		for i in range(1,len(skeleton)): # this is to stop the loop
			branch = []
			branch.append(skeleton[0])

			parents = branch[:len(branch)]
			children = skeleton[i]
			
			# ---------------------- add code here ----------------------

			branch = get_banch(parents, children, 1, branches)

			# ---------------------- add code end ----------------------
			
			#print(branch)
			print()


	return branches
	




if __name__ == "__main__":
    get_branches(skeleton)









{'fraction_non_alphanumeric': 0.21006900076667517, 'fraction_numerical': 0.00868898543317148, 'mean_word_length': 2.3510273972602738, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1490352', 'n_tokens_mistral': 1678, 'n_tokens_neox': 1310, 'n_words': 295}