original_docstring: Create a valid output filename. if the name of the file already exists the file name is auto-incremented.
docstring: Create a valid output filename. if the name of the file already exists the file name is auto-incremented.
docstring_tokens: Create a valid output filename . if the name of the file already exists the file name is auto - incremented .
code: def addFileNameAppendage(path, appendage):
  	'''Create a valid output filename. if the name of the file already exists the file name is auto-incremented.'''
  	path = os.path.expanduser(path)
  
  	if not os.path.exists(os.path.dirname(path)):
  		os.makedirs(os.path.dirname(path))
  
  	# if not os.path.exists(path):
  	# 	return path
  
  	root, ext = os.path.splitext(os.path.expanduser(path))
  	dir	   = os.path.dirname(root)
  	fname	 = os.path.basename(root)
  	candidate = "{}{}{}".format(fname, appendage, ext)
  
  	return os.path.join(dir, candidate)
code_tokens: def addFileNameAppendage ( path , appendage ) : path = os . path . expanduser ( path ) if not os . path . exists ( os . path . dirname ( path ) ) : os . makedirs ( os . path . dirname ( path ) ) root , ext = os . path . splitext ( os . path . expanduser ( path ) ) dir = os . path . dirname ( root ) fname = os . path . basename ( root ) candidate = "{}{}{}" . format ( fname , appendage , ext ) return os . path . join ( dir , candidate )
short_docstring: Create a valid output filename.
short_docstring_tokens: Create a valid output filename .
comment: '''Create a valid output filename. if the name of the file already exists the file name is auto-incremented.'''$SEP$# if not os.path.exists(path):$SEP$# 	return path