Skip to content

Commit e26ab09

Browse files
committed
remove upgrade UP032
1 parent f5a8022 commit e26ab09

13 files changed

+23
-48
lines changed

adafruit_requests.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ def _send_request( # noqa: PLR0913 Too many arguments in function definition
429429
content_type_header = "application/x-www-form-urlencoded"
430430
_post_data = ""
431431
for k in data:
432-
_post_data = "{}&{}={}".format(_post_data, k, data[k])
432+
_post_data = f"{_post_data}&{k}={data[k]}"
433433
# remove first "&" from concatenation
434434
data = _post_data[1:]
435435

examples/cpython/requests_cpython_simpletest.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
response.close()
3131

3232
data = "31F"
33-
print("POSTing data to {0}: {1}".format(JSON_POST_URL, data))
33+
print(f"POSTing data to {JSON_POST_URL}: {data}")
3434
response = requests.post(JSON_POST_URL, data=data)
3535
print("-" * 40)
3636

@@ -41,7 +41,7 @@
4141
response.close()
4242

4343
json_data = {"Date": "July 25, 2019"}
44-
print("POSTing data to {0}: {1}".format(JSON_POST_URL, json_data))
44+
print(f"POSTing data to {JSON_POST_URL}: {json_data}")
4545
response = requests.post(JSON_POST_URL, json=json_data)
4646
print("-" * 40)
4747

examples/esp32spi/requests_esp32spi_simpletest.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868
response.close()
6969

7070
data = "31F"
71-
print("POSTing data to {0}: {1}".format(JSON_POST_URL, data))
71+
print(f"POSTing data to {JSON_POST_URL}: {data}")
7272
response = requests.post(JSON_POST_URL, data=data)
7373
print("-" * 40)
7474

@@ -79,7 +79,7 @@
7979
response.close()
8080

8181
json_data = {"Date": "July 25, 2019"}
82-
print("POSTing data to {0}: {1}".format(JSON_POST_URL, json_data))
82+
print(f"POSTing data to {JSON_POST_URL}: {json_data}")
8383
response = requests.post(JSON_POST_URL, json=json_data)
8484
print("-" * 40)
8585

examples/fona/requests_fona_simpletest.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
response.close()
7070

7171
data = "31F"
72-
print("POSTing data to {0}: {1}".format(JSON_POST_URL, data))
72+
print(f"POSTing data to {JSON_POST_URL}: {data}")
7373
response = requests.post(JSON_POST_URL, data=data)
7474
print("-" * 40)
7575

@@ -80,7 +80,7 @@
8080
response.close()
8181

8282
json_data = {"Date": "July 25, 2019"}
83-
print("POSTing data to {0}: {1}".format(JSON_POST_URL, json_data))
83+
print(f"POSTing data to {JSON_POST_URL}: {json_data}")
8484
response = requests.post(JSON_POST_URL, json=json_data)
8585
print("-" * 40)
8686

examples/wifi/expanded/requests_wifi_api_openskynetwork_private.py

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -76,14 +76,7 @@ def time_calc(input_time): # input_time in seconds
7676

7777

7878
def _format_datetime(datetime):
79-
return "{:02}/{:02}/{} {:02}:{:02}:{:02}".format(
80-
datetime.tm_mon,
81-
datetime.tm_mday,
82-
datetime.tm_year,
83-
datetime.tm_hour,
84-
datetime.tm_min,
85-
datetime.tm_sec,
86-
)
79+
return f"{datetime.tm_mon:02}/{datetime.tm_mday:02}/{datetime.tm_year} {datetime.tm_hour:02}:{datetime.tm_min:02}:{datetime.tm_sec:02}"
8780

8881

8982
# Connect to Wi-Fi
@@ -124,7 +117,7 @@ def _format_datetime(datetime):
124117
print("Current Unix Time: ", osn_flight)
125118

126119
current_struct_time = time.localtime(osn_flight)
127-
current_date = "{}".format(_format_datetime(current_struct_time))
120+
current_date = f"{_format_datetime(current_struct_time)}"
128121
print(f"Unix to Readable Time: {current_date}")
129122

130123
# Current flight data for single callsign (right now)

examples/wifi/expanded/requests_wifi_api_openskynetwork_private_area.py

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -91,14 +91,7 @@ def time_calc(input_time): # input_time in seconds
9191

9292

9393
def _format_datetime(datetime):
94-
return "{:02}/{:02}/{} {:02}:{:02}:{:02}".format(
95-
datetime.tm_mon,
96-
datetime.tm_mday,
97-
datetime.tm_year,
98-
datetime.tm_hour,
99-
datetime.tm_min,
100-
datetime.tm_sec,
101-
)
94+
return f"{datetime.tm_mon:02}/{datetime.tm_mday:02}/{datetime.tm_year} {datetime.tm_hour:02}:{datetime.tm_min:02}:{datetime.tm_sec:02}"
10295

10396

10497
# Connect to Wi-Fi
@@ -139,7 +132,7 @@ def _format_datetime(datetime):
139132
print("Current Unix Time: ", osn_flight)
140133

141134
current_struct_time = time.localtime(osn_flight)
142-
current_date = "{}".format(_format_datetime(current_struct_time))
135+
current_date = f"{_format_datetime(current_struct_time)}"
143136
print(f"Unix to Readable Time: {current_date}")
144137

145138
# Current flight data for single callsign (right now)

examples/wifi/expanded/requests_wifi_api_openskynetwork_public.py

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,7 @@ def time_calc(input_time): # input_time in seconds
5555

5656

5757
def _format_datetime(datetime):
58-
return "{:02}/{:02}/{} {:02}:{:02}:{:02}".format(
59-
datetime.tm_mon,
60-
datetime.tm_mday,
61-
datetime.tm_year,
62-
datetime.tm_hour,
63-
datetime.tm_min,
64-
datetime.tm_sec,
65-
)
58+
return f"{datetime.tm_mon:02}/{datetime.tm_mday:02}/{datetime.tm_year} {datetime.tm_hour:02}:{datetime.tm_min:02}:{datetime.tm_sec:02}"
6659

6760

6861
# Connect to Wi-Fi
@@ -104,7 +97,7 @@ def _format_datetime(datetime):
10497
print("Current Unix Time: ", osn_flight)
10598

10699
current_struct_time = time.localtime(osn_flight)
107-
current_date = "{}".format(_format_datetime(current_struct_time))
100+
current_date = f"{_format_datetime(current_struct_time)}"
108101
print(f"Unix to Readable Time: {current_date}")
109102

110103
osn_single_flight_data = osn_json["states"]

examples/wifi/expanded/requests_wifi_api_twitter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@
110110
print("Monotonic: ", time.monotonic())
111111

112112
print("\nFinished!")
113-
print("Next Update in {} {}".format(int(sleep_int), sleep_time_conversion))
113+
print(f"Next Update in {int(sleep_int)} {sleep_time_conversion}")
114114
print("===============================")
115115
gc.collect()
116116

examples/wifi/expanded/requests_wifi_api_youtube.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@
113113
print("Monotonic: ", time.monotonic())
114114

115115
print("\nFinished!")
116-
print("Next Update in {} {}".format(int(sleep_int), sleep_time_conversion))
116+
print(f"Next Update in {int(sleep_int)} {sleep_time_conversion}")
117117
print("===============================")
118118
gc.collect()
119119

examples/wifi/requests_wifi_simpletest.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
response.close()
5151

5252
data = "31F"
53-
print("POSTing data to {0}: {1}".format(JSON_POST_URL, data))
53+
print(f"POSTing data to {JSON_POST_URL}: {data}")
5454
response = requests.post(JSON_POST_URL, data=data)
5555
print("-" * 40)
5656

@@ -61,7 +61,7 @@
6161
response.close()
6262

6363
json_data = {"Date": "July 25, 2019"}
64-
print("POSTing data to {0}: {1}".format(JSON_POST_URL, json_data))
64+
print(f"POSTing data to {JSON_POST_URL}: {json_data}")
6565
response = requests.post(JSON_POST_URL, json=json_data)
6666
print("-" * 40)
6767

examples/wiznet5k/requests_wiznet5k_simpletest.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
response.close()
4242

4343
data = "31F"
44-
print("POSTing data to {0}: {1}".format(JSON_POST_URL, data))
44+
print(f"POSTing data to {JSON_POST_URL}: {data}")
4545
response = requests.post(JSON_POST_URL, data=data)
4646
print("-" * 40)
4747

@@ -52,7 +52,7 @@
5252
response.close()
5353

5454
json_data = {"Date": "July 25, 2019"}
55-
print("POSTing data to {0}: {1}".format(JSON_POST_URL, json_data))
55+
print(f"POSTing data to {JSON_POST_URL}: {json_data}")
5656
response = requests.post(JSON_POST_URL, json=json_data)
5757
print("-" * 40)
5858

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ target-version = "py38"
4343

4444
[tool.ruff.lint]
4545
select = ["I", "PL", "UP"]
46-
ignore = ["PLR2004", "UP030", "UP032"]
46+
ignore = ["PLR2004", "UP030"]
4747

4848
[tool.ruff.format]
4949
line-ending = "lf"

tests/parse_test.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,9 @@
1515
# Padding here tests the case where a header line is exactly 32 bytes buffered by
1616
# aligning the Content-Type header after it.
1717
HEADERS = (
18-
(
19-
"HTTP/1.0 200 OK\r\npadding: 000\r\n"
20-
"Content-Type: application/json\r\nContent-Length: {}\r\n\r\n"
21-
)
22-
.format(len(ENCODED))
23-
.encode("utf-8")
24-
)
18+
"HTTP/1.0 200 OK\r\npadding: 000\r\n"
19+
f"Content-Type: application/json\r\nContent-Length: {len(ENCODED)}\r\n\r\n"
20+
).encode()
2521

2622

2723
def test_json(pool):

0 commit comments

Comments
 (0)