Skip to content

Commit

Permalink
[release-4.6] Format code with Black
Browse files Browse the repository at this point in the history
Signed-off-by: Jan Rodák <[email protected]>
  • Loading branch information
Honny1 committed Oct 16, 2024
1 parent b3697c2 commit 9f3eee9
Show file tree
Hide file tree
Showing 42 changed files with 66 additions and 48 deletions.
1 change: 1 addition & 0 deletions podman/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Podman client module."""

import sys

assert sys.version_info >= (3, 6), "Python 3.6 or greater is required."
Expand Down
1 change: 1 addition & 0 deletions podman/api/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tools for connecting to a Podman service."""

import re

from podman.api.cached_property import cached_property
Expand Down
1 change: 1 addition & 0 deletions podman/api/adapter_utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Utility functions for working with Adapters."""

from typing import NamedTuple, Mapping


Expand Down
1 change: 1 addition & 0 deletions podman/api/cached_property.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Provide cached_property for Python <=3.8 programs."""

import functools

try:
Expand Down
1 change: 1 addition & 0 deletions podman/api/client.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""APIClient for connecting to Podman service."""

import json
import urllib.parse
from typing import Any, ClassVar, IO, Iterable, List, Mapping, Optional, Tuple, Type, Union
Expand Down
1 change: 1 addition & 0 deletions podman/api/http_utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Utility functions for working with URLs."""

import base64
import collections.abc
import json
Expand Down
1 change: 1 addition & 0 deletions podman/api/parse_utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Helper functions for parsing strings."""

import base64
import ipaddress
import json
Expand Down
1 change: 1 addition & 0 deletions podman/api/ssh.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
See Podman go bindings for more details.
"""

import collections
import functools
import logging
Expand Down
1 change: 1 addition & 0 deletions podman/api/tar_utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Utility functions for working with tarballs."""

import pathlib
import random
import shutil
Expand Down
6 changes: 4 additions & 2 deletions podman/api/typing_extensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -952,7 +952,8 @@ class AsyncContextManager(

__all__.append('AsyncContextManager')
elif sys.version_info[:2] >= (3, 5):
exec("""
exec(
"""
class AsyncContextManager(typing.Generic[T_co]):
__slots__ = ()
Expand All @@ -970,7 +971,8 @@ def __subclasshook__(cls, C):
return NotImplemented
__all__.append('AsyncContextManager')
""")
"""
)

if hasattr(typing, 'DefaultDict'):
DefaultDict = typing.DefaultDict
Expand Down
1 change: 1 addition & 0 deletions podman/api/uds.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Specialized Transport Adapter for UNIX domain sockets."""

import collections
import functools
import logging
Expand Down
1 change: 1 addition & 0 deletions podman/client.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Client for connecting to Podman service."""

import logging
import os
from contextlib import AbstractContextManager
Expand Down
1 change: 1 addition & 0 deletions podman/domain/config.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Read containers.conf file."""

import sys
import urllib
from pathlib import Path
Expand Down
1 change: 1 addition & 0 deletions podman/domain/containers.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Model and Manager for Container resources."""

import json
import logging
import shlex
Expand Down
1 change: 1 addition & 0 deletions podman/domain/containers_create.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Mixin to provide Container create() method."""

import copy
import logging
import re
Expand Down
1 change: 1 addition & 0 deletions podman/domain/containers_manager.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""PodmanResource manager subclassed for Containers."""

import logging
import urllib
from typing import Any, Dict, List, Mapping, Union
Expand Down
1 change: 1 addition & 0 deletions podman/domain/events.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Model and Manager for Event resources."""

import json
import logging
from datetime import datetime
Expand Down
1 change: 1 addition & 0 deletions podman/domain/images.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Model and Manager for Image resources."""

import logging
from typing import Any, Dict, Iterator, List, Optional, Union

Expand Down
1 change: 1 addition & 0 deletions podman/domain/images_build.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Mixin for Image build support."""

import json
import logging
import pathlib
Expand Down
1 change: 1 addition & 0 deletions podman/domain/images_manager.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""PodmanResource manager subclassed for Images."""

import io
import json
import logging
Expand Down
1 change: 1 addition & 0 deletions podman/domain/ipam.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Provided for compatibility
"""

from typing import Any, List, Mapping, Optional


Expand Down
1 change: 1 addition & 0 deletions podman/domain/manager.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Base classes for PodmanResources and Manager's."""

