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 = {}
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 val != None:
if isinstance(val, datetime):

View File

@ -65,7 +65,7 @@ def board_departure(
payload = {}
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 val != None:
if isinstance(val, datetime):

View File

@ -97,7 +97,7 @@ def him_search(
payload = {}
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 val != None:
if isinstance(val, datetime):

View File

@ -55,7 +55,7 @@ def journey_detail(
payload = {}
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 val != None:
payload["rtMode"] = val.upper()

View File

@ -54,7 +54,7 @@ def stop_by_coords(
payload = {}
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 val != None:
payload["type"] = val.upper()

View File

@ -65,7 +65,7 @@ def stop_by_name(
payload = {}
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 val != None:
payload["input"] = val

View File

@ -201,7 +201,7 @@ def trip_find(
payload = {}
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 val != None:
if isinstance(val, datetime):

View File

@ -87,7 +87,7 @@ def trip_recon(
payload = {}
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 val != None:
if isinstance(val, datetime):