Skip to content

Commit

Permalink
Fix some more lint issues
Browse files Browse the repository at this point in the history
Signed-off-by: Urvashi Mohnani <[email protected]>
  • Loading branch information
umohnani8 committed Nov 9, 2023
1 parent 45feb5e commit 431ce95
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 49 deletions.
12 changes: 5 additions & 7 deletions podman/domain/containers_create.py
Original file line number Diff line number Diff line change
Expand Up @@ -657,13 +657,11 @@ def parse_host_port(_container_port, _protocol, _host):
}

for item in args.pop("ulimits", []):
params["r_limits"].append(
{
"type": item["Name"],
"hard": item["Hard"],
"soft": item["Soft"],
}
)
params["r_limits"].append({
"type": item["Name"],
"hard": item["Hard"],
"soft": item["Soft"],
})

for item in args.pop("volumes", {}).items():
key, value = item
Expand Down
10 changes: 4 additions & 6 deletions podman/domain/images_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,12 +153,10 @@ def prune(
error.append(element["Err"])
else:
reclaimed += element["Size"]
deleted.append(
{
"Deleted": element["Id"],
"Untagged": "",
}
)
deleted.append({
"Deleted": element["Id"],
"Untagged": "",
})
if len(error) > 0:
raise APIError(response.url, response=response, explanation="; ".join(error))

Expand Down
26 changes: 11 additions & 15 deletions podman/domain/ipam.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,12 @@ def __init__(
aux_addresses: Ignored.
"""
super().__init__()
self.update(
{
"AuxiliaryAddresses": aux_addresses,
"Gateway": gateway,
"IPRange": iprange,
"Subnet": subnet,
}
)
self.update({
"AuxiliaryAddresses": aux_addresses,
"Gateway": gateway,
"IPRange": iprange,
"Subnet": subnet,
} )


class IPAMConfig(dict):
Expand All @@ -52,10 +50,8 @@ def __init__(
options: Options to provide to the Network driver.
"""
super().__init__()
self.update(
{
"Config": pool_configs or [],
"Driver": driver,
"Options": options or {},
}
)
self.update({
"Config": pool_configs or [],
"Driver": driver,
"Options": options or {},
})
22 changes: 9 additions & 13 deletions podman/tests/integration/test_container_create.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,12 +149,10 @@ def test_container_ports(self):
self.containers.append(container)

self.assertTrue(
all(
[
x in port_test['expected_output']
for x in container.attrs.get('HostConfig', {}).get('PortBindings')
]
)
all([
x in port_test['expected_output']
for x in container.attrs.get('HostConfig', {}).get('PortBindings')
])
)

def test_container_healthchecks(self):
Expand Down Expand Up @@ -243,13 +241,11 @@ def test_container_devices(self):
for device in devices:
path_on_host, path_in_container = device.split(':', 1)
self.assertTrue(
any(
[
c.get('PathOnHost') == path_on_host
and c.get('PathInContainer') == path_in_container
for c in container_devices
]
)
any([
c.get('PathOnHost') == path_on_host
and c.get('PathInContainer') == path_in_container
for c in container_devices
])
)

with self.subTest("Check devices in running container object"):
Expand Down
14 changes: 6 additions & 8 deletions podman/tests/integration/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,12 @@ def __init__(
if os.environ.get("container") == "oci":
self.cmd.append("--storage-driver=vfs")

self.cmd.extend(
[
"system",
"service",
f"--time={timeout}",
socket_uri,
]
)
self.cmd.extend([
"system",
"service",
f"--time={timeout}",
socket_uri,
])

process = subprocess.run(
[podman_exe, "--version"], check=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT
Expand Down

0 comments on commit 431ce95

Please sign in to comment.