from abc import ABC, abstractmethod
from collections import abc
from typing import Any, List, Mapping, Optional, TypeVar, Union
Expand Down
1 change: 1 addition & 0 deletions podman/domain/manifests.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Model and Manager for Manifest resources."""

import logging
import urllib.parse
from contextlib import suppress
Expand Down
1 change: 1 addition & 0 deletions podman/domain/networks.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
net = client.networks.get("db_network")
print(net.name, "\n")
"""

import hashlib
import json
import logging
Expand Down
1 change: 1 addition & 0 deletions podman/domain/networks_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
for net in client.networks.list():
print(net.id, "\n")
"""

import ipaddress
import logging
import sys
Expand Down
1 change: 1 addition & 0 deletions podman/domain/pods.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Model and Manager for Pod resources."""

import logging
from typing import Any, Dict, Optional, Tuple, Union

Expand Down
1 change: 1 addition & 0 deletions podman/domain/pods_manager.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""PodmanResource manager subclassed for Networks."""

import json
import logging
from typing import Any, Dict, List, Optional, Union, Iterator
Expand Down
1 change: 1 addition & 0 deletions podman/domain/registry_data.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Module for tracking registry metadata."""

import logging
from typing import Any, Mapping, Optional, Union

Expand Down
1 change: 1 addition & 0 deletions podman/domain/secrets.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Model and Manager for Secrets resources."""

from contextlib import suppress
from typing import Any, List, Mapping, Optional, Union

Expand Down
1 change: 1 addition & 0 deletions podman/domain/system.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""SystemManager to provide system level information from Podman service."""

import logging
from typing import Any, Dict, Optional

Expand Down
1 change: 1 addition & 0 deletions podman/domain/volumes.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Model and Manager for Volume resources."""

import logging
from typing import Any, Dict, List, Optional, Union

Expand Down
1 change: 1 addition & 0 deletions podman/errors/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
ApiConnection and associated classes have been deprecated.
"""

import warnings
from http.client import HTTPException

Expand Down
1 change: 1 addition & 0 deletions podman/errors/exceptions.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Podman API Errors."""

import typing
from typing import Iterable, List, Optional, Union

Expand Down
1 change: 1 addition & 0 deletions podman/tests/integration/test_secrets.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Secrets integration tests."""

import random
import unittest
import uuid
Expand Down
3 changes: 1 addition & 2 deletions podman/tests/unit/test_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,7 @@ def test_build(self, mock_prepare_containerfile, mock_create_tar):

