modeling/visualization/skillTreeConversion/skill.py
def normalizeString(string):
	"""Make a copy of the string with any leading/trailing whitespace removed on all lines, and runs of empty lines reduced to a single empty line."""
	try:
		if string.isspace():	#this also ensures that we get an exception if `string` is not a string, in both cases we return nothing
			return
	except:
		return

	#strip each line of leading/trailing whitespace
	#and reduce any run of empty lines to a single empty line
	lines = string.splitlines()
	stripEmptyLines = True
	for i in range(len(lines)-1, -1, -1):
		lines[i] = lines[i].strip()
		if len(lines[i]) == 0:
			if stripEmptyLines:
				del lines[i]
			stripEmptyLines = True
		else:
			stripEmptyLines = False

	#the code above may leave a single empty line at the beginning, strip that if it exists
	while len(lines) > 0 and len(lines[0]) == 0:
		del lines[0]

	#reassemble the string from its lines
	return "\n".join(lines)
Make a copy of the string with any leading/trailing whitespace removed on all lines, and runs of empty lines reduced to a single empty line.
Make a copy of the string with any leading/trailing whitespace removed on all lines, and runs of empty lines reduced to a single empty line.
Make a copy of the string with any leading / trailing whitespace removed on all lines and runs of empty lines reduced to a single empty line .
def normalizeString(string):
	try:
		if string.isspace():	
			return
	except:
		return
	lines = string.splitlines()
	stripEmptyLines = True
	for i in range(len(lines)-1, -1, -1):
		lines[i] = lines[i].strip()
		if len(lines[i]) == 0:
			if stripEmptyLines:
				del lines[i]
			stripEmptyLines = True
		else:
			stripEmptyLines = False
	while len(lines) > 0 and len(lines[0]) == 0:
		del lines[0]
	return "\n".join(lines)
def normalizeString ( string ) : try : if string . isspace ( ) : return except : return lines = string . splitlines ( ) stripEmptyLines = True for i in range ( len ( lines ) - 1 , - 1 , - 1 ) : lines [ i ] = lines [ i ] . strip ( ) if len ( lines [ i ] ) == 0 : if stripEmptyLines : del lines [ i ] stripEmptyLines = True else : stripEmptyLines = False while len ( lines ) > 0 and len ( lines [ 0 ] ) == 0 : del lines [ 0 ] return "\n" . join ( lines )
Make a copy of the string with any leading/trailing whitespace removed on all lines, and runs of empty lines reduced to a single empty line.
Make a copy of the string with any leading / trailing whitespace removed on all lines and runs of empty lines reduced to a single empty line .
"""Make a copy of the string with any leading/trailing whitespace removed on all lines, and runs of empty lines reduced to a single empty line.""" #this also ensures that we get an exception if `string` is not a string, in both cases we return nothing #strip each line of leading/trailing whitespace #and reduce any run of empty lines to a single empty line #the code above may leave a single empty line at the beginning, strip that if it exists #reassemble the string from its lines
string