Fixed a rare bug with locals() being changed during iteration

This commit is contained in:
Profitroll 2024-09-19 21:56:24 +02:00
parent 956c4c30ea
commit 19971e6e71
Signed by: profitroll
GPG Key ID: FA35CAB49DACD3B2
8 changed files with 8 additions and 8 deletions

View File

@ -64,7 +64,7 @@ def board_arrival(
payload = {} payload = {}
headers = {"Accept": "application/json"} if json else {"Accept": "application/xml"} headers = {"Accept": "application/json"} if json else {"Accept": "application/xml"}
for var, val in locals().items(): for var, val in locals().copy().items():
if str(var) == "date": if str(var) == "date":
if val != None: if val != None:
if isinstance(val, datetime): if isinstance(val, datetime):

View File

@ -65,7 +65,7 @@ def board_departure(
payload = {} payload = {}
headers = {"Accept": "application/json"} if json else {"Accept": "application/xml"} headers = {"Accept": "application/json"} if json else {"Accept": "application/xml"}
for var, val in locals().items(): for var, val in locals().copy().items():
if str(var) == "date": if str(var) == "date":
if val != None: if val != None:
if isinstance(val, datetime): if isinstance(val, datetime):

View File

@ -97,7 +97,7 @@ def him_search(
payload = {} payload = {}
headers = {"Accept": "application/json"} if json else {"Accept": "application/xml"} headers = {"Accept": "application/json"} if json else {"Accept": "application/xml"}
for var, val in locals().items(): for var, val in locals().copy().items():
if str(var) in {"dateB", "dateE"}: if str(var) in {"dateB", "dateE"}:
if val != None: if val != None:
if isinstance(val, datetime): if isinstance(val, datetime):

View File

@ -55,7 +55,7 @@ def journey_detail(
payload = {} payload = {}
headers = {"Accept": "application/json"} if json else {"Accept": "application/xml"} headers = {"Accept": "application/json"} if json else {"Accept": "application/xml"}
for var, val in locals().items(): for var, val in locals().copy().items():
if str(var) == "rtMode": if str(var) == "rtMode":
if val != None: if val != None:
payload["rtMode"] = val.upper() payload["rtMode"] = val.upper()

View File

@ -54,7 +54,7 @@ def stop_by_coords(
payload = {} payload = {}
headers = {"Accept": "application/json"} if json else {"Accept": "application/xml"} headers = {"Accept": "application/json"} if json else {"Accept": "application/xml"}
for var, val in locals().items(): for var, val in locals().copy().items():
if str(var) == "stopType": if str(var) == "stopType":
if val != None: if val != None:
payload["type"] = val.upper() payload["type"] = val.upper()

View File

@ -65,7 +65,7 @@ def stop_by_name(
payload = {} payload = {}
headers = {"Accept": "application/json"} if json else {"Accept": "application/xml"} headers = {"Accept": "application/json"} if json else {"Accept": "application/xml"}
for var, val in locals().items(): for var, val in locals().copy().items():
if str(var) == "inputString": if str(var) == "inputString":
if val != None: if val != None:
payload["input"] = val payload["input"] = val

View File

@ -201,7 +201,7 @@ def trip_find(
payload = {} payload = {}
headers = {"Accept": "application/json"} if json else {"Accept": "application/xml"} headers = {"Accept": "application/json"} if json else {"Accept": "application/xml"}
for var, val in locals().items(): for var, val in locals().copy().items():
if str(var) == "date": if str(var) == "date":
if val != None: if val != None:
if isinstance(val, datetime): if isinstance(val, datetime):

View File

@ -87,7 +87,7 @@ def trip_recon(
payload = {} payload = {}
headers = {"Accept": "application/json"} if json else {"Accept": "application/xml"} headers = {"Accept": "application/json"} if json else {"Accept": "application/xml"}
for var, val in locals().items(): for var, val in locals().copy().items():
if str(var) == "date": if str(var) == "date":
if val != None: if val != None:
if isinstance(val, datetime): if isinstance(val, datetime):