@@ -39,14 +39,11 @@ def load_sz():
3939 spec .loader .exec_module (_sz )
4040 return _sz
4141
42- async def get_curr_metrics ():
43- await ensure_curr_repo ()
42+ def get_curr_metrics ():
4443 return load_sz ().gen_stats (str (REPO_DIR ))
4544
4645MAX_LINE_REGEX = re .compile (r"MAX_LINE_COUNT=(\d+)" )
47- async def get_curr_max_lines ():
48- await ensure_curr_repo ()
49-
46+ def get_curr_max_lines ():
5047 with (REPO_DIR / ".github" / "workflows" / "test.yml" ).open ("r" ) as f :
5148 for line in f :
5249 match = MAX_LINE_REGEX .search (line )
@@ -58,7 +55,8 @@ async def line_count(client: Client, event):
5855 """Displays the total line count and the line count per file."""
5956 message = yield "calculating metrics..."
6057
61- metrics = await get_curr_metrics ()
58+ await ensure_curr_repo ()
59+ metrics = get_curr_metrics ()
6260 total_line_count = sum (row [1 ] for row in metrics )
6361 sorted_metrics = sorted (metrics , key = lambda x : x [1 ], reverse = True )
6462
@@ -81,9 +79,10 @@ async def update_line_count(client: Client, event):
8179 if not event .user .has_role (ADMIN_ROLE ): return
8280 message = yield "updating metrics..."
8381
84- metrics = await get_curr_metrics ()
82+ await ensure_curr_repo ()
83+ metrics = get_curr_metrics ()
8584 total_line_count = sum (row [1 ] for row in metrics )
86- max_line_count = await get_curr_max_lines ()
85+ max_line_count = get_curr_max_lines ()
8786 free_lines = max_line_count - total_line_count
8887
8988 # update the topic
@@ -107,9 +106,10 @@ async def message_create(client: Client, message: Message):
107106
108107 # update the line count
109108 logging .info ("Updating line count topic..." )
110- metrics = await get_curr_metrics ()
109+ await ensure_curr_repo ()
110+ metrics = get_curr_metrics ()
111111 total_line_count = sum (row [1 ] for row in metrics )
112- max_line_count = await get_curr_max_lines ()
112+ max_line_count = get_curr_max_lines ()
113113 free_lines = max_line_count - total_line_count
114114
115115 # update the topic
0 commit comments