Commit
·
c56ec13
1
Parent(s):
c0f1750
Update util.py
Browse files
util.py
CHANGED
|
@@ -1,8 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
| 1 |
def snake_case_to_human_readable(s: str) -> str:
|
| 2 |
return " ".join(s.capitalize().split("_"))
|
| 3 |
|
|
|
|
|
|
|
|
|
|
| 4 |
|
| 5 |
def get_max_abs_int(int_csv_str: str) -> int:
|
| 6 |
"""Get the max absolute value int from an int CSV."""
|
| 7 |
-
|
| 8 |
-
return max(
|
|
|
|
| 1 |
+
from typing import List
|
| 2 |
+
|
| 3 |
+
|
| 4 |
def snake_case_to_human_readable(s: str) -> str:
|
| 5 |
return " ".join(s.capitalize().split("_"))
|
| 6 |
|
| 7 |
+
def int_csv_to_list(int_csv_str: str) -> List[int]:
|
| 8 |
+
"""Convert a CSV of ints to a list of ints."""
|
| 9 |
+
return [int(i.strip()) for i in int_csv_str.split(',') if i]
|
| 10 |
|
| 11 |
def get_max_abs_int(int_csv_str: str) -> int:
|
| 12 |
"""Get the max absolute value int from an int CSV."""
|
| 13 |
+
abs_ints = [abs(i) for i in int_csv_to_list(int_csv_str)]
|
| 14 |
+
return max(abs_ints)
|