Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
0f9d259
Add basic mypy support
pradyunsg Jun 14, 2017
bc637a8
:newspaper:
pradyunsg Jun 16, 2017
ed9208e
Improve mypy configuration
pradyunsg Jun 14, 2017
9fce241
Patch pkg_resources for mypy
pradyunsg Jun 15, 2017
8f92b55
Fix mypy warnings
pradyunsg Jun 15, 2017
da46ab2
Add type annotations to pip.configuration
pradyunsg Jun 15, 2017
711596b
Use pip.utils.typing to guard typing imports
pradyunsg Jun 16, 2017
7c5f901
Modify vendoring to include additional .pyi stubs
pradyunsg Jul 4, 2017
adf4538
Add generated stubs
pradyunsg Jul 4, 2017
c2371a1
Exclude the pyi files and extra directory created
pradyunsg Jul 4, 2017
b3e16f9
Fix mypy errors since addition of stubs
pradyunsg Jul 17, 2017
55fd83f
Add a separate tox job for mypy
pradyunsg Jul 17, 2017
6a0da3d
Fix a bug found by mypy
pradyunsg Jul 17, 2017
9b03434
use six instead of try except
pradyunsg Jul 17, 2017
3046f7a
Don't ask for permission
pradyunsg Jul 17, 2017
182c548
Fix remaining errors
pradyunsg Jul 17, 2017
b9b5e4a
:art:
pradyunsg Jul 17, 2017
1b5a23f
:wrench:
pradyunsg Jul 17, 2017
c365304
Merge branch 'master' into mypy/infrastructure
pradyunsg Aug 2, 2017
cb113d5
I actually missed a conflict. Wow.
pradyunsg Aug 2, 2017
11451c5
Merge branch 'master' into mypy/infrastructure
pradyunsg Sep 2, 2017
d37868f
Move the typing file
pradyunsg Sep 2, 2017
d408818
Add imports I'd missed
pradyunsg Sep 2, 2017
d9a4431
Move mypy stubs as well
pradyunsg Sep 2, 2017
efd7264
Update MANIFEST
pradyunsg Sep 2, 2017
ec26f0a
Import from inner packages
pradyunsg Sep 2, 2017
da57810
type: Any partials in cmdoptions
pradyunsg Sep 2, 2017
93d9f20
Remove a useless section
pradyunsg Sep 2, 2017
e2b2f70
isort all imports
pradyunsg Sep 2, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix mypy errors since addition of stubs
  • Loading branch information
pradyunsg committed Jul 17, 2017
commit b3e16f9a9da0e4ca061a9d3566b7f9c335d67c5f
4 changes: 3 additions & 1 deletion pip/commands/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@

from pip._vendor import pkg_resources
from pip._vendor.packaging.version import parse as parse_version
from pip._vendor.six.moves import xmlrpc_client
# NOTE: XMLRPC Client is not annotated in typeshed as on 2017-07-17, which is
# why we ignore the type on this import
from pip._vendor.six.moves import xmlrpc_client # type: ignore

from pip.basecommand import SUCCESS, Command
from pip.download import PipXmlrpcTransport
Expand Down
14 changes: 7 additions & 7 deletions pip/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
if MYPY_CHECK_RUNNING:
from typing import Any, Dict, Iterable, List, NewType, Optional, Tuple

ConfigParser = configparser.ConfigParser # Shorthand
RawConfigParser = configparser.RawConfigParser # Shorthand
Kind = NewType("Kind", str)

logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -98,11 +98,11 @@ def __init__(self, isolated, load_only=None):
# Because we keep track of where we got the data from
self._parsers = {
variant: [] for variant in self._override_order
} # type: Dict[Kind, List[Tuple[str, ConfigParser]]]
} # type: Dict[Kind, List[Tuple[str, RawConfigParser]]]
self._config = {
variant: {} for variant in self._override_order
} # type: Dict[Kind, Dict[str, Any]]
self._modified_parsers = [] # type: List[Tuple[str, ConfigParser]]
self._modified_parsers = [] # type: List[Tuple[str, RawConfigParser]]

def load(self):
# type: () -> None
Expand Down Expand Up @@ -259,7 +259,7 @@ def _load_config_files(self):
self._parsers[variant].append((fname, parser))

def _load_file(self, variant, fname):
# type: (Kind, str) -> ConfigParser
# type: (Kind, str) -> RawConfigParser
logger.debug("For variant '%s', will try loading '%s'", variant, fname)
parser = self._construct_parser(fname)

Expand All @@ -270,7 +270,7 @@ def _load_file(self, variant, fname):
return parser

def _construct_parser(self, fname):
# type: (str) -> ConfigParser
# type: (str) -> RawConfigParser
parser = configparser.RawConfigParser()
# If there is no such file, don't bother reading it but create the
# parser anyway, to hold the data.
Expand Down Expand Up @@ -345,7 +345,7 @@ def _iter_config_files(self):
yield kinds.VENV, [venv_config_file]

def _get_parser_to_modify(self):
# type: () -> Tuple[str, ConfigParser]
# type: () -> Tuple[str, RawConfigParser]
# Determine which parser to modify
parsers = self._parsers[self.load_only]
if not parsers:
Expand All @@ -359,7 +359,7 @@ def _get_parser_to_modify(self):

# XXX: This is patched in the tests.
def _mark_as_modified(self, fname, parser):
# type: (str, ConfigParser) -> None
# type: (str, RawConfigParser) -> None
file_parser_tuple = (fname, parser)
if file_parser_tuple not in self._modified_parsers:
self._modified_parsers.append(file_parser_tuple)
4 changes: 3 additions & 1 deletion pip/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@
from pip._vendor.requests.packages import urllib3
from pip._vendor.requests.structures import CaseInsensitiveDict
from pip._vendor.requests.utils import get_netrc_auth
from pip._vendor.six.moves import xmlrpc_client
# NOTE: XMLRPC Client is not annotated in typeshed as on 2017-07-17, which is
# why we ignore the type on this import
from pip._vendor.six.moves import xmlrpc_client # type: ignore
from pip._vendor.six.moves.urllib import parse as urllib_parse
from pip._vendor.six.moves.urllib import request as urllib_request
from pip._vendor.six.moves.urllib.parse import unquote as urllib_unquote
Expand Down
4 changes: 3 additions & 1 deletion pip/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@
from pip._vendor import pkg_resources
from pip._vendor.six.moves import input
from pip._vendor.six import PY2
from pip._vendor.retrying import retry
# NOTE: retrying is not annotated in typeshed as on 2017-07-17, which is
# why we ignore the type on this import
from pip._vendor.retrying import retry # type: ignore

if PY2:
from io import BytesIO as StringIO
Expand Down