Skip to content

Commit

Permalink
Fix files to comply with pre-commit
Browse files Browse the repository at this point in the history
Signed-off-by: Nicola Sella <[email protected]>
  • Loading branch information
inknos committed Nov 29, 2024
1 parent d2ef131 commit 06768b0
Show file tree
Hide file tree
Showing 61 changed files with 872 additions and 670 deletions.
1 change: 0 additions & 1 deletion contrib/cirrus/build_podman.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,3 @@ systemctl stop podman.socket || :
dnf erase podman -y
dnf copr enable rhcontainerbot/podman-next -y
dnf install podman -y

1 change: 0 additions & 1 deletion docs/source/_templates/apidoc/toc.rst_t
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,3 @@
{% for docname in docnames %}
{{ docname }}
{%- endfor %}

78 changes: 39 additions & 39 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@

from sphinx.domains.python import PythonDomain

sys.path.insert(0, os.path.abspath('../..'))
sys.path.insert(0, os.path.abspath("../.."))


# -- Project information -----------------------------------------------------

project = u'Podman Python SDK'
copyright = u'2021, Red Hat Inc'
author = u'Red Hat Inc'
project = "Podman Python SDK"
copyright = "2021, Red Hat Inc"
author = "Red Hat Inc"

# The full version, including alpha/beta/rc tags
version = '3.2.1.0'
version = "3.2.1.0"
release = version

add_module_names = False
Expand All @@ -39,22 +39,22 @@
# sphinx.ext.napoleon: Support for NumPy and Google style docstrings
# sphinx.ext.viewcode: Add links to highlighted source code
# isort: unique-list
extensions = ['sphinx.ext.napoleon', 'sphinx.ext.autodoc', 'sphinx.ext.viewcode']
extensions = ["sphinx.ext.napoleon", "sphinx.ext.autodoc", "sphinx.ext.viewcode"]

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
templates_path = ["_templates"]

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
# isort: unique-list
exclude_patterns = [
'podman.api.*rst',
'podman.rst',
'podman.version.rst',
'podman.tlsconfig.rst',
'podman.errors.rst',
'podman.domain.rst',
"podman.api.*rst",
"podman.rst",
"podman.version.rst",
"podman.tlsconfig.rst",
"podman.errors.rst",
"podman.domain.rst",
]


