[21] fixes for f1

pull/811/head
meisnate12 3 years ago
parent b4165ac9ad
commit de9f3da43d

@ -1 +1 @@
1.16.2-develop20
1.16.2-develop21

@ -70,7 +70,7 @@ class Race:
def format_name(self, round_prefix, shorten_gp):
if self._language:
output = f"GP {self.name.replace(' Grand Prix', '')}" if shorten_gp else self.name
for eng_value, trans_value in translations[self._language]:
for eng_value, trans_value in translations[self._language].items():
output = output.replace(eng_value, trans_value)
else:
output = self.name.replace("Grand Prix", "GP") if shorten_gp else self.name

@ -133,8 +133,13 @@ def get_int_list(data, id_type):
return int_values
def validate_date(date_text, method, return_as=None):
try: date_obg = datetime.strptime(str(date_text), "%Y-%m-%d" if "-" in str(date_text) else "%m/%d/%Y")
except ValueError: raise Failed(f"Collection Error: {method}: {date_text} must match pattern YYYY-MM-DD (e.g. 2020-12-25) or MM/DD/YYYY (e.g. 12/25/2020)")
if isinstance(date_text, datetime):
date_obg = date_text
else:
try:
date_obg = datetime.strptime(str(date_text), "%Y-%m-%d" if "-" in str(date_text) else "%m/%d/%Y")
except ValueError:
raise Failed(f"Collection Error: {method}: {date_text} must match pattern YYYY-MM-DD (e.g. 2020-12-25) or MM/DD/YYYY (e.g. 12/25/2020)")
return datetime.strftime(date_obg, return_as) if return_as else date_obg
def logger_input(prompt, timeout=60):

Loading…
Cancel
Save