Force black formatting

Black removes the burden of manual code formatting and is by now
considered the standard Python formatting tool.

https://black.readthedocs.io/en/stable/

Format all Python code with black.

GitHub linting action is updated to ensure all files are formatted with
Black.

Signed-off-by: Piotr Husiatyński <phusiatynski@gmail.com>
This commit is contained in:
Piotr Husiatyński 2022-03-01 08:53:24 +01:00 committed by Muayyad Alsadi
parent af10345483
commit 762318093c
7 changed files with 1180 additions and 642 deletions

View File

@ -12,6 +12,7 @@ jobs:
python-version: ["3.8", "3.9", "3.10"] python-version: ["3.8", "3.9", "3.10"]
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- uses: psf/black@stable
- name: Set up Python ${{ matrix.python-version }} - name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2 uses: actions/setup-python@v2
with: with:
@ -26,4 +27,3 @@ jobs:
python -m compileall podman_compose.py python -m compileall podman_compose.py
pylint podman_compose.py pylint podman_compose.py
# pylint $(git ls-files '*.py') # pylint $(git ls-files '*.py')

File diff suppressed because it is too large Load Diff

View File

@ -2,6 +2,7 @@ import pytest
from podman_compose import parse_short_mount from podman_compose import parse_short_mount
@pytest.fixture @pytest.fixture
def multi_propagation_mount_str(): def multi_propagation_mount_str():
return "/foo/bar:/baz:U,Z" return "/foo/bar:/baz:U,Z"

View File

@ -2,15 +2,15 @@ import os
from setuptools import setup from setuptools import setup
try: try:
readme = open(os.path.join(os.path.dirname(__file__), 'README.md')).read() readme = open(os.path.join(os.path.dirname(__file__), "README.md")).read()
except: except:
readme = '' readme = ""
setup( setup(
name='podman-compose', name="podman-compose",
description="A script to run docker-compose.yml using podman", description="A script to run docker-compose.yml using podman",
long_description=readme, long_description=readme,
long_description_content_type='text/markdown', long_description_content_type="text/markdown",
classifiers=[ classifiers=[
"Programming Language :: Python", "Programming Language :: Python",
"Programming Language :: Python :: 3", "Programming Language :: Python :: 3",
@ -23,21 +23,17 @@ setup(
"Topic :: Software Development :: Build Tools", "Topic :: Software Development :: Build Tools",
"License :: OSI Approved :: GNU General Public License v2 (GPLv2)", "License :: OSI Approved :: GNU General Public License v2 (GPLv2)",
], ],
keywords='podman, podman-compose', keywords="podman, podman-compose",
author='Muayyad Alsadi', author="Muayyad Alsadi",
author_email='alsadi@gmail.com', author_email="alsadi@gmail.com",
url='https://github.com/containers/podman-compose', url="https://github.com/containers/podman-compose",
py_modules=['podman_compose'], py_modules=["podman_compose"],
entry_points={ entry_points={"console_scripts": ["podman-compose = podman_compose:main"]},
'console_scripts': [
'podman-compose = podman_compose:main'
]
},
include_package_data=True, include_package_data=True,
license='GPL-2.0-only', license="GPL-2.0-only",
install_requires=[ install_requires=[
'pyyaml', "pyyaml",
'python-dotenv', "python-dotenv",
], ],
# test_suite='tests', # test_suite='tests',
# tests_require=[ # tests_require=[

View File

@ -6,3 +6,4 @@ coverage
pytest-cov pytest-cov
pytest pytest
tox tox
black

View File

@ -2,6 +2,7 @@ import pytest
from podman_compose import parse_short_mount from podman_compose import parse_short_mount
@pytest.fixture @pytest.fixture
def multi_propagation_mount_str(): def multi_propagation_mount_str():
return "/foo/bar:/baz:U,Z" return "/foo/bar:/baz:U,Z"

View File

@ -11,6 +11,7 @@ def capture(command):
out, err = proc.communicate() out, err = proc.communicate()
return out, err, proc.returncode return out, err, proc.returncode
def test_podman_compose_extends_w_file_subdir(): def test_podman_compose_extends_w_file_subdir():
""" """
Test that podman-compose can execute podman-compose -f <file> up with extended File which Test that podman-compose can execute podman-compose -f <file> up with extended File which
@ -25,7 +26,7 @@ def test_podman_compose_extends_w_file_subdir():
"-f", "-f",
str(main_path.joinpath("tests", "extends_w_file_subdir", "docker-compose.yml")), str(main_path.joinpath("tests", "extends_w_file_subdir", "docker-compose.yml")),
"up", "up",
"-d" "-d",
] ]
command_check_container = [ command_check_container = [
@ -34,7 +35,7 @@ def test_podman_compose_extends_w_file_subdir():
"ps", "ps",
"--all", "--all",
"--format", "--format",
"\"{{.Image}}\"" '"{{.Image}}"',
] ]
command_down = [ command_down = [
@ -42,7 +43,7 @@ def test_podman_compose_extends_w_file_subdir():
"rmi", "rmi",
"--force", "--force",
"localhost/subdir_test:me", "localhost/subdir_test:me",
"docker.io/library/bash" "docker.io/library/bash",
] ]
out, err, returncode = capture(command_up) out, err, returncode = capture(command_up)
@ -57,4 +58,4 @@ def test_podman_compose_extends_w_file_subdir():
# check container did not exists anymore # check container did not exists anymore
out, err, returncode = capture(command_check_container) out, err, returncode = capture(command_check_container)
assert 0 == returncode assert 0 == returncode
assert out == b'' assert out == b""