-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathutils.py
52 lines (42 loc) · 1.21 KB
/
utils.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import os
from datetime import timedelta
from git import Repo
THE_EDIT_FILE = os.getcwd() + '/+arte♡.dat'
def valida_coherencia(cadena):
assert len(cadena) % 7 == 0
def edit_a_file():
try:
with open(THE_EDIT_FILE, 'r') as f:
line = f.readline()
if '¿y el arte?' in line:
write = '¿qué arte?'
else:
write = '¿y el arte?'
f.close()
except FileNotFoundError:
write = '¿y el arte?'
with open(THE_EDIT_FILE, 'w+') as f:
f.write(write)
f.close()
return write
def do_the_commits(contributions, datetime):
contributions = int(contributions)
if contributions == 4:
commits = 12
elif contributions == 3:
commits = 4
elif contributions == 2:
commits = 2
elif contributions == 1:
commits = 1
else:
commits = 0
index = Repo(os.getcwd()).index
for i in range(commits):
m = edit_a_file()
index.add(THE_EDIT_FILE)
date = datetime + timedelta(seconds=i * 3)
index.commit(m, commit_date=date, author_date=date)
def do_the_push():
origin = Repo(os.getcwd()).remote('origin')
origin.push(force=True)