From 45d64fd69089772f3fa5227e348c801e1f9f5b5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcus=20Sch=C3=A4fer?= Date: Tue, 1 Aug 2023 09:25:59 +0200 Subject: [PATCH] Fixed linter errors Latest changes regarding type hints introduced linter errors. Also adapt the workflow run which is expected to detect them --- .github/workflows/ci-code-style.yml | 4 ++-- .github/workflows/ci-units-types.yml | 4 ++-- kiwi/container/base.py | 2 +- kiwi/container/oci.py | 7 +++---- kiwi/path.py | 7 ++++--- kiwi/utils/compress.py | 8 +++++--- 6 files changed, 17 insertions(+), 15 deletions(-) diff --git a/.github/workflows/ci-code-style.yml b/.github/workflows/ci-code-style.yml index 0e035dd8324..5e6c6ca5e11 100644 --- a/.github/workflows/ci-code-style.yml +++ b/.github/workflows/ci-code-style.yml @@ -12,7 +12,7 @@ jobs: runs-on: ubuntu-20.04 strategy: matrix: - python-version: ["3.6", "3.8", "3.9", "3.10"] + python-version: ["3.8", "3.9", "3.10"] steps: - uses: actions/checkout@v2 @@ -23,7 +23,7 @@ jobs: - name: Install Tox run: | python -m pip install --upgrade pip - python -m pip install tox==3.28.0 + python -m pip install tox - name: Run code checks run: | tox -e check diff --git a/.github/workflows/ci-units-types.yml b/.github/workflows/ci-units-types.yml index b1b7c7a2dba..8cfc414ee7d 100644 --- a/.github/workflows/ci-units-types.yml +++ b/.github/workflows/ci-units-types.yml @@ -12,7 +12,7 @@ jobs: runs-on: ubuntu-20.04 strategy: matrix: - python-version: ["3.6", "3.8", "3.9", "3.10"] + python-version: ["3.8", "3.9", "3.10"] steps: - uses: actions/checkout@v2 @@ -23,7 +23,7 @@ jobs: - name: Install Tox run: | python -m pip install --upgrade pip - python -m pip install tox==3.28.0 + python -m pip install tox - name: Run unit and type tests run: | tox -e unit_py3_6,unit_py3_8,unit_py3_9,unit_py3_10 diff --git a/kiwi/container/base.py b/kiwi/container/base.py index 9b1e8e2e1cd..2aea8a8defe 100644 --- a/kiwi/container/base.py +++ b/kiwi/container/base.py @@ -24,4 +24,4 @@ def create( self, filename: str, base_image: str, ensure_empty_tmpdirs: bool, compress_archive: bool = False ) -> str: - pass # pragma: no cover + pass # pragma: no cover diff --git a/kiwi/container/oci.py b/kiwi/container/oci.py index 37115edd662..50379cb9249 100644 --- a/kiwi/container/oci.py +++ b/kiwi/container/oci.py @@ -20,9 +20,9 @@ import sys from typing import Dict, List, Optional if sys.version_info >= (3, 8): - from typing import TypedDict # pragma: no cover -else: # pragma: no cover - from typing_extensions import TypedDict # pragma: no cover + from typing import TypedDict # pragma: no cover +else: # pragma: no cover + from typing_extensions import TypedDict # pragma: no cover # project from kiwi.utils.compress import Compress @@ -119,7 +119,6 @@ def __init__(self, root_dir: str, transport: str, custom_args: Optional[OciConfi self.oci_config['history']['created_by'] = \ Defaults.get_default_container_created_by() - def create( self, filename: str, base_image: str, ensure_empty_tmpdirs: bool = True, compress_archive: bool = False diff --git a/kiwi/path.py b/kiwi/path.py index 053bf841263..35fe9dd99a9 100644 --- a/kiwi/path.py +++ b/kiwi/path.py @@ -223,9 +223,10 @@ def rebase_to_root(root: str, elements: List[str]) -> List[str]: @staticmethod def which( - filename: str, alternative_lookup_paths: Optional[List[str]]=None, - custom_env: Optional[Dict[str, str]]=None, access_mode: Optional[int]=None, - root_dir: Optional[str]=None + filename: str, alternative_lookup_paths: Optional[List[str]] = None, + custom_env: Optional[Dict[str, str]] = None, + access_mode: Optional[int] = None, + root_dir: Optional[str] = None ) -> Optional[str]: """ Lookup file name in PATH diff --git a/kiwi/utils/compress.py b/kiwi/utils/compress.py index d29b7dba9d0..e28516966e7 100644 --- a/kiwi/utils/compress.py +++ b/kiwi/utils/compress.py @@ -44,7 +44,9 @@ class Compress: :param str uncompressed_filename: Uncompressed file name path """ - def __init__(self, source_filename: str, keep_source_on_compress: bool=False) -> None: + def __init__( + self, source_filename: str, keep_source_on_compress: bool = False + ) -> None: if not os.path.exists(source_filename): raise KiwiFileNotFound( 'compression source file %s not found' % source_filename @@ -57,7 +59,7 @@ def __init__(self, source_filename: str, keep_source_on_compress: bool=False) -> self.compressed_filename: Optional[str] = None self.uncompressed_filename: Optional[str] = None - def xz(self, options: Optional[List[str]]=None) -> str: + def xz(self, options: Optional[List[str]] = None) -> str: """ Create XZ compressed file @@ -89,7 +91,7 @@ def gzip(self) -> str: self.compressed_filename = self.source_filename + '.gz' return self.compressed_filename - def uncompress(self, temporary: bool=False) -> str: + def uncompress(self, temporary: bool = False) -> str: """ Uncompress with format autodetection