fixup! Extended type annotations
This commit is contained in:
parent
fde2556e47
commit
e1d2ed9990
1 changed files with 3 additions and 2 deletions
|
@ -72,7 +72,7 @@ CURRENT_THEME: Themes = Themes(Themes.red_green)
|
||||||
|
|
||||||
def httping(targets: List[str]) -> Tuple[Dict[str, Optional[float]], Optional[float], Optional[float]]:
|
def httping(targets: List[str]) -> Tuple[Dict[str, Optional[float]], Optional[float], Optional[float]]:
|
||||||
"""Pings the supplied targets and returns a mean and a std deviation over all target responses."""
|
"""Pings the supplied targets and returns a mean and a std deviation over all target responses."""
|
||||||
responses : Dict[str, Optional[float]] = {}
|
responses: Dict[str, Optional[float]] = {}
|
||||||
for target in targets:
|
for target in targets:
|
||||||
try:
|
try:
|
||||||
responses[target] = requests.head(target, timeout=MAX_PING.total_seconds()).elapsed.total_seconds() * 1000
|
responses[target] = requests.head(target, timeout=MAX_PING.total_seconds()).elapsed.total_seconds() * 1000
|
||||||
|
@ -92,7 +92,8 @@ def httping(targets: List[str]) -> Tuple[Dict[str, Optional[float]], Optional[fl
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
responses, median, stddev = httping(TARGETS)
|
responses, median, stddev = httping(TARGETS)
|
||||||
if isinstance(median, float) and median != MAX_PING_IN_MS:
|
if isinstance(median, float) and median != MAX_PING_IN_MS:
|
||||||
print("⦿ " + str(round(median, 2)) + "±" + str(round(stddev, 2)) + " | color=" + CURRENT_THEME.colorize(median)) # type: ignore
|
print("⦿ " + str(round(median, 2)) + "±" + str(round(stddev, 2)) + " | color=" +
|
||||||
|
CURRENT_THEME.colorize(median)) # type: ignore
|
||||||
else:
|
else:
|
||||||
print("☠ | color=" + CURRENT_THEME.selected_colors[0])
|
print("☠ | color=" + CURRENT_THEME.selected_colors[0])
|
||||||
print("---")
|
print("---")
|
||||||
|
|
Loading…
Reference in a new issue