Skip to content

Commit a19e33a

Browse files
committed
update
1 parent f8c2f75 commit a19e33a

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

reparo.py

+8-8
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333

3434
REPO = input("repo name: ")
3535
dirname = input("path to repo: ")
36+
LINK = "https://api.github.com/repos/chaoss/"
3637

3738

3839
def getlistoffiles(dirname):
@@ -67,10 +68,9 @@ def main():
6768
api_func(item, dirname)
6869

6970

70-
def api_func(items2, dirname):
71-
PATH_TO_FILE2 = items2.replace(dirname, '')
71+
def api_func(file_name, dirname):
72+
PATH_TO_FILE2 = file_name.replace(dirname, '')
7273
PATH_TO_FILE = PATH_TO_FILE2.strip('/')
73-
LINK = "https://api.github.com/repos/chaoss/"
7474

7575
data = requests.get(LINK + REPO + "/commits?path=" + PATH_TO_FILE)
7676

@@ -89,7 +89,7 @@ def api_func(items2, dirname):
8989
authors = [key + " <" + value + ">" for key, value in authors_data.items()]
9090
authors.append('')
9191

92-
# print(authors)
92+
print(authors)
9393

9494
template_file = open("gpl-v3.tmpl")
9595

@@ -103,21 +103,21 @@ def api_func(items2, dirname):
103103

104104
result = src.substitute(sub_dict)
105105

106-
with open(items2, 'r') as f:
106+
with open(file_name, 'r') as f:
107107
contents = f.readlines()
108108
i = 0
109109
for item in contents:
110110
if item.startswith('#'):
111111
i += 1
112112

113-
with open(items2, 'w') as f:
113+
with open(file_name, 'w') as f:
114114
f.writelines(contents[i:])
115115

116-
with open(items2, 'r') as f:
116+
with open(file_name, 'r') as f:
117117
contents = f.readlines()
118118
contents.insert(0, result+"\n")
119119

120-
with open(items2, 'w') as f:
120+
with open(file_name, 'w') as f:
121121
contents = "".join(contents)
122122
f.write(contents)
123123

0 commit comments

Comments
 (0)