Expand All @@ -63,44 +63,44 @@
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'alabaster'
html_favicon = '_static/podman-logo.ico'
html_theme = "alabaster"
html_favicon = "_static/podman-logo.ico"
html_theme_options = {
'description': 'Develop scripted Podman operations',
'fixed_sidebar': False,
'github_banner': True,
'github_repo': 'podman-py',
'github_user': 'containers',
'logo': "podman-logo.png",
'logo_name': True,
'show_powered_by': False,
'extra_nav_links': {
'Report PodmanPy Issue': 'https://github.com/containers/podman-py/issues',
'Podman Reference': 'https://docs.podman.io',
'Podman on github': 'https://github.com/containers/podman',
"description": "Develop scripted Podman operations",
"fixed_sidebar": False,
"github_banner": True,
"github_repo": "podman-py",
"github_user": "containers",
"logo": "podman-logo.png",
"logo_name": True,
"show_powered_by": False,
"extra_nav_links": {
"Report PodmanPy Issue": "https://github.com/containers/podman-py/issues",
"Podman Reference": "https://docs.podman.io",
"Podman on github": "https://github.com/containers/podman",
},
}

html_sidebars = {
'**': [
'about.html',
'navigation.html',
'relations.html',
'searchbox.html',
"**": [
"about.html",
"navigation.html",
"relations.html",
"searchbox.html",
]
}

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
html_static_path = ["_static"]

# -- autoclass settings ------------------------------------------------------ s
autodoc_member_order = "groupwise"
autodoc_default_options = {
'members': True,
'inherited-members': True,
'show-inheritance': True,
"members": True,
"inherited-members": True,
"show-inheritance": True,
}
autoclass_content = "both"

Expand All @@ -123,16 +123,16 @@

class PatchedPythonDomain(PythonDomain):
def resolve_xref(self, env, fromdocname, builder, typ, target, node, contnode):
if 'refspecific' in node:
del node['refspecific']
if "refspecific" in node:
del node["refspecific"]
return super(PatchedPythonDomain, self).resolve_xref(
env, fromdocname, builder, typ, target, node, contnode
)


def skip(app, what, name, obj, would_skip, options):
# isort: unique-list
cls = ['ApiConnection', 'DockerClient', 'DockerException']
cls = ["ApiConnection", "DockerClient", "DockerException"]

if name in cls:
return True
Expand Down
2 changes: 1 addition & 1 deletion docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,4 @@ Indices and tables

* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
* :ref:`search`
2 changes: 1 addition & 1 deletion podman/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@
from podman.version import __version__

# isort: unique-list
__all__ = ['PodmanClient', '__version__', 'from_env']
__all__ = ["PodmanClient", "__version__", "from_env"]
42 changes: 23 additions & 19 deletions podman/api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@
stream_frames,
stream_helper,
)
from podman.api.tar_utils import create_tar, prepare_containerfile, prepare_containerignore
from podman.api.tar_utils import (
create_tar,
prepare_containerfile,
prepare_containerignore,
)

DEFAULT_CHUNK_SIZE = 2 * 1024 * 1024

Expand All @@ -27,22 +31,22 @@

# isort: unique-list
__all__ = [
'APIClient',
'COMPATIBLE_VERSION',
'DEFAULT_CHUNK_SIZE',
'Literal',
'VERSION',
'cached_property',
'create_tar',
'decode_header',
'frames',
'parse_repository',
'prepare_body',
'prepare_cidr',
'prepare_containerfile',
'prepare_containerignore',
'prepare_filters',
'prepare_timestamp',
'stream_frames',
'stream_helper',
"APIClient",
"COMPATIBLE_VERSION",
"DEFAULT_CHUNK_SIZE",
"Literal",
"VERSION",
"cached_property",
"create_tar",
"decode_header",
"frames",
"parse_repository",
"prepare_body",
"prepare_cidr",
"prepare_containerfile",
"prepare_containerignore",
"prepare_filters",
"prepare_timestamp",
"stream_frames",
"stream_helper",
]
15 changes: 13 additions & 2 deletions podman/api/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,18 @@
import json
import warnings
import urllib.parse
from typing import Any, ClassVar, IO, Iterable, List, Mapping, Optional, Tuple, Type, Union
from typing import (
Any,
ClassVar,
IO,
Iterable,
List,
Mapping,
Optional,
Tuple,
Type,
Union,
)

import requests
from requests.adapters import HTTPAdapter
Expand Down Expand Up @@ -36,7 +47,7 @@ class ParameterDeprecationWarning(DeprecationWarning):


# Make the ParameterDeprecationWarning visible for user.
warnings.simplefilter('always', ParameterDeprecationWarning)
warnings.simplefilter("always", ParameterDeprecationWarning)


class APIResponse:
Expand Down
2 changes: 1 addition & 1 deletion podman/api/http_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,4 @@ def _filter_values(mapping: Mapping[str, Any], recursion=False) -> Dict[str, Any


def encode_auth_header(auth_config: Dict[str, str]) -> str:
return base64.urlsafe_b64encode(json.dumps(auth_config).encode('utf-8'))
return base64.urlsafe_b64encode(json.dumps(auth_config).encode("utf-8"))
4 changes: 3 additions & 1 deletion podman/api/parse_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ def prepare_timestamp(value: Union[datetime, int, None]) -> Optional[int]:
raise ValueError(f"Type '{type(value)}' is not supported by prepare_timestamp()")


def prepare_cidr(value: Union[ipaddress.IPv4Network, ipaddress.IPv6Network]) -> (str, str):
def prepare_cidr(
value: Union[ipaddress.IPv4Network, ipaddress.IPv6Network],
) -> (str, str):
"""Returns network address and Base64 encoded netmask from CIDR.
The return values are dictated by the Go JSON decoder.
Expand Down
4 changes: 2 additions & 2 deletions podman/api/path_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
def get_runtime_dir() -> str:
"""Returns the runtime directory for the current user"""
try:
return os.environ['XDG_RUNTIME_DIR']
return os.environ["XDG_RUNTIME_DIR"]
except KeyError:
user = getpass.getuser()
fallback = f'/tmp/podmanpy-runtime-dir-fallback-{user}'
fallback = f"/tmp/podmanpy-runtime-dir-fallback-{user}"

try:
# This must be a real directory, not a symlink, so attackers can't
Expand Down
2 changes: 1 addition & 1 deletion podman/api/tar_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def prepare_containerignore(anchor: str) -> List[str]:
if not ignore.exists():
continue

with ignore.open(encoding='utf-8') as file:
with ignore.open(encoding="utf-8") as file:
return list(
filter(
lambda l: l and not l.startswith("#"),
Expand Down
Loading

0 comments on commit 06768b0

Please sign in to comment.