Skip to content

Commit df473d3

Browse files
committed
mixed tabs and spaces
1 parent 2d613fa commit df473d3

File tree

1 file changed

+27
-27
lines changed

1 file changed

+27
-27
lines changed

generateGraph.py

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,14 @@ def get_commits(user, repository, force_refresh=False):
2424
return commits
2525

2626
def create_repo_node(repo_name, image_url, count):
27-
return {"name" : repo_name , "image" : image_url, "group" : count, "type" : "repo"}
27+
return {"name" : repo_name , "image" : image_url, "group" : count, "type" : "repo"}
2828

2929
def create_contributor_node(contributor, group=1):
3030
return {"name" : contributor["login"], "image" : contributor["avatar_url"], "group" : group, "type" : "contributor"}
3131

3232
def create_center_node(image=CENTER_IMG):
33-
return {"name" : "JUPYTER", "image" : image, "group" : 0, "type" : "center"}
34-
33+
return {"name" : "JUPYTER", "image" : image, "group" : 0, "type" : "center"}
34+
3535
def create_graph_repos(repos=REPOS, use_custom_images=USE_CUSTOM_IMAGES, repo_img_dir=REPO_IMG_DIR, img_type=IMG_TYPE):
3636
graph = {"nodes" : [], "links" : []}
3737
center_id = 0
@@ -41,7 +41,7 @@ def create_graph_repos(repos=REPOS, use_custom_images=USE_CUSTOM_IMAGES, repo_im
4141
commits = get_commits(user, repository)
4242
url = CENTER_IMG
4343
if use_custom_images:
44-
url = repo_img_dir + user + "_" + repository + "." + img_type
44+
url = repo_img_dir + user + "_" + repository + "." + img_type
4545
repo_node = create_repo_node(repository, url, len(repo_ids))
4646
graph["nodes"].append(repo_node)
4747
repo_id = len(graph["nodes"]) - 1
@@ -58,36 +58,36 @@ def create_graph_repos(repos=REPOS, use_custom_images=USE_CUSTOM_IMAGES, repo_im
5858
node = create_contributor_node(author, group=len(repo_ids)-1)
5959
graph["nodes"].append(node)
6060
contrib_id = len(graph["nodes"]) - 1
61-
graph["links"].append({"source" : repo_id, "target" : contrib_id, "value" : 2})
61+
graph["links"].append({"source" : repo_id, "target" : contrib_id, "value" : 2})
6262
graph["links"].append({"source" : repo_ids[0], "target" : repo_ids[-1], "value" : 1})
6363
return graph
6464

6565
def should_refresh(timestamp_file=TIMESTAMP_FILE, refresh_interval=REFRESH_INTERVAL):
66-
now = time.time()
67-
then = 0
68-
if os.path.isfile(timestamp_file):
69-
with open(timestamp_file, 'r') as f:
70-
then = float(f.readline().strip())
71-
return now - then > refresh_interval
66+
now = time.time()
67+
then = 0
68+
if os.path.isfile(timestamp_file):
69+
with open(timestamp_file, 'r') as f:
70+
then = float(f.readline().strip())
71+
return now - then > refresh_interval
7272

7373
def update_timestamp(timestamp_file=TIMESTAMP_FILE):
74-
now = time.time()
75-
with open(timestamp_file, 'w') as f:
76-
f.write(str(now))
74+
now = time.time()
75+
with open(timestamp_file, 'w') as f:
76+
f.write(str(now))
7777

7878
def main(command=[]):
79-
force_refresh = False
80-
if len(command) > 0 and command[0] == "force-refresh":
81-
force_refresh = True
82-
if force_refresh or should_refresh():
83-
graph = create_graph_repos()
84-
if graph is not None and len(graph["nodes"]) > 0:
85-
with open(DATA_FILE, 'w') as f:
86-
json.dump(graph, f)
87-
else:
88-
raise ValueError("Empty graph generated")
89-
update_timestamp()
90-
79+
force_refresh = False
80+
if len(command) > 0 and command[0] == "force-refresh":
81+
force_refresh = True
82+
if force_refresh or should_refresh():
83+
graph = create_graph_repos()
84+
if graph is not None and len(graph["nodes"]) > 0:
85+
with open(DATA_FILE, 'w') as f:
86+
json.dump(graph, f)
87+
else:
88+
raise ValueError("Empty graph generated")
89+
update_timestamp()
90+
9191

9292
if __name__ == "__main__":
93-
main(command=sys.argv[1:])
93+
main(command=sys.argv[1:])

0 commit comments

Comments
 (0)