當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。