当前位置: 首页>>代码示例>>Python>>正文


Python UtilFunc.prepareDirectory方法代码示例

本文整理汇总了Python中UtilFunc.prepareDirectory方法的典型用法代码示例。如果您正苦于以下问题:Python UtilFunc.prepareDirectory方法的具体用法?Python UtilFunc.prepareDirectory怎么用?Python UtilFunc.prepareDirectory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UtilFunc的用法示例。


在下文中一共展示了UtilFunc.prepareDirectory方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: setUp

# 需要导入模块: import UtilFunc [as 别名]
# 或者: from UtilFunc import prepareDirectory [as 别名]
	def setUp(self):
		UtilFunc.prepareDirectory(os.path.join(sys.path[0],'TestFiles/FixRawList'))
		UtilFunc.prepareDirectory(os.path.join(sys.path[0],'TestFiles/FixRawList/Input'))
		UtilFunc.prepareDirectory(os.path.join(sys.path[0],'TestFiles/FixRawList/InputComplete'))
		UtilFunc.prepareDirectory(os.path.join(sys.path[0],'TestFiles/FixRawList/Output'))

		self.inputFile = 		os.path.join(sys.path[0],'TestFiles/FixRawList/Input/fixRawList1_Input_MercerRyan_14.txt')
		self.inputCompleteFile = os.path.join(sys.path[0],'TestFiles/FixRawList/InputComplete/fixRawList1_Input_MercerRyan_14.txt')
		self.outputFile = 		os.path.join(sys.path[0],'TestFiles/FixRawList/Output/fixRawList1_Output_MercerRyan_14.txt')

		self.names = ['Ryan Mercer','Erik Scott Lunsford','Andrew Muinos','Yuki Chavez','Charles Eaton','Kunal Shah','Eric Crawford','Matthew MacDonald','Lisa']
		with open(self.inputFile, 'w') as f:
			###name1 is normal with a '\n' after
			###name2 has 3 parts
			###name3 has a ','
			###name4 has a ',' and '\n' after
			###name5 has a ',' (preparing for next)
			###name6 has a ' ' before and ',\n ' after
			###name7 is part of testing name6
			###name7-8 is blank
			###name8 has a '\r' after
			###name9 has only 1 part
			f.write('{}\n{}\n{},{},\n{}, {},\n {},\'\',{}\r{}'.format(	self.names[0],
																		self.names[1],
																		self.names[2],
																		self.names[3],
																		self.names[4],
																		self.names[5],
																		self.names[6],
																		self.names[7],
																		self.names[8]))
			FixRawList.fixRawList(self.inputFile,self.inputCompleteFile,self.outputFile)
开发者ID:cdslug,项目名称:ClassmateMemory,代码行数:34,代码来源:TestScript.py

示例2: test_prepareDirectory_01

# 需要导入模块: import UtilFunc [as 别名]
# 或者: from UtilFunc import prepareDirectory [as 别名]
	def test_prepareDirectory_01(self):
		testPath = os.path.join(sys.path[0],'TestFiles/UtilFunc/DummyDir1')
		UtilFunc.prepareDirectory(testPath)
		self.assertEqual( os.path.exists(testPath), True )
开发者ID:cdslug,项目名称:ClassmateMemory,代码行数:6,代码来源:TestScript.py

示例3:

# 需要导入模块: import UtilFunc [as 别名]
# 或者: from UtilFunc import prepareDirectory [as 别名]
		#any change to the inputs will require regenerating all reports. 
	except OSError:
		pass

########################
#####     MAIN     #####
########################
usageDescription = ['working Directory: full path to the data working directory']
UtilFunc.checkInputArgs(1, usageDescription)

parentPath = sys.argv[1]

#####     REFERENCE PREP     #####

subPath = os.path.join(parentPath,'0_ReferenceFiles')
UtilFunc.prepareDirectory(subPath)
#TODO: decide if I need to verify that this file exists now, or when functions need to use it
yearbookReferenceFilePath = os.path.join(subPath,'IndexedYearbook.csv')

#####     LIST DATA PREP     #####
###each stage saves its output to it's own output folder, 
###then a messenger function copies over output of one stage to input of the next
### ModulePath is set with supPath2 in the first for-loop below
moduleFunctions = [
		{'ModuleFunction':FixRawList.fixRawList,		'ModuleName':'RawList',		'ModulePath':'', 'OutputExt':'.csv'},
		{'ModuleFunction':IndexList.indexList,			'ModuleName':'IndexList',	'ModulePath':'', 'OutputExt':'.csv'},
		{'ModuleFunction':GenerateReport.generateReport,'ModuleName':'Reporting',	'ModulePath':'', 'OutputExt':'.pdf'}]

subPath = os.path.join(parentPath,'1_ListData')
UtilFunc.prepareDirectory(subPath)
subPath2List = [os.path.join(subPath,sp2) for sp2 in ['0_Raw','1_Index','2_Reporting']]
开发者ID:cdslug,项目名称:ClassmateMemory,代码行数:33,代码来源:ClassmateBatch.py


注:本文中的UtilFunc.prepareDirectory方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。