mirror of
https://github.com/containers/podman-compose.git
synced 2024-11-21 23:43:24 +01:00
Fixes #661 - Fixes linting/flake8 errors
Signed-off-by: BugFest <bugfest.dev@pm.me>
This commit is contained in:
parent
5eff38e743
commit
2df11674c4
@ -1,5 +1,5 @@
|
|||||||
import os
|
import os
|
||||||
import asyncio
|
import asyncio # noqa: F401
|
||||||
|
|
||||||
import aioredis
|
import aioredis
|
||||||
from aiohttp import web
|
from aiohttp import web
|
||||||
|
@ -43,11 +43,23 @@ __version__ = "1.0.7"
|
|||||||
script = os.path.realpath(sys.argv[0])
|
script = os.path.realpath(sys.argv[0])
|
||||||
|
|
||||||
# helper functions
|
# helper functions
|
||||||
is_str = lambda s: isinstance(s, str)
|
|
||||||
is_dict = lambda d: isinstance(d, dict)
|
|
||||||
is_list = lambda l: not is_str(l) and not is_dict(l) and hasattr(l, "__iter__")
|
def is_str(string_object):
|
||||||
|
return isinstance(string_object, str)
|
||||||
|
|
||||||
|
|
||||||
|
def is_dict(dict_object):
|
||||||
|
return isinstance(dict_object, dict)
|
||||||
|
|
||||||
|
|
||||||
|
def is_list(list_object):
|
||||||
|
return not is_str(list_object) and not is_dict(list_object) and hasattr(list_object, "__iter__")
|
||||||
|
|
||||||
|
|
||||||
# identity filter
|
# identity filter
|
||||||
filteri = lambda a: filter(lambda i: i, a)
|
def filteri(a):
|
||||||
|
return filter(lambda i: i, a)
|
||||||
|
|
||||||
|
|
||||||
def try_int(i, fallback=None):
|
def try_int(i, fallback=None):
|
||||||
@ -797,7 +809,9 @@ def get_net_args(compose, cnt):
|
|||||||
cnt_nets = cnt.get("networks", None)
|
cnt_nets = cnt.get("networks", None)
|
||||||
aliases = [service_name]
|
aliases = [service_name]
|
||||||
# NOTE: from podman manpage:
|
# NOTE: from podman manpage:
|
||||||
# NOTE: A container will only have access to aliases on the first network that it joins. This is a limitation that will be removed in a later release.
|
# NOTE: A container will only have access to aliases on the first network
|
||||||
|
# that it joins. This is a limitation that will be removed in a later
|
||||||
|
# release.
|
||||||
ip = None
|
ip = None
|
||||||
ip6 = None
|
ip6 = None
|
||||||
if cnt_nets and is_dict(cnt_nets):
|
if cnt_nets and is_dict(cnt_nets):
|
||||||
@ -1127,7 +1141,11 @@ class Podman:
|
|||||||
log(" ".join([str(i) for i in cmd_ls]))
|
log(" ".join([str(i) for i in cmd_ls]))
|
||||||
if self.dry_run:
|
if self.dry_run:
|
||||||
return None
|
return None
|
||||||
# subprocess.Popen(args, bufsize = 0, executable = None, stdin = None, stdout = None, stderr = None, preexec_fn = None, close_fds = False, shell = False, cwd = None, env = None, universal_newlines = False, startupinfo = None, creationflags = 0)
|
# subprocess.Popen(
|
||||||
|
# args, bufsize = 0, executable = None, stdin = None, stdout = None, stderr = None, preexec_fn = None,
|
||||||
|
# close_fds = False, shell = False, cwd = None, env = None, universal_newlines = False, startupinfo = None,
|
||||||
|
# creationflags = 0
|
||||||
|
# )
|
||||||
if log_formatter is not None:
|
if log_formatter is not None:
|
||||||
# Pipe podman process output through log_formatter (which can add colored prefix)
|
# Pipe podman process output through log_formatter (which can add colored prefix)
|
||||||
p = subprocess.Popen(
|
p = subprocess.Popen(
|
||||||
@ -1799,7 +1817,7 @@ def is_local(container: dict) -> bool:
|
|||||||
* has a build section and is not prefixed
|
* has a build section and is not prefixed
|
||||||
"""
|
"""
|
||||||
return (
|
return (
|
||||||
not "/" in container["image"]
|
"/" not in container["image"]
|
||||||
if "build" in container
|
if "build" in container
|
||||||
else container["image"].startswith("localhost/")
|
else container["image"].startswith("localhost/")
|
||||||
)
|
)
|
||||||
@ -2522,7 +2540,8 @@ def compose_up_parse(parser):
|
|||||||
"-d",
|
"-d",
|
||||||
"--detach",
|
"--detach",
|
||||||
action="store_true",
|
action="store_true",
|
||||||
help="Detached mode: Run container in the background, print new container name. Incompatible with --abort-on-container-exit.",
|
help="Detached mode: Run container in the background, print new container name. \
|
||||||
|
Incompatible with --abort-on-container-exit.",
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--no-color", action="store_true", help="Produce monochrome output."
|
"--no-color", action="store_true", help="Produce monochrome output."
|
||||||
@ -2573,7 +2592,8 @@ def compose_up_parse(parser):
|
|||||||
"--timeout",
|
"--timeout",
|
||||||
type=int,
|
type=int,
|
||||||
default=None,
|
default=None,
|
||||||
help="Use this timeout in seconds for container shutdown when attached or when containers are already running. (default: 10)",
|
help="Use this timeout in seconds for container shutdown when attached or when containers are already running. \
|
||||||
|
(default: 10)",
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"-V",
|
"-V",
|
||||||
|
@ -3,3 +3,7 @@ universal = 1
|
|||||||
|
|
||||||
[metadata]
|
[metadata]
|
||||||
version = attr: podman_compose.__version__
|
version = attr: podman_compose.__version__
|
||||||
|
|
||||||
|
[flake8]
|
||||||
|
# The GitHub editor is 127 chars wide
|
||||||
|
max-line-length=127
|
Loading…
Reference in New Issue
Block a user