write all source codes of blob into a folder
This commit is contained in:
parent
c1805e16c3
commit
b03ef849db
13
loadBlob.py
13
loadBlob.py
|
@ -30,24 +30,25 @@ def writeSourceCode(dir, code):
|
|||
file = open(dir, "wb")
|
||||
file.write(code)
|
||||
file.close()
|
||||
return 0
|
||||
|
||||
|
||||
def loadSourceFiles(dir, list):
|
||||
def writeSourceFiles(dir, list):
|
||||
"""
|
||||
function: Write all source code to a new folder
|
||||
input: the directory of a new folder, the code list in type byte
|
||||
output: a folder with source files
|
||||
"""
|
||||
os.mkdir(dir + "/sourceFiles")
|
||||
folderpath = os.path.join(dir, "sourceFiles")
|
||||
os.mkdir(folderpath)
|
||||
i = 0
|
||||
for code in list:
|
||||
writeSourceCode(dir + "/sourceFiles/" + str(i) + ".txt", code)
|
||||
filepath = os.path.join(folderpath, str(i) + ".java")
|
||||
writeSourceCode(filepath, code)
|
||||
i = i + 1
|
||||
|
||||
|
||||
# a test for local repo
|
||||
list = loadBlobObjects("C:/Users/Administrator/redis")
|
||||
# list = loadBlobObjects("C:/Users/Administrator/redis")
|
||||
# print(list[0])
|
||||
# writeSourceCode("C:/Users/Administrator/redis/1.txt", list[0])
|
||||
# loadSourceFiles("C:/Users/Administrator/redis", list)
|
||||
# writeSourceFiles("C:/Users/Administrator/redis", list)
|
||||
|
|
Loading…
Reference in New Issue