Clean up lint errors

This commit is contained in:
Cristina Muñoz 2019-11-20 17:37:21 -08:00
parent f6bf9a0065
commit 0527f80531
5 changed files with 14 additions and 6 deletions

View File

@ -2,8 +2,8 @@ import operator
from pip._vendor.packaging.utils import canonicalize_name
from pip._internal.exceptions import CommandError
from pip._internal.utils.typing import MYPY_CHECK_RUNNING
from pip._internal.utils.models import Base
from pip._internal.utils.typing import MYPY_CHECK_RUNNING
if MYPY_CHECK_RUNNING:
from typing import Optional, Set, FrozenSet
@ -29,8 +29,10 @@ class FormatControl(Base):
# type: (object) -> bool
if isinstance(other, self.__class__):
if self.__slots__ == other.__slots__:
attr_getters = [operator.attrgetter(attr) for attr in self.__slots__]
return all(getter(self) == getter(other) for getter in attr_getters)
attr_getters = [operator.attrgetter(attr)
for attr in self.__slots__]
return all(getter(self) == getter(other)
for getter in attr_getters)
return False

View File

@ -1,4 +1,5 @@
from pip._vendor.six.moves.urllib import parse as urllib_parse
from pip._internal.utils.models import Base
@ -6,7 +7,8 @@ class PackageIndex(Base):
"""Represents a Package Index and provides easier access to endpoints
"""
__slots__ = ["url", "netloc", "simple_url", "pypi_url", "file_storage_domain"]
__slots__ = ['url', 'netloc', 'simple_url', 'pypi_url',
'file_storage_domain']
def __init__(self, url, file_storage_domain):
# type: (str, str) -> None

View File

@ -7,6 +7,7 @@ https://docs.python.org/3/install/index.html#alternate-installation.
from pip._internal.utils.models import Base
class Scheme(Base):
"""A Scheme holds paths which are used as the base directories for
artifacts associated with a Python package.

View File

@ -12,7 +12,8 @@ class SelectionPreferences(Base):
and installing files.
"""
__slots__ = ['allow_yanked', 'allow_all_prereleases', 'format_control', 'prefer_binary', 'ignore_requires_python']
__slots__ = ['allow_yanked', 'allow_all_prereleases', 'format_control',
'prefer_binary', 'ignore_requires_python']
# Don't include an allow_yanked default value to make sure each call
# site considers whether yanked releases are allowed. This also causes

View File

@ -4,10 +4,12 @@
# mypy: disallow-untyped-defs=False
import operator
from typing import List
class Base(object):
__slots__ = []
__slots__ = [] # type: List[str]
class KeyBasedCompareMixin(Base):
"""Provides comparison capabilities that is based on a key