Skip to content

Commit 4d9fb54

Browse files
committed
Correct Ruff target version, enable UP, autofix
1 parent 0cde374 commit 4d9fb54

File tree

6 files changed

+9
-11
lines changed

6 files changed

+9
-11
lines changed

docker/utils/socket.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def read_exactly(socket, n):
6464
Reads exactly n bytes from socket
6565
Raises SocketError if there isn't enough data
6666
"""
67-
data = bytes()
67+
data = b""
6868
while len(data) < n:
6969
next_data = read(socket, n - len(data))
7070
if not next_data:
@@ -152,7 +152,7 @@ def consume_socket_output(frames, demux=False):
152152
if demux is False:
153153
# If the streams are multiplexed, the generator returns strings, that
154154
# we just need to concatenate.
155-
return bytes().join(frames)
155+
return b"".join(frames)
156156

157157
# If the streams are demultiplexed, the generator yields tuples
158158
# (stdout, stderr)

docker/utils/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ def convert_volume_binds(binds):
152152
]
153153
if 'propagation' in v and v['propagation'] in propagation_modes:
154154
if mode:
155-
mode = ','.join([mode, v['propagation']])
155+
mode = f"{mode},{v['propagation']}"
156156
else:
157157
mode = v['propagation']
158158

pyproject.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,16 @@ requires = ["setuptools>=45", "setuptools_scm[toml]>=6.2"]
55
write_to = 'docker/_version.py'
66

77
[tool.ruff]
8-
target-version = "py37"
8+
target-version = "py38"
99
extend-select = [
1010
"B",
1111
"C",
1212
"F",
13+
"UP",
1314
"W",
1415
]
1516
ignore = [
17+
"UP012", # unnecessary `UTF-8` argument (we want to be explicit)
1618
"C901", # too complex (there's a whole bunch of these)
1719
]
1820

tests/integration/api_build_test.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -389,9 +389,7 @@ def test_build_stderr_data(self):
389389
lines = []
390390
for chunk in stream:
391391
lines.append(chunk.get('stream'))
392-
expected = '{0}{2}\n{1}'.format(
393-
control_chars[0], control_chars[1], snippet
394-
)
392+
expected = f'{control_chars[0]}{snippet}\n{control_chars[1]}'
395393
assert any(line == expected for line in lines)
396394

397395
def test_build_gzip_encoding(self):

tests/ssh/api_build_test.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -380,9 +380,7 @@ def test_build_stderr_data(self):
380380
lines = []
381381
for chunk in stream:
382382
lines.append(chunk.get('stream'))
383-
expected = '{0}{2}\n{1}'.format(
384-
control_chars[0], control_chars[1], snippet
385-
)
383+
expected = f'{control_chars[0]}{snippet}\n{control_chars[1]}'
386384
assert any(line == expected for line in lines)
387385

388386
def test_build_gzip_encoding(self):

tests/unit/api_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ def fake_delete(self, url, *args, **kwargs):
8282

8383

8484
def fake_read_from_socket(self, response, stream, tty=False, demux=False):
85-
return bytes()
85+
return b''
8686

8787

8888
url_base = f'{fake_api.prefix}/'

0 commit comments

Comments
 (0)