tweaks for mypy

This commit is contained in:
lilydjwg 2021-07-18 17:24:03 +08:00
parent 9a42ed9503
commit ddd99bd59f
3 changed files with 4 additions and 6 deletions

View File

@ -91,11 +91,10 @@ class NegativeInfinityType(object):
NegativeInfinity = NegativeInfinityType()
if TYPE_CHECKING: # pragma: no cover
from typing import Callable, Iterator, List, Optional, SupportsInt, Tuple, Union
from ._structures import InfinityType, NegativeInfinityType
InfiniteTypes = Union[InfinityType, NegativeInfinityType]
PrePostDevType = Union[InfiniteTypes, Tuple[str, int]]
SubLocalType = Union[InfiniteTypes, int, str]

View File

@ -1,5 +1,5 @@
# MIT licensed
# Copyright (c) 2013-2017 lilydjwg <lilydjwg@gmail.com>, et al.
# Copyright (c) 2013-2021 lilydjwg <lilydjwg@gmail.com>, et al.
'''
Sort versions using deprecated pkg_resource / packaging.parse_version or pyalpm.vercmp
@ -7,11 +7,10 @@ Sort versions using deprecated pkg_resource / packaging.parse_version or pyalpm.
__all__ = ["sort_version_keys"]
from functools import cmp_to_key
from .lib.packaging_version import parse as parse_version
try:
import pyalpm
from functools import cmp_to_key
vercmp = cmp_to_key(pyalpm.vercmp)
vercmp_available = True
except ImportError:

View File

@ -107,7 +107,7 @@ def cmp() -> None:
if args.sort != "none" and oldver is not None and newver is not 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
arrow = f'{c.red}<-{c.normal}'
if args.newer:
continue