-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathutils.py
31 lines (26 loc) · 844 Bytes
/
utils.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import requests
import logging
import re
def request(get_response):
def wrapper(*args, **kwargs):
try:
get_response(*args, **kwargs)
except requests.exceptions.HTTPError as err:
msg = (
"Something went wrong trying to access the "
"LHCb nightly configuration website. "
"Please, check that you typed in correct URL"
" and that you have internet access."
)
logging.error(msg)
raise err
return wrapper
def color_values(value: str):
color = "black"
if re.search(r"(?:E:|F:)0", value):
color = "green"
if re.search(r"W:[1-9][0-9]{0,3}", value):
color = "orange"
if re.search(r"(?:E:|F:)[1-9][0-9]{0,3}", value):
color = "red"
return f"color: {color}"