From 88cbdd925c0c9456b7f1c448ce8f56b52739cb91 Mon Sep 17 00:00:00 2001 From: lilydjwg Date: Sun, 5 Jun 2022 14:41:57 +0800 Subject: [PATCH] fix mypy --- .github/workflows/mypy.yaml | 2 +- .github/workflows/tests.yaml | 2 +- nvchecker/core.py | 2 +- nvchecker/sortversion.py | 2 +- nvchecker/tools.py | 2 +- nvchecker/util.py | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/mypy.yaml b/.github/workflows/mypy.yaml index 43ab1d4..4a70a98 100644 --- a/.github/workflows/mypy.yaml +++ b/.github/workflows/mypy.yaml @@ -18,7 +18,7 @@ jobs: ${{ runner.os }}-${{ env.cache-name }}- ${{ runner.os }}-cache-pip- - name: Install deps - run: pip3 install -U tornado pytest pytest-asyncio pytest-httpbin flaky structlog tomli aiohttp httpx mypy + run: pip3 install -U tornado pytest pytest-asyncio pytest-httpbin flaky structlog tomli aiohttp httpx mypy awesomeversion - name: Run mypy for --install-types run: PATH=$HOME/.local/bin:$PATH mypy nvchecker nvchecker_source tests continue-on-error: true diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 559eb9e..d6dc3f2 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -45,7 +45,7 @@ jobs: sudo apt install -y libcurl4-openssl-dev # werkzeug is pinned for httpbin compatibility https://github.com/postmanlabs/httpbin/issues/673 - name: Install Python deps - run: pip install -U ${{ matrix.deps }} pytest pytest-asyncio pytest-httpbin flaky structlog tomli appdirs lxml 'werkzeug<2.1' + run: pip install -U ${{ matrix.deps }} pytest pytest-asyncio pytest-httpbin flaky structlog tomli appdirs lxml 'werkzeug<2.1' awesomeversion - name: Decrypt keys env: KEY: ${{ secrets.KEY }} diff --git a/nvchecker/core.py b/nvchecker/core.py index 9e75e0f..4f86de0 100644 --- a/nvchecker/core.py +++ b/nvchecker/core.py @@ -311,7 +311,7 @@ def apply_list_options( sort_version_key = sort_version_keys[ conf.get("sort_version_key", "parse_version")] - versions.sort(key=sort_version_key) + versions.sort(key=sort_version_key) # type: ignore return versions[-1] diff --git a/nvchecker/sortversion.py b/nvchecker/sortversion.py index c34b8e4..1a2bc9b 100644 --- a/nvchecker/sortversion.py +++ b/nvchecker/sortversion.py @@ -23,7 +23,7 @@ try: from awesomeversion import AwesomeVersion awesomeversion_available = True except ImportError: - def AwesomeVersion(k): + def AwesomeVersion(k): # type: ignore raise NotImplementedError("Using awesomeversion but it can not be imported!") awesomeversion_available = False diff --git a/nvchecker/tools.py b/nvchecker/tools.py index cf9d07d..0c6b615 100644 --- a/nvchecker/tools.py +++ b/nvchecker/tools.py @@ -126,7 +126,7 @@ def cmp() -> None: from .sortversion import sort_version_keys version = sort_version_keys[args.sort] - if version(oldver) > version(newver): + if version(oldver) > version(newver): # type: ignore if args.newer: continue # don't store this diff diff['delta'] = 'old' diff --git a/nvchecker/util.py b/nvchecker/util.py index fb50750..084da0a 100644 --- a/nvchecker/util.py +++ b/nvchecker/util.py @@ -194,7 +194,7 @@ class AsyncCache: self.cache[key] = fu if asyncio.isfuture(cached): # pending - return await cached # type: ignore + return await cached elif cached is not None: # cached return cached else: # not cached