Skip to content

Commit 2df1167

Browse files
bugfestmuayyad-alsadi
authored andcommitted
Fixes containers#661 - Fixes linting/flake8 errors
Signed-off-by: BugFest <[email protected]>
1 parent 5eff38e commit 2df1167

File tree

4 files changed

+35
-11
lines changed

4 files changed

+35
-11
lines changed

examples/hello-python/App/web.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import os
2-
import asyncio
2+
import asyncio # noqa: F401
33

44
import aioredis
55
from aiohttp import web

podman_compose.py

+29-9
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,23 @@
4343
script = os.path.realpath(sys.argv[0])
4444

4545
# helper functions
46-
is_str = lambda s: isinstance(s, str)
47-
is_dict = lambda d: isinstance(d, dict)
48-
is_list = lambda l: not is_str(l) and not is_dict(l) and hasattr(l, "__iter__")
46+
47+
48+
def is_str(string_object):
49+
return isinstance(string_object, str)
50+
51+
52+
def is_dict(dict_object):
53+
return isinstance(dict_object, dict)
54+
55+
56+
def is_list(list_object):
57+
return not is_str(list_object) and not is_dict(list_object) and hasattr(list_object, "__iter__")
58+
59+
4960
# identity filter
50-
filteri = lambda a: filter(lambda i: i, a)
61+
def filteri(a):
62+
return filter(lambda i: i, a)
5163

5264

5365
def try_int(i, fallback=None):
@@ -797,7 +809,9 @@ def get_net_args(compose, cnt):
797809
cnt_nets = cnt.get("networks", None)
798810
aliases = [service_name]
799811
# NOTE: from podman manpage:
800-
# 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.
812+
# NOTE: A container will only have access to aliases on the first network
813+
# that it joins. This is a limitation that will be removed in a later
814+
# release.
801815
ip = None
802816
ip6 = None
803817
if cnt_nets and is_dict(cnt_nets):
@@ -1127,7 +1141,11 @@ def run(
11271141
log(" ".join([str(i) for i in cmd_ls]))
11281142
if self.dry_run:
11291143
return None
1130-
# 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)
1144+
# subprocess.Popen(
1145+
# args, bufsize = 0, executable = None, stdin = None, stdout = None, stderr = None, preexec_fn = None,
1146+
# close_fds = False, shell = False, cwd = None, env = None, universal_newlines = False, startupinfo = None,
1147+
# creationflags = 0
1148+
# )
11311149
if log_formatter is not None:
11321150
# Pipe podman process output through log_formatter (which can add colored prefix)
11331151
p = subprocess.Popen(
@@ -1799,7 +1817,7 @@ def is_local(container: dict) -> bool:
17991817
* has a build section and is not prefixed
18001818
"""
18011819
return (
1802-
not "/" in container["image"]
1820+
"/" not in container["image"]
18031821
if "build" in container
18041822
else container["image"].startswith("localhost/")
18051823
)
@@ -2522,7 +2540,8 @@ def compose_up_parse(parser):
25222540
"-d",
25232541
"--detach",
25242542
action="store_true",
2525-
help="Detached mode: Run container in the background, print new container name. Incompatible with --abort-on-container-exit.",
2543+
help="Detached mode: Run container in the background, print new container name. \
2544+
Incompatible with --abort-on-container-exit.",
25262545
)
25272546
parser.add_argument(
25282547
"--no-color", action="store_true", help="Produce monochrome output."
@@ -2573,7 +2592,8 @@ def compose_up_parse(parser):
25732592
"--timeout",
25742593
type=int,
25752594
default=None,
2576-
help="Use this timeout in seconds for container shutdown when attached or when containers are already running. (default: 10)",
2595+
help="Use this timeout in seconds for container shutdown when attached or when containers are already running. \
2596+
(default: 10)",
25772597
)
25782598
parser.add_argument(
25792599
"-V",

setup.cfg

+4
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,7 @@ universal = 1
33

44
[metadata]
55
version = attr: podman_compose.__version__
6+
7+
[flake8]
8+
# The GitHub editor is 127 chars wide
9+
max-line-length=127

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
try:
55
readme = open(os.path.join(os.path.dirname(__file__), "README.md")).read()
6-
except:
6+
except: # noqa: E722
77
readme = ""
88

99
setup(

0 commit comments

Comments
 (0)