Skip to content

Commit fd065dd

Browse files
feat : new function added
1 parent e6790c7 commit fd065dd

File tree

5 files changed

+2259
-1
lines changed

5 files changed

+2259
-1
lines changed

gitfollow/gitfollow.py

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,35 @@
88
from random import randint
99
DEBUG=False
1010
import gc
11+
12+
13+
def zero_insert(input_string):
14+
'''
15+
This function get a string as input if input is one digit add a zero
16+
:param input_string: input digit az string
17+
:type input_string:str
18+
:return: modified output as str
19+
'''
20+
if len(input_string)==1:
21+
return "0"+input_string
22+
return input_string
23+
24+
def time_convert(input_string):
25+
'''
26+
This function convert input_string from uptime from sec to DD,HH,MM,SS Format
27+
:param input_string: input time string in sec
28+
:type input_string:str
29+
:return: converted time as string
30+
'''
31+
input_sec=float(input_string)
32+
input_minute=input_sec//60
33+
input_sec=int(input_sec-input_minute*60)
34+
input_hour=input_minute//60
35+
input_minute=int(input_minute-input_hour*60)
36+
input_day=int(input_hour//24)
37+
input_hour=int(input_hour-input_day*24)
38+
return zero_insert(str(input_day))+" days, "+zero_insert(str(input_hour))+" hour, "+zero_insert(str(input_minute))+" minutes, "+zero_insert(str(input_sec))+" seconds"
39+
1140
def url_maker_following(Name,page_number):
1241
'''
1342
This function return github following page url
@@ -244,7 +273,8 @@ def dif(list_1,list_2):
244273
(list_1,list_2)=follow(username)
245274
dif(list_1,list_2)
246275
time_2=time.perf_counter()
247-
print("Data Generated In "+str(time_2-time_1)+" sec")
276+
dif_time=str(time_2-time_1)
277+
print("Data Generated In "+time_convert(dif_time)+" sec")
248278
print("Log Files Are Ready --> " + os.getcwd())
249279
gc.collect()
250280

0 commit comments

Comments
 (0)