mirror of https://github.com/docker/docker-py.git
ci: update Ruff & fix some minor issues (#3206)
Signed-off-by: Aarni Koskela <akx@iki.fi>
This commit is contained in:
parent
b8a6987cd5
commit
08956b5fbc
|
@ -14,7 +14,7 @@ jobs:
|
|||
- uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: '3.x'
|
||||
- run: pip install -U ruff==0.0.284
|
||||
- run: pip install -U ruff==0.1.8
|
||||
- name: Run ruff
|
||||
run: ruff docker tests
|
||||
|
||||
|
|
|
@ -903,9 +903,9 @@ class ContainerCollection(Collection):
|
|||
container, exit_status, command, image, out
|
||||
)
|
||||
|
||||
return out if stream or out is None else b''.join(
|
||||
[line for line in out]
|
||||
)
|
||||
if stream or out is None:
|
||||
return out
|
||||
return b''.join(out)
|
||||
|
||||
def create(self, image, command=None, **kwargs):
|
||||
"""
|
||||
|
|
|
@ -64,7 +64,7 @@ def read_exactly(socket, n):
|
|||
Reads exactly n bytes from socket
|
||||
Raises SocketError if there isn't enough data
|
||||
"""
|
||||
data = bytes()
|
||||
data = b""
|
||||
while len(data) < n:
|
||||
next_data = read(socket, n - len(data))
|
||||
if not next_data:
|
||||
|
@ -152,7 +152,7 @@ def consume_socket_output(frames, demux=False):
|
|||
if demux is False:
|
||||
# If the streams are multiplexed, the generator returns strings, that
|
||||
# we just need to concatenate.
|
||||
return bytes().join(frames)
|
||||
return b"".join(frames)
|
||||
|
||||
# If the streams are demultiplexed, the generator yields tuples
|
||||
# (stdout, stderr)
|
||||
|
|
|
@ -152,7 +152,7 @@ def convert_volume_binds(binds):
|
|||
]
|
||||
if 'propagation' in v and v['propagation'] in propagation_modes:
|
||||
if mode:
|
||||
mode = ','.join([mode, v['propagation']])
|
||||
mode = f"{mode},{v['propagation']}"
|
||||
else:
|
||||
mode = v['propagation']
|
||||
|
||||
|
|
|
@ -5,14 +5,16 @@ requires = ["setuptools>=45", "setuptools_scm[toml]>=6.2"]
|
|||
write_to = 'docker/_version.py'
|
||||
|
||||
[tool.ruff]
|
||||
target-version = "py37"
|
||||
target-version = "py38"
|
||||
extend-select = [
|
||||
"B",
|
||||
"C",
|
||||
"F",
|
||||
"UP",
|
||||
"W",
|
||||
]
|
||||
ignore = [
|
||||
"UP012", # unnecessary `UTF-8` argument (we want to be explicit)
|
||||
"C901", # too complex (there's a whole bunch of these)
|
||||
]
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
setuptools==65.5.1
|
||||
coverage==7.2.7
|
||||
ruff==0.0.284
|
||||
ruff==0.1.8
|
||||
pytest==7.4.2
|
||||
pytest-cov==4.1.0
|
||||
pytest-timeout==2.1.0
|
||||
|
|
|
@ -389,9 +389,7 @@ class BuildTest(BaseAPIIntegrationTest):
|
|||
lines = []
|
||||
for chunk in stream:
|
||||
lines.append(chunk.get('stream'))
|
||||
expected = '{0}{2}\n{1}'.format(
|
||||
control_chars[0], control_chars[1], snippet
|
||||
)
|
||||
expected = f'{control_chars[0]}{snippet}\n{control_chars[1]}'
|
||||
assert any(line == expected for line in lines)
|
||||
|
||||
def test_build_gzip_encoding(self):
|
||||
|
|
|
@ -380,9 +380,7 @@ class BuildTest(BaseAPIIntegrationTest):
|
|||
lines = []
|
||||
for chunk in stream:
|
||||
lines.append(chunk.get('stream'))
|
||||
expected = '{0}{2}\n{1}'.format(
|
||||
control_chars[0], control_chars[1], snippet
|
||||
)
|
||||
expected = f'{control_chars[0]}{snippet}\n{control_chars[1]}'
|
||||
assert any(line == expected for line in lines)
|
||||
|
||||
def test_build_gzip_encoding(self):
|
||||
|
|
|
@ -82,7 +82,7 @@ def fake_delete(self, url, *args, **kwargs):
|
|||
|
||||
|
||||
def fake_read_from_socket(self, response, stream, tty=False, demux=False):
|
||||
return bytes()
|
||||
return b''
|
||||
|
||||
|
||||
url_base = f'{fake_api.prefix}/'
|
||||
|
|
Loading…
Reference in New Issue