with requests_mock.Mocker() as mock:
mock.post(
tests.LIBPOD_URL
+ "/build"
tests.LIBPOD_URL + "/build"
"?t=latest"
"&buildargs=%7B%22BUILD_DATE%22%3A+%22January+1%2C+1970%22%7D"
"&cpuperiod=10"
Expand Down
6 changes: 4 additions & 2 deletions podman/tests/unit/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@


class PodmanConfigTestCase(unittest.TestCase):
opener = mock.mock_open(read_data="""
opener = mock.mock_open(
read_data="""
[containers]
log_size_max = -1
pids_limit = 2048
Expand All @@ -27,7 +28,8 @@ class PodmanConfigTestCase(unittest.TestCase):
identity = "/home/qe/.ssh/id_rsa"
[network]
""")
"""
)

def setUp(self) -> None:
super().setUp()
Expand Down
36 changes: 12 additions & 24 deletions podman/tests/unit/test_container.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ def tearDown(self) -> None:
@requests_mock.Mocker()
def test_remove(self, mock):
adapter = mock.delete(
tests.LIBPOD_URL
+ "/containers/"
tests.LIBPOD_URL + "/containers/"
"87e1325c82424e49a00abdd4de08009eb76c7de8d228426a9b8af9318ced5ecd?v=True&force=True",
status_code=204,
)
Expand Down Expand Up @@ -71,8 +70,7 @@ def test_rename_type_error(self, mock):
@requests_mock.Mocker()
def test_restart(self, mock):
adapter = mock.post(
tests.LIBPOD_URL
+ "/containers/"
tests.LIBPOD_URL + "/containers/"
"87e1325c82424e49a00abdd4de08009eb76c7de8d228426a9b8af9318ced5ecd/restart?timeout=10",
status_code=204,
)
Expand All @@ -83,8 +81,7 @@ def test_restart(self, mock):
@requests_mock.Mocker()
def test_start_dkeys(self, mock):
adapter = mock.post(
tests.LIBPOD_URL
+ "/containers/"
tests.LIBPOD_URL + "/containers/"
"87e1325c82424e49a00abdd4de08009eb76c7de8d228426a9b8af9318ced5ecd/start"
"?detachKeys=%5Ef%5Eu",
status_code=204,
Expand Down Expand Up @@ -126,8 +123,7 @@ def test_stats(self, mock):
buffer.write("\n")

adapter = mock.get(
tests.LIBPOD_URL
+ "/containers/stats"
tests.LIBPOD_URL + "/containers/stats"
"?containers=87e1325c82424e49a00abdd4de08009eb76c7de8d228426a9b8af9318ced5ecd"
"&stream=True",
text=buffer.getvalue(),
Expand All @@ -149,8 +145,7 @@ def test_stats(self, mock):
@requests_mock.Mocker()
def test_stop(self, mock):
adapter = mock.post(
tests.LIBPOD_URL
+ "/containers/"
tests.LIBPOD_URL + "/containers/"
"87e1325c82424e49a00abdd4de08009eb76c7de8d228426a9b8af9318ced5ecd/stop"
"?all=True&timeout=10.0",
status_code=204,
Expand Down Expand Up @@ -179,8 +174,7 @@ def test_stop_304(self, mock):
@requests_mock.Mocker()
def test_unpause(self, mock):
adapter = mock.post(
tests.LIBPOD_URL
+ "/containers/"
tests.LIBPOD_URL + "/containers/"
"87e1325c82424e49a00abdd4de08009eb76c7de8d228426a9b8af9318ced5ecd/unpause",
status_code=204,
)
Expand Down Expand Up @@ -231,8 +225,7 @@ def test_diff(self, mock):
{"Path": "deleted", "Kind": 2},
]
adapter = mock.get(
tests.LIBPOD_URL
+ "/containers/"
tests.LIBPOD_URL + "/containers/"
"87e1325c82424e49a00abdd4de08009eb76c7de8d228426a9b8af9318ced5ecd/changes",
json=payload,
)
Expand All @@ -244,8 +237,7 @@ def test_diff(self, mock):
@requests_mock.Mocker()
def test_diff_404(self, mock):
adapter = mock.get(
tests.LIBPOD_URL
+ "/containers/"
tests.LIBPOD_URL + "/containers/"
"87e1325c82424e49a00abdd4de08009eb76c7de8d228426a9b8af9318ced5ecd/changes",
json={
"cause": "Container not found.",
Expand Down Expand Up @@ -290,8 +282,7 @@ def test_get_archive(self, mock):
encoded_value = base64.urlsafe_b64encode(json.dumps(header_value).encode("utf8"))

adapter = mock.get(
tests.LIBPOD_URL
+ "/containers/"
tests.LIBPOD_URL + "/containers/"
"87e1325c82424e49a00abdd4de08009eb76c7de8d228426a9b8af9318ced5ecd/archive"
"?path=/etc/motd",
body=body,
Expand All @@ -312,8 +303,7 @@ def test_get_archive(self, mock):
@requests_mock.Mocker()
def test_commit(self, mock):
post_adapter = mock.post(
tests.LIBPOD_URL
+ "/commit"
tests.LIBPOD_URL + "/commit"
"?author=redhat&changes=ADD+%2fetc%2fmod&comment=This+is+a+unittest"
"&container=87e1325c82424e49a00abdd4de08009eb76c7de8d228426a9b8af9318ced5ecd&format=docker"
"&pause=True&repo=quay.local&tag=unittest",
Expand Down Expand Up @@ -346,8 +336,7 @@ def test_commit(self, mock):
@requests_mock.Mocker()
def test_put_archive(self, mock):
adapter = mock.put(
tests.LIBPOD_URL
+ "/containers/"
tests.LIBPOD_URL + "/containers/"
"87e1325c82424e49a00abdd4de08009eb76c7de8d228426a9b8af9318ced5ecd/archive"
"?path=%2fetc%2fmotd",
status_code=200,
Expand All @@ -363,8 +352,7 @@ def test_put_archive(self, mock):
@requests_mock.Mocker()
def test_put_archive_404(self, mock):
adapter = mock.put(
tests.LIBPOD_URL
+ "/containers/"
tests.LIBPOD_URL + "/containers/"
"87e1325c82424e49a00abdd4de08009eb76c7de8d228426a9b8af9318ced5ecd/archive"
"?path=deadbeef",
status_code=404,
Expand Down
3 changes: 1 addition & 2 deletions podman/tests/unit/test_containersmanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,7 @@ def test_list(self, mock):
@requests_mock.Mocker()
def test_list_filtered(self, mock):
mock.get(
tests.LIBPOD_URL
+ "/containers/json?"
tests.LIBPOD_URL + "/containers/json?"
"all=True"
"&filters=%7B"
"%22before%22%3A"
Expand Down
Loading

0 comments on commit 9f3eee9

Please sign in to